Skip to content

Commit e3acb86

Browse files
committed
Change ports for rabbitmq, postgres, and elasticsearch
1 parent 777830d commit e3acb86

File tree

3 files changed

+26
-19
lines changed

3 files changed

+26
-19
lines changed

docker-compose.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ services:
2828
elasticsearch:
2929
image: elasticsearch:2
3030
ports:
31-
- 9200:9200
31+
- 39200:9200
3232

3333
rabbitmq:
3434
image: rabbitmq:management
3535
ports:
36-
- 5672:5672
37-
- 15672:15672
36+
- 35672:5672
37+
- 45672:15672
3838

3939
postgres:
4040
image: postgres
4141
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"
4242
ports:
43-
- 5432:5432
43+
- 35432:5432
4444
environment:
4545
POSTGRES_DB: share
4646

@@ -60,15 +60,15 @@ services:
6060
- ./:/code
6161
environment:
6262
DATABASE_HOST: postgres
63-
BROKER_URL: amqp://guest:guest@rabbitmq:5672/
64-
SHARE_API_URL: http://web:8000/
65-
ELASTICSEARCH_URL: http://elasticsearch:9200/
63+
BROKER_URL: amqp://guest:guest@rabbitmq:35672/
64+
SHARE_API_URL: http://web:38000/
65+
ELASTICSEARCH_URL: http://elasticsearch:39200/
6666

6767
web:
6868
build: .
69-
command: python manage.py runserver --noreload 0.0.0.0:8000
69+
command: python manage.py runserver --noreload 0.0.0.0:38000
7070
ports:
71-
- 8000:8000
71+
- 38000:8000
7272
depends_on:
7373
- postgres
7474
- rabbitmq
@@ -81,6 +81,6 @@ services:
8181
- ./:/code
8282
environment:
8383
DATABASE_HOST: postgres
84-
BROKER_URL: amqp://guest:guest@rabbitmq:5672/
85-
ELASTICSEARCH_URL: http://elasticsearch:9200/
86-
EMBER_SHARE_URL: http://192.168.168.167:4200
84+
BROKER_URL: amqp://guest:guest@rabbitmq:35672/
85+
ELASTICSEARCH_URL: http://elasticsearch:39200/
86+
EMBER_SHARE_URL: http://192.168.168.167:34200

manage.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import os
33
import sys
44

5+
import django
6+
57
if os.environ.get('GEVENT') == '1':
68
from gevent import monkey
79
monkey.patch_all()
@@ -12,6 +14,11 @@
1214
if __name__ == "__main__":
1315
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
1416

17+
# Override default port for `runserver` command
18+
django.setup()
19+
from django.core.management.commands.runserver import Command as runserver
20+
runserver.default_port = "38000"
21+
1522
from django.core.management import execute_from_command_line
1623

1724
execute_from_command_line(sys.argv)

project/settings.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@
209209
'NAME': os.environ.get('DATABASE_NAME', 'share'),
210210
'USER': os.environ.get('DATABASE_USER', 'postgres'),
211211
'HOST': os.environ.get('DATABASE_HOST', 'localhost'),
212-
'PORT': os.environ.get('DATABASE_PORT', '5432'),
212+
'PORT': os.environ.get('DATABASE_PORT', '35432'),
213213
'PASSWORD': os.environ.get('DATABASE_PASSWORD', None),
214214
'CONN_MAX_AGE': os.environ.get('CONN_MAX_AGE', None),
215215
'TEST': {'SERIALIZE': False},
@@ -219,7 +219,7 @@
219219
'NAME': os.environ.get('DATABASE_NAME', 'share'),
220220
'USER': os.environ.get('DATABASE_USER', 'postgres'),
221221
'HOST': os.environ.get('DATABASE_HOST', 'localhost'),
222-
'PORT': os.environ.get('DATABASE_PORT', '5432'),
222+
'PORT': os.environ.get('DATABASE_PORT', '35432'),
223223
'PASSWORD': os.environ.get('DATABASE_PASSWORD', None),
224224
'CONN_MAX_AGE': os.environ.get('CONN_MAX_AGE', None),
225225
'TEST': {'MIRROR': 'default', 'SERIALIZE': False},
@@ -246,7 +246,7 @@
246246
},
247247
]
248248

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

251251
if DEBUG:
252252
AUTH_PASSWORD_VALIDATORS = []
@@ -317,7 +317,7 @@
317317
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
318318
)
319319

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

328328
# Celery Settings
329329

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

332332
CELERY_TIMEZONE = 'UTC'
333333
CELERYBEAT_SCHEDULE = {}
@@ -472,8 +472,8 @@
472472
PUBLIC_SENTRY_DSN = os.environ.get('PUBLIC_SENTRY_DSN')
473473

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

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

0 commit comments

Comments
 (0)