Skip to content

Commit

Permalink
Change ports for rabbitmq, postgres, and elasticsearch
Browse files Browse the repository at this point in the history
  • Loading branch information
laurenbarker committed Apr 19, 2017
1 parent 777830d commit e3acb86
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 19 deletions.
24 changes: 12 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ services:
elasticsearch:
image: elasticsearch:2
ports:
- 9200:9200
- 39200:9200

rabbitmq:
image: rabbitmq:management
ports:
- 5672:5672
- 15672:15672
- 35672:5672
- 45672:15672

postgres:
image: postgres
command: /bin/bash -c "sed -i -e 's/max_connections.*/max_connections = 5000/' /var/lib/postgresql/data/postgresql.conf || true && sed -i -e 's/#log_min_duration_statement = .*/log_min_duration_statement = 0/' /var/lib/postgresql/data/postgresql.conf || true && /docker-entrypoint.sh postgres"
ports:
- 5432:5432
- 35432:5432
environment:
POSTGRES_DB: share

Expand All @@ -60,15 +60,15 @@ services:
- ./:/code
environment:
DATABASE_HOST: postgres
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/
SHARE_API_URL: http://web:38000/
ELASTICSEARCH_URL: http://elasticsearch:39200/

web:
build: .
command: python manage.py runserver --noreload 0.0.0.0:8000
command: python manage.py runserver --noreload 0.0.0.0:38000
ports:
- 8000:8000
- 38000:8000
depends_on:
- postgres
- rabbitmq
Expand All @@ -81,6 +81,6 @@ services:
- ./:/code
environment:
DATABASE_HOST: postgres
BROKER_URL: amqp://guest:guest@rabbitmq:5672/
ELASTICSEARCH_URL: http://elasticsearch:9200/
EMBER_SHARE_URL: http://192.168.168.167:4200
BROKER_URL: amqp://guest:guest@rabbitmq:35672/
ELASTICSEARCH_URL: http://elasticsearch:39200/
EMBER_SHARE_URL: http://192.168.168.167:34200
7 changes: 7 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import os
import sys

import django

if os.environ.get('GEVENT') == '1':
from gevent import monkey
monkey.patch_all()
Expand All @@ -12,6 +14,11 @@
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")

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

from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)
14 changes: 7 additions & 7 deletions project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
'NAME': os.environ.get('DATABASE_NAME', 'share'),
'USER': os.environ.get('DATABASE_USER', 'postgres'),
'HOST': os.environ.get('DATABASE_HOST', 'localhost'),
'PORT': os.environ.get('DATABASE_PORT', '5432'),
'PORT': os.environ.get('DATABASE_PORT', '35432'),
'PASSWORD': os.environ.get('DATABASE_PASSWORD', None),
'CONN_MAX_AGE': os.environ.get('CONN_MAX_AGE', None),
'TEST': {'SERIALIZE': False},
Expand All @@ -219,7 +219,7 @@
'NAME': os.environ.get('DATABASE_NAME', 'share'),
'USER': os.environ.get('DATABASE_USER', 'postgres'),
'HOST': os.environ.get('DATABASE_HOST', 'localhost'),
'PORT': os.environ.get('DATABASE_PORT', '5432'),
'PORT': os.environ.get('DATABASE_PORT', '35432'),
'PASSWORD': os.environ.get('DATABASE_PASSWORD', None),
'CONN_MAX_AGE': os.environ.get('CONN_MAX_AGE', None),
'TEST': {'MIRROR': 'default', 'SERIALIZE': False},
Expand All @@ -246,7 +246,7 @@
},
]

LOGIN_REDIRECT_URL = os.environ.get('LOGIN_REDIRECT_URL', 'http://localhost:8000/')
LOGIN_REDIRECT_URL = os.environ.get('LOGIN_REDIRECT_URL', 'http://localhost:38000/')

if DEBUG:
AUTH_PASSWORD_VALIDATORS = []
Expand Down Expand Up @@ -317,7 +317,7 @@
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)

ELASTICSEARCH_URL = os.environ.get('ELASTICSEARCH_URL', 'http://localhost:9200/')
ELASTICSEARCH_URL = os.environ.get('ELASTICSEARCH_URL', 'http://localhost:39200/')
ELASTICSEARCH_INDEX = os.environ.get('ELASTIC_SEARCH_INDEX', 'share')
ELASTICSEARCH_TIMEOUT = int(os.environ.get('ELASTICSEARCH_TIMEOUT', '45'))
ELASTICSEARCH_INDEX_VERSIONS = tuple(v for v in os.environ.get('ELASTICSEARCH_INDEX_VERSIONS', '').split(',') if v)
Expand All @@ -327,7 +327,7 @@

# Celery Settings

BROKER_URL = os.environ.get('BROKER_URL', 'amqp://'),
BROKER_URL = os.environ.get('BROKER_URL', 'amqp://guest:guest@localhost:35672'),

CELERY_TIMEZONE = 'UTC'
CELERYBEAT_SCHEDULE = {}
Expand Down Expand Up @@ -472,8 +472,8 @@
PUBLIC_SENTRY_DSN = os.environ.get('PUBLIC_SENTRY_DSN')

EMBER_SHARE_PREFIX = os.environ.get('EMBER_SHARE_PREFIX', 'share' if DEBUG else '')
EMBER_SHARE_URL = os.environ.get('EMBER_SHARE_URL', 'http://localhost:4200').rstrip('/') + '/'
SHARE_API_URL = os.environ.get('SHARE_API_URL', 'http://localhost:8000').rstrip('/') + '/'
EMBER_SHARE_URL = os.environ.get('EMBER_SHARE_URL', 'http://localhost:34200').rstrip('/') + '/'
SHARE_API_URL = os.environ.get('SHARE_API_URL', 'http://localhost:38000').rstrip('/') + '/'
SHARE_WEB_URL = os.environ.get('SHARE_WEB_URL', SHARE_API_URL + EMBER_SHARE_PREFIX).rstrip('/') + '/'

OSF_API_URL = os.environ.get('OSF_API_URL', 'https://staging-api.osf.io').rstrip('/') + '/'
Expand Down

0 comments on commit e3acb86

Please sign in to comment.