##// END OF EJS Templates
Update docker configurations
jespinoza -
r300:c6aee8aed3f9
parent child
Show More
@@ -1,8 +1,9
1 HOST_REDIS=radarsys-redis
1 REDIS_HOST=radarsys-redis
2 REDIS_PORT=6379
2 POSTGRES_DB_NAME=radarsys
3 POSTGRES_DB_NAME=radarsys
3 POSTGRES_PORT_5432_TCP_ADDR=radarsys-postgres
4 POSTGRES_PORT_5432_TCP_ADDR=radarsys-postgres
4 POSTGRES_PORT_5432_TCP_PORT=5432
5 POSTGRES_PORT_5432_TCP_PORT=5432
5 POSTGRES_USER=docker
6 POSTGRES_USER=docker
6 POSTGRES_PASSWORD=docker
7 POSTGRES_PASSWORD=docker
7 PGDATA=/var/lib/postgresql/data
8 PGDATA=/var/lib/postgresql/data
8 LC_ALL=C.UTF-8 No newline at end of file
9 LC_ALL=C.UTF-8
@@ -1,23 +1,20
1 FROM python:2.7-slim
1 FROM python:2.7-slim
2
2
3 # set working directory
3 # set working directory
4 RUN mkdir /radarsys
4 RUN mkdir /radarsys
5 WORKDIR /radarsys
5 WORKDIR /radarsys
6
6
7 # Install python dependences
7 # Install python dependences
8 ADD requirements.txt ./requirements.txt
8 ADD requirements.txt ./requirements.txt
9 RUN apt-get clean && apt-get update && apt-get install -y --no-install-recommends \
9 RUN apt-get clean && apt-get update && apt-get install -y --no-install-recommends \
10 gcc \
10 gcc \
11 g++ \
11 g++ \
12 && pip install -v --timeout 120 -r requirements.txt --no-cache-dir --index-url http://10.10.20.128:8010/simple --trusted-host 10.10.20.128 \
12 && pip install -v --timeout 120 -r requirements.txt --no-cache-dir --index-url http://10.10.20.128:8010/simple --trusted-host 10.10.20.128 \
13 && apt-get purge -y --auto-remove gcc g++\
13 && apt-get purge -y --auto-remove gcc g++\
14 && rm -rf /var/lib/apt/lists/*
14 && rm -rf /var/lib/apt/lists/*
15
15
16 # Copy the main application.
16 # Copy the main application.
17 COPY . ./
17 COPY . ./
18
18
19 EXPOSE 8000
19 EXPOSE 8000
20
20
21 RUN python manage.py collectstatic --noinput
22
23
@@ -1,67 +1,63
1 version: '2'
1 version: '2'
2 services:
2 services:
3 # Django app
3 # Django app
4 web:
4 web:
5 container_name: 'radarsys'
5 container_name: 'radarsys'
6 build: .
6 build: .
7 restart: always
7 restart: always
8 image: radarsys
8 image: radarsys
9 command: gunicorn radarsys.wsgi:application -w 2 -b :8000
9 command: gunicorn radarsys.wsgi:application -w 2 -b :8000
10 env_file: .env
10 env_file: .env
11
11
12 links:
12 links:
13 - redis
13 - redis
14 - postgres
14 - postgres
15 volumes:
15 volumes:
16 - './:/radarsys'
16 - './:/radarsys'
17 - '/data/dockers/radarsys/static:/radarsys/static'
17 - '/data/dockers/radarsys/static:/radarsys/static'
18 depends_on:
18 depends_on:
19 - redis
19 - redis
20 - postgres
20 - postgres
21
21
22 redis:
22 redis:
23 container_name: 'radarsys-redis'
23 container_name: 'radarsys-redis'
24 image: 'redis:3.2-alpine'
24 image: 'redis:3.2-alpine'
25 ports:
26 - '127.0.0.1:6300:6379'
27 volumes:
25 volumes:
28 - '/data/dockers/radarsys/redis:/data'
26 - '/data/dockers/radarsys/redis:/data'
29
27
30 celery_worker:
28 celery_worker:
31 container_name: 'radarsys-celery'
29 container_name: 'radarsys-celery'
32 image: radarsys
30 image: radarsys
33 env_file: .env
31 env_file: .env
34 command: celery -A radarsys worker -l info
32 command: celery -A radarsys worker -l info
35 volumes_from:
33 volumes_from:
36 - web
34 - web
37 depends_on:
35 depends_on:
38 - web
36 - web
39
37
40 # PostgreSQL
38 # PostgreSQL
41 postgres:
39 postgres:
42 container_name: 'radarsys-postgres'
40 container_name: 'radarsys-postgres'
43 build: ./postgres/
41 build: ./postgres/
44 ports:
45 - 5432:5432
46 volumes:
42 volumes:
47 - ./postgres/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
43 - ./postgres/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
48 - pgdata:/var/lib/postgresql/data
44 - pgdata:/var/lib/postgresql/data
49 env_file: .env
45 env_file: .env
50
46
51 # Web Server
47 # Web Server
52 nginx:
48 nginx:
53 container_name: 'radarsys-nginx'
49 container_name: 'radarsys-nginx'
54 restart: always
50 restart: always
55 build: ./nginx/
51 build: ./nginx/
56 ports:
52 ports:
57 - '8030:8030'
53 - '8030:8030'
58 volumes_from:
54 volumes_from:
59 - web
55 - web
60 links:
56 links:
61 - web:web
57 - web:web
62 depends_on:
58 depends_on:
63 - web
59 - web
64
60
65 volumes:
61 volumes:
66 pgdata:
62 pgdata:
67 driver: local No newline at end of file
63 driver: local
@@ -1,3 +1,5
1 #!/bin/env bash
1 #!/bin/env bash
2 psql -U postgres -c "CREATE USER $POSTGRES_USER PASSWORD '$POSTGRES_PASSWORD'"
2 echo "Creating database..."
3 psql -U postgres -c "CREATE DATABASE $POSTGRES_DB_NAME OWNER $POSTGRES_USER" No newline at end of file
3 psql -U postgres -c "CREATE USER $POSTGRES_USER WITH PASSWORD '$POSTGRES_PASSWORD'; CREATE ROLE "
4 psql -U postgres -c "CREATE DATABASE $POSTGRES_DB_NAME; CREATE DATABASE "
5 psql -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE $POSTGRES_DB_NAME to $POSTGRES_USER; GRANT "
@@ -1,135 +1,136
1 """
1 """
2 Django settings for radarsys project.
2 Django settings for radarsys project.
3
3
4 Generated by 'django-admin startproject' using Django 1.8.6.
4 Generated by 'django-admin startproject' using Django 1.8.6.
5
5
6 For more information on this file, see
6 For more information on this file, see
7 https://docs.djangoproject.com/en/1.8/topics/settings/
7 https://docs.djangoproject.com/en/1.8/topics/settings/
8
8
9 For the full list of settings and their values, see
9 For the full list of settings and their values, see
10 https://docs.djangoproject.com/en/1.8/ref/settings/
10 https://docs.djangoproject.com/en/1.8/ref/settings/
11 """
11 """
12
12
13 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
13 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
14 import os
14 import os
15
15
16 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
16 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17
17
18 # Quick-start development settings - unsuitable for production
18 # Quick-start development settings - unsuitable for production
19 # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
19 # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
20
20
21 # SECURITY WARNING: keep the secret key used in production secret!
21 # SECURITY WARNING: keep the secret key used in production secret!
22 SECRET_KEY = 'xshb$k5fc-+j16)cvyffj&9u__0q3$l!hieh#+tbzqg)*f^km0'
22 SECRET_KEY = 'xshb$k5fc-+j16)cvyffj&9u__0q3$l!hieh#+tbzqg)*f^km0'
23
23
24 # SECURITY WARNING: don't run with debug turned on in production!
24 # SECURITY WARNING: don't run with debug turned on in production!
25 DEBUG = True
25 DEBUG = True
26
26
27 ALLOWED_HOSTS = ['*']
27 ALLOWED_HOSTS = ['*']
28
28
29 # Application definition
29 # Application definition
30
30
31 INSTALLED_APPS = (
31 INSTALLED_APPS = (
32 'django.contrib.admin',
32 'django.contrib.admin',
33 'django.contrib.auth',
33 'django.contrib.auth',
34 'django.contrib.contenttypes',
34 'django.contrib.contenttypes',
35 'django.contrib.sessions',
35 'django.contrib.sessions',
36 'django.contrib.messages',
36 'django.contrib.messages',
37 'django.contrib.staticfiles',
37 'django.contrib.staticfiles',
38 'bootstrap3',
38 'bootstrap3',
39 'polymorphic',
39 'polymorphic',
40 'apps.accounts',
40 'apps.accounts',
41 'apps.main',
41 'apps.main',
42 'apps.misc',
42 'apps.misc',
43 'apps.rc',
43 'apps.rc',
44 'apps.dds',
44 'apps.dds',
45 'apps.jars',
45 'apps.jars',
46 'apps.usrp',
46 'apps.usrp',
47 'apps.abs',
47 'apps.abs',
48 'apps.cgs',
48 'apps.cgs',
49 )
49 )
50
50
51 MIDDLEWARE_CLASSES = (
51 MIDDLEWARE_CLASSES = (
52 'django.contrib.sessions.middleware.SessionMiddleware',
52 'django.contrib.sessions.middleware.SessionMiddleware',
53 'django.middleware.common.CommonMiddleware',
53 'django.middleware.common.CommonMiddleware',
54 'django.middleware.csrf.CsrfViewMiddleware',
54 'django.middleware.csrf.CsrfViewMiddleware',
55 'django.contrib.auth.middleware.AuthenticationMiddleware',
55 'django.contrib.auth.middleware.AuthenticationMiddleware',
56 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
56 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
57 'django.contrib.messages.middleware.MessageMiddleware',
57 'django.contrib.messages.middleware.MessageMiddleware',
58 'django.middleware.clickjacking.XFrameOptionsMiddleware',
58 'django.middleware.clickjacking.XFrameOptionsMiddleware',
59 'django.middleware.security.SecurityMiddleware',
59 'django.middleware.security.SecurityMiddleware',
60 )
60 )
61
61
62 ROOT_URLCONF = 'radarsys.urls'
62 ROOT_URLCONF = 'radarsys.urls'
63
63
64 TEMPLATES = [
64 TEMPLATES = [
65 {
65 {
66 'BACKEND': 'django.template.backends.django.DjangoTemplates',
66 'BACKEND': 'django.template.backends.django.DjangoTemplates',
67 'DIRS': [os.path.join(BASE_DIR, "templates").replace('\\', '/'),],
67 'DIRS': [os.path.join(BASE_DIR, "templates").replace('\\', '/'),],
68 'APP_DIRS': True,
68 'APP_DIRS': True,
69 'OPTIONS': {
69 'OPTIONS': {
70 'context_processors': [
70 'context_processors': [
71 'django.template.context_processors.debug',
71 'django.template.context_processors.debug',
72 'django.template.context_processors.request',
72 'django.template.context_processors.request',
73 'django.contrib.auth.context_processors.auth',
73 'django.contrib.auth.context_processors.auth',
74 'django.contrib.messages.context_processors.messages',
74 'django.contrib.messages.context_processors.messages',
75 ],
75 ],
76 },
76 },
77 },
77 },
78 ]
78 ]
79
79
80 WSGI_APPLICATION = 'radarsys.wsgi.application'
80 WSGI_APPLICATION = 'radarsys.wsgi.application'
81
81
82
82
83 # Database
83 # Database
84 # https://docs.djangoproject.com/en/1.8/ref/settings/#databases
84 # https://docs.djangoproject.com/en/1.8/ref/settings/#databases
85
85
86 DATABASES = {
86 DATABASES = {
87 'default': {
87 'default': {
88 'ENGINE': 'django.db.backends.postgresql_psycopg2',
88 'ENGINE': 'django.db.backends.postgresql_psycopg2',
89 'NAME': os.environ.get('POSTGRES_DB_NAME', 'radarsys'),
89 'NAME': os.environ.get('POSTGRES_DB_NAME', 'radarsys'),
90 'USER': os.environ.get('POSTGRES_USER', 'docker'),
90 'USER': os.environ.get('POSTGRES_USER', 'docker'),
91 'PASSWORD': os.environ.get('POSTGRES_PASSWORD', 'docker'),
91 'PASSWORD': os.environ.get('POSTGRES_PASSWORD', 'docker'),
92 'HOST': os.environ.get('POSTGRES_PORT_5432_TCP_ADDR', 'postgres'),
92 'HOST': os.environ.get('POSTGRES_PORT_5432_TCP_ADDR', 'postgres'),
93 'PORT': os.environ.get('POSTGRES_PORT_5432_TCP_PORT', ''),
93 'PORT': os.environ.get('POSTGRES_PORT_5432_TCP_PORT', ''),
94 }
94 }
95 }
95 }
96
96
97 # Internationalization
97 # Internationalization
98 # https://docs.djangoproject.com/en/1.8/topics/i18n/
98 # https://docs.djangoproject.com/en/1.8/topics/i18n/
99
99
100 LANGUAGE_CODE = 'en-us'
100 LANGUAGE_CODE = 'en-us'
101
101
102 TIME_ZONE = None
102 TIME_ZONE = None
103
103
104 USE_I18N = True
104 USE_I18N = True
105
105
106 USE_L10N = True
106 USE_L10N = True
107
107
108 USE_TZ = False
108 USE_TZ = False
109
109
110 # Static files (CSS, JavaScript, Images)
110 # Static files (CSS, JavaScript, Images)
111 # https://docs.djangoproject.com/en/1.8/howto/static-files/
111 # https://docs.djangoproject.com/en/1.8/howto/static-files/
112
112
113 MEDIA_URL = '/media/'
113 MEDIA_URL = '/media/'
114 MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
114 MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
115
115
116 STATIC_URL = '/static/'
116 STATIC_URL = '/static/'
117 STATIC_ROOT = os.path.join(BASE_DIR, 'static')
117 STATIC_ROOT = os.path.join(BASE_DIR, 'static')
118
118
119 STATICFILES_FINDERS = (
119 STATICFILES_FINDERS = (
120 'django.contrib.staticfiles.finders.FileSystemFinder',
120 'django.contrib.staticfiles.finders.FileSystemFinder',
121 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
121 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
122 )
122 )
123
123
124 # Celery stuff
124 # Celery stuff
125 REDIS_HOST = os.environ.get('HOST_REDIS', '127.0.0.1')
125 REDIS_HOST = os.environ.get('REDIS_HOST', '127.0.0.1')
126 REDIS_PORT = os.environ.get('REDIS_PORT', 6379)
126
127
127 BROKER_TRANSPORT = 'redis'
128 BROKER_TRANSPORT = 'redis'
128 BROKER_URL = 'redis://%s:6379/0' % REDIS_HOST
129 BROKER_URL = 'redis://{}:{}/0'.format(REDIS_HOST, REDIS_PORT)
129
130
130 CELERY_RESULT_BACKEND = 'redis://%s:6379/0' % REDIS_HOST
131 CELERY_RESULT_BACKEND = 'redis://{}:{}/0'.format(REDIS_HOST, REDIS_PORT)
131 CELERY_BROKER_TRANSPORT = BROKER_URL
132 CELERY_BROKER_TRANSPORT = BROKER_URL
132 CELERY_ACCEPT_CONTENT = ['application/json']
133 CELERY_ACCEPT_CONTENT = ['application/json']
133 CELERY_TASK_SERIALIZER = 'json'
134 CELERY_TASK_SERIALIZER = 'json'
134 CELERY_RESULT_SERIALIZER = 'json'
135 CELERY_RESULT_SERIALIZER = 'json'
135 CELERY_TIMEZONE = 'America/Lima'
136 CELERY_TIMEZONE = 'America/Lima'
General Comments 0
You need to be logged in to leave comments. Login now