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