Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SHARE-746][Improvement] Change ports for rabbitmq, postgres, and elasticsearch #629

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

laurenbarker
Copy link
Contributor

@laurenbarker laurenbarker commented Apr 19, 2017

Purpose

Make it easier to have both SHARE and the OSF running locally.

Changes

Added 30,000 to all SHARE services ports:

  • postgres: 5432 --> 35432
  • elasticsearch: 9200 --> 39200
  • rabbitmq: 5672 --> 35672
  • web: 4200 -->34200

To run the server locally (not in docker): python manage.py runlocalserver instead of python manage.py runserver.

To run the server locally (not in docker) would need to set a local env var to make 'PORT': os.environ.get('DATABASE_PORT', '5432'), 35432 in settings.py. And run python manage.py runlocalserver instead of python manage.py runserver.

Related PR: CenterForOpenScience/ember-share#191

This could be done in other ways:

  • Adding SHARE to OSF docker-compose
    • more likely to be forgotten about/get out of date
  • Using the same containers as OSF
    • I don't think this would work very well from what little I attempted
    • would depend on us using the same images as the OSF

Side effects

Need to make sure all environment variables are defined on staging/production.

Will require some changes to staging/production. Also changes to quay images.

Could just have a separate docker-compose.yml for local though?

Ticket

https://openscience.atlassian.net/browse/SHARE-746


web:
build: .
command: python manage.py runserver --noreload 0.0.0.0:8000
command: python manage.py runserver --noreload 0.0.0.0:38000
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work? You've told the server in the container to run on port 38000 but you're forwarding the host's port 8000 in the container still.

https://docs.docker.com/compose/compose-file/#ports

BROKER_URL: amqp://guest:guest@rabbitmq:5672/
SHARE_API_URL: http://web:8000/
ELASTICSEARCH_URL: http://elasticsearch:9200/
BROKER_URL: amqp://guest:guest@rabbitmq:35672/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this need to be kept as the default port? The actual connection should be happening inside the container.

manage.py Outdated
# Override default port for `runserver` command
django.setup()
from django.core.management.commands.runserver import Command as runserver
runserver.default_port = "38000"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels very hacky. Could you overwrite the runserver command with your own and then just subclass it?

@laurenbarker
Copy link
Contributor Author

@aaxelb, conflicts resolved. The docs/README.d/sharectl server need to be updated though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants