@@ -1,17 +1,24 | |||
|
1 | 1 | FROM python:2.7.11 |
|
2 | 2 | |
|
3 | 3 | # set working directory |
|
4 | 4 | RUN mkdir /radarsys |
|
5 | 5 | WORKDIR /radarsys |
|
6 | 6 | |
|
7 | # Copy the main application. | |
|
8 | COPY . ./ | |
|
9 | ||
|
10 | 7 | # Install python dependences |
|
8 | ADD requirements.txt ./requirements.txt | |
|
11 | 9 | RUN pip install -v --timeout 120 -r requirements.txt --no-cache-dir |
|
12 | 10 | |
|
13 | EXPOSE 3000 | |
|
11 | # Copy the main application. | |
|
12 | COPY . ./ | |
|
13 | #RUN mkdir /radarsys media | |
|
14 | # RUN python manage.py makemigrations \ | |
|
15 | # && python manage.py migrate \ | |
|
16 | # && python manage.py loaddata apps/main/fixtures/main_initial_data.json \ | |
|
17 | # && python manage.py loaddata apps/rc/fixtures/rc_initial_data.json \ | |
|
18 | # && python manage.py loaddata apps/jars/fixtures/initial_filters_data.json \ | |
|
19 | RUN python manage.py collectstatic --noinput | |
|
20 | #EXPOSE 3000 | |
|
14 | 21 | # CMD ["python", "manage.py", "runserver", "0.0.0.0:3000"] |
|
15 | 22 | # Para produccion: |
|
16 | CMD ["gunicorn", "radarsys.wsgi:application", "--bind", "0.0.0.0:3000"] | |
|
23 | #CMD ["gunicorn", "radarsys.wsgi:application", "--bind", "0.0.0.0:3000"] | |
|
17 | 24 |
@@ -1,149 +1,156 | |||
|
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.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.sqlite3', |
|
89 | 89 | #'NAME': os.path.join(BASE_DIR, 'radarsys.sqlite'), |
|
90 | 90 | 'ENGINE': 'django.db.backends.mysql', |
|
91 | 91 | 'NAME': 'radarsys', |
|
92 | 92 | 'USER': 'developer', |
|
93 |
#'HOST': 'mysql |
|
|
93 | #'HOST': 'mysql', | |
|
94 | 94 | 'PASSWORD': 'idi2015', |
|
95 | 95 | 'OPTIONS': { |
|
96 | 96 | 'init_command': "SET sql_mode='STRICT_TRANS_TABLES'", |
|
97 | 97 | } |
|
98 | 98 | } |
|
99 | 99 | } |
|
100 | 100 | |
|
101 | 101 | |
|
102 | 102 | # Internationalization |
|
103 | 103 | # https://docs.djangoproject.com/en/1.8/topics/i18n/ |
|
104 | 104 | |
|
105 | 105 | LANGUAGE_CODE = 'en-us' |
|
106 | 106 | |
|
107 | 107 | TIME_ZONE = None |
|
108 | 108 | |
|
109 | 109 | USE_I18N = True |
|
110 | 110 | |
|
111 | 111 | USE_L10N = True |
|
112 | 112 | |
|
113 | 113 | USE_TZ = False |
|
114 | 114 | |
|
115 | 115 | # Static files (CSS, JavaScript, Images) |
|
116 | 116 | # https://docs.djangoproject.com/en/1.8/howto/static-files/ |
|
117 | 117 | |
|
118 | 118 | MEDIA_ROOT = 'media'#os.path.join(BASE_DIR, 'media') |
|
119 | 119 | MEDIA_URL = '/site_media/' |
|
120 | 120 | |
|
121 | 121 | STATIC_URL = '/static/' |
|
122 | 122 | #STATIC_ROOT = '/var/www/html/static/' |
|
123 | 123 | STATIC_ROOT = os.path.join(MEDIA_ROOT, 'static') |
|
124 | 124 | |
|
125 | 125 | #STATICFILES_DIRS = ( |
|
126 | 126 | # os.path.join(BASE_DIR, 'apps', 'main', 'static'), |
|
127 | 127 | # |
|
128 | 128 | #) |
|
129 | 129 | |
|
130 | 130 | |
|
131 | 131 | STATICFILES_FINDERS = ( |
|
132 | 132 | 'django.contrib.staticfiles.finders.FileSystemFinder', |
|
133 | 133 | 'django.contrib.staticfiles.finders.AppDirectoriesFinder', |
|
134 | 134 | ) |
|
135 | 135 | |
|
136 | 136 | FIXTURE_DIRS = ( |
|
137 | 137 | os.path.join(BASE_DIR, 'apps', 'rc', 'fixtures'), |
|
138 | 138 | os.path.join(BASE_DIR, 'apps', 'main', 'fixtures'), |
|
139 | 139 | os.path.join(BASE_DIR, 'apps', 'jars', 'fixtures'), |
|
140 | 140 | ) |
|
141 | 141 | |
|
142 | 142 | # Celery stuff |
|
143 | ||
|
144 | BROKER_URL = 'redis://localhost:6379' | |
|
145 | CELERY_RESULT_BACKEND = 'redis://localhost:6379' | |
|
143 | REDIS_HOST = 'redis' | |
|
144 | BROKER_TRANSPORT = 'redis' | |
|
145 | #--Development--# (Para Pruebas Locales) | |
|
146 | BROKER_URL = 'redis://127.0.0.1:6300' | |
|
147 | CELERY_RESULT_BACKEND = 'redis://localhost:6300' | |
|
148 | #---------------# | |
|
149 | #--Production---# (Para Docker) | |
|
150 | #CELERY_BROKER_TRANSPORT = BROKER_URL = 'redis://%s:6379/0' % REDIS_HOST | |
|
151 | #CELERY_RESULT_BACKEND = 'redis://%s:6379/0' % REDIS_HOST | |
|
152 | #---------------# | |
|
146 | 153 | CELERY_ACCEPT_CONTENT = ['application/json'] |
|
147 | 154 | CELERY_TASK_SERIALIZER = 'json' |
|
148 | 155 | CELERY_RESULT_SERIALIZER = 'json' |
|
149 | 156 | CELERY_TIMEZONE = 'America/Lima' |
@@ -1,33 +1,33 | |||
|
1 | 1 | """radarsys URL Configuration |
|
2 | 2 | |
|
3 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: |
|
4 | 4 | https://docs.djangoproject.com/en/1.8/topics/http/urls/ |
|
5 | 5 | Examples: |
|
6 | 6 | Function views |
|
7 | 7 | 1. Add an import: from my_app import views |
|
8 | 8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') |
|
9 | 9 | Class-based views |
|
10 | 10 | 1. Add an import: from other_app.views import Home |
|
11 | 11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') |
|
12 | 12 | Including another URLconf |
|
13 | 13 | 1. Add an import: from blog import urls as blog_urls |
|
14 | 14 | 2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls)) |
|
15 | 15 | """ |
|
16 | 16 | from django.conf.urls import include, url |
|
17 | 17 | from django.contrib import admin |
|
18 | from django.contrib.staticfiles.urls import staticfiles_urlpatterns | |
|
18 | #from django.contrib.staticfiles.urls import staticfiles_urlpatterns | |
|
19 | 19 | |
|
20 | 20 | urlpatterns = [ |
|
21 | 21 | url(r'^admin/', include(admin.site.urls)), |
|
22 | 22 | url(r'^accounts/', include('apps.accounts.urls')), |
|
23 | 23 | url(r'^', include('apps.main.urls')), |
|
24 | 24 | url(r'^rc/', include('apps.rc.urls')), |
|
25 | 25 | url(r'^dds/', include('apps.dds.urls')), |
|
26 | 26 | url(r'^cgs/', include('apps.cgs.urls')), |
|
27 | 27 | url(r'^jars/', include('apps.jars.urls')), |
|
28 | 28 | url(r'^usrp/', include('apps.usrp.urls')), |
|
29 | 29 | url(r'^abs/', include('apps.abs.urls')), |
|
30 | 30 | url(r'^misc/', include('apps.misc.urls')), |
|
31 | 31 | ] |
|
32 | 32 | |
|
33 | urlpatterns += staticfiles_urlpatterns() | |
|
33 | #urlpatterns += staticfiles_urlpatterns() |
@@ -1,50 +1,53 | |||
|
1 | 1 | ### Docker de la base de datos ### |
|
2 | 2 | # 'NAME': 'radarsys', |
|
3 | 3 | # 'USER': 'developer', |
|
4 | 4 | # 'PASSWORD': 'idi2015', |
|
5 | 5 | |
|
6 | 6 | #Preparar Base de Datos para la aplicacion: |
|
7 | 7 | ## Crear imagen "mysql:5.6" |
|
8 | 8 | docker create -v /var/lib/mysql --name mysql-radarsys-data mysql:5.6 /bin/true |
|
9 | 9 | ## Ejecutar Container "mysql-radarsys-server" |
|
10 | 10 | docker run --name mysql-radarsys-server -d -e MYSQL_ROOT_PASSWORD=r00tJRO -e MYSQL_DATABASE=radarsys \ |
|
11 | 11 | -e MYSQL_USER=developer -e MYSQL_PASSWORD=idi2015 --volumes-from mysql-radarsys-data mysql:5.6 |
|
12 | 12 | |
|
13 | 13 | #Aplicacion Sistema Integrado de Radar |
|
14 | 14 | ## Debe crearse *Dockerfile* |
|
15 | 15 | ## Crear la imagen |
|
16 | 16 | docker build -t radarsys:v01 . |
|
17 | 17 | # Ejecutar Container |
|
18 | 18 | docker run -d --name radarsys01 --link mysql-radarsys-server -p 3000:3000 \ |
|
19 | 19 | -v /home/ubuntu/docker_shared/radarsys/media:/radarsys/media \ |
|
20 | 20 | --add-host smtp_server:172.17.0.1 radarsys:v01 |
|
21 | 21 | |
|
22 | 22 | ## Dentro del Container: se debe realizar las siguiente modificaciones |
|
23 | 23 | ### Para ingresar al container: |
|
24 | 24 | docker exec -i -t radarsys01 /bin/bash |
|
25 | 25 | ### Es necesario ejecutar: |
|
26 | 26 | apt-get update |
|
27 | 27 | apt-get install nano |
|
28 | 28 | ### Modificar radarsys.setting.py, HOST debe estar habilitado |
|
29 | 29 | 'HOST': 'mysql-sysinv-server', |
|
30 | 30 | ### Asegurarse que: |
|
31 | 31 | MEDIA_ROOT: 'media' |
|
32 | 32 | ### En el script abs/utils/Graphics_OverJro.py, matplotlib Agg debe estar habilitado |
|
33 | 33 | matplotlib.use("Agg") |
|
34 | ### En el script radarsys/urls.py comentar para que nginx sirva "static": | |
|
35 | #from django.contrib.staticfiles.urls import staticfiles_urlpatterns | |
|
36 | #urlpatterns += staticfiles_urlpatterns() | |
|
34 | 37 | |
|
35 | 38 | ### Ejecutar los siguientes comandos (solo si ya se creo mysql-radarsys-server): |
|
36 | 39 | python manage.py makemigrations \ |
|
37 | 40 | && python manage.py migrate \ |
|
38 | 41 | && python manage.py loaddata apps/main/fixtures/main_initial_data.json \ |
|
39 | 42 | && python manage.py loaddata apps/rc/fixtures/rc_initial_data.json \ |
|
40 | 43 | && python manage.py loaddata apps/jars/fixtures/initial_filters_data.json \ |
|
41 | 44 | && python manage.py collectstatic |
|
42 | 45 | |
|
43 | 46 | ### Por ultimo reiniciar el docker |
|
44 | 47 | docker stop radarsys01 |
|
45 | 48 | docker start radarsys01 |
|
46 | 49 | |
|
47 | 50 | |
|
48 | 51 | #### Archivos Compartidos: |
|
49 | 52 | # /home/ubuntu/docker_shared/radarsys/media |
|
50 | 53 | # (debe coincidir con la carpeta que se ingresar en "docker run") |
General Comments 0
You need to be logged in to leave comments.
Login now