@@ -1,4 +1,4 | |||
|
1 |
version: ' |
|
|
1 | version: '3' | |
|
2 | 2 | |
|
3 | 3 | services: |
|
4 | 4 | web: |
@@ -6,15 +6,20 services: | |||
|
6 | 6 | build: . |
|
7 | 7 | restart: always |
|
8 | 8 | image: realtime |
|
9 | command: python manage.py runserver 0.0.0.0:8000 | |
|
9 | # command: python manage.py runserver 0.0.0.0:8000 | |
|
10 | # command: gunicorn realtime.wsgi:application --bind 0.0.0.0:8080 | |
|
11 | command: daphne -b 0.0.0.0 -p 8080 realtime.asgi:application | |
|
10 | 12 | env_file: .env |
|
11 | ports: | |
|
12 |
- "80 |
|
|
13 | # ports: | |
|
14 | # - "8081:8081" | |
|
15 | # expose: | |
|
16 | # - 8000 | |
|
13 | 17 | links: |
|
14 | 18 | - redis |
|
15 | 19 | - mongo |
|
16 | 20 | volumes: |
|
17 | 21 | - './:${APP_DIR}' |
|
22 | - './static:/static' | |
|
18 | 23 | depends_on: |
|
19 | 24 | - redis |
|
20 | 25 | - mongo |
@@ -37,9 +42,9 services: | |||
|
37 | 42 | |
|
38 | 43 | redis: |
|
39 | 44 | container_name: 'realtime_redis' |
|
40 |
image: 'redis: |
|
|
45 | image: 'redis:5.0-alpine' | |
|
41 | 46 | volumes: |
|
42 |
- 'redis |
|
|
47 | - '/data/dockers/realtime/redis:/data' | |
|
43 | 48 | |
|
44 | 49 | mongo: |
|
45 | 50 | container_name: 'realtime_mongo' |
@@ -48,8 +53,30 services: | |||
|
48 | 53 | ports: |
|
49 | 54 | - '127.0.0.1:27017:27017' |
|
50 | 55 | volumes: |
|
51 |
- 'mongo |
|
|
56 | - '/data/dockers/realtime/mongo:/data/db' | |
|
57 | ||
|
58 | #volumes: | |
|
59 | # redisdata: | |
|
60 | # mongodata: | |
|
61 | ||
|
62 | nginx: | |
|
63 | image: nginx:1.15-alpine | |
|
64 | volumes: | |
|
65 | - ./static:/static | |
|
66 | - ./nginx:/etc/nginx/conf.d | |
|
67 | - ./certbot/conf:/etc/letsencrypt | |
|
68 | - ./certbot/www:/var/www/certbot | |
|
69 | ports: | |
|
70 | - "8000:8000" | |
|
71 | - "443:443" | |
|
72 | depends_on: | |
|
73 | - web | |
|
74 | command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'" | |
|
75 | ||
|
76 | certbot: | |
|
77 | image: certbot/certbot:latest | |
|
78 | volumes: | |
|
79 | - ./certbot/conf:/etc/letsencrypt | |
|
80 | - ./certbot/www:/var/www/certbot | |
|
81 | entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'" | |
|
52 | 82 | |
|
53 | volumes: | |
|
54 | redisdata: | |
|
55 | mongodata: No newline at end of file |
@@ -90,7 +90,7 class PlotConsumer(WebsocketConsumer): | |||
|
90 | 90 | 'plot': plot |
|
91 | 91 | }) |
|
92 | 92 | if meta1: |
|
93 | if meta1['metadata']['type'] in ('pcolor',): | |
|
93 | if meta1['metadata']['type'] in ('pcolor', 'image'): | |
|
94 | 94 | datas = DB.plot_data.find( |
|
95 | 95 | {'plot': meta1['_id']}, |
|
96 | 96 | ['time', 'data'], |
@@ -1,9 +1,9 | |||
|
1 |
from django. |
|
|
1 | from django.urls import re_path | |
|
2 | 2 | |
|
3 | 3 | from . import consumers |
|
4 | 4 | |
|
5 | 5 | websocket_urlpatterns = [ |
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 | ] No newline at end of file | |
|
6 | re_path(r'^ws/main/$', consumers.MainConsumer.as_asgi()), | |
|
7 | re_path(r'^ws/realtime/(?P<code>[^/]+)/(?P<plot>[^/]+)/$', consumers.PlotConsumer.as_asgi()), | |
|
8 | re_path(r'^ws/database/(?P<code>[^/]+)/(?P<plot>[^/]+)/$', consumers.PlotConsumer.as_asgi()), | |
|
9 | ] |
@@ -39,7 +39,7 | |||
|
39 | 39 | </ul> |
|
40 | 40 | </div> |
|
41 | 41 | <iframe class="map d-none d-sm-block" |
|
42 | src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d3901.828012758223!2d-76.94633793139629!3d-12.055351713347235!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x7ea774b6fa66a3c6!2sInstituto+Geof%C3%ADsico+del+Per%C3%BA!5e0!3m2!1ses-419!2spe!4v1545658855595" | |
|
43 |
|
|
|
42 | src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d31226.562310315738!2d-76.89329626296218!3d-11.952312343404692!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x9105c3290814e129%3A0x61f92c3cfc90797b!2sRadio%20Observatorio%20de%20Jicamarca!5e0!3m2!1sen!2spe!4v1613758699300!5m2!1sen!2spe" | |
|
43 | width="100%" height="100%" frameborder="0" allowfullscreen="false">  | |
|
44 | 44 | </iframe> |
|
45 | </footer> No newline at end of file | |
|
45 | </footer> |
@@ -37,8 +37,9 | |||
|
37 | 37 | {% endif %} |
|
38 | 38 | {% endblock %} |
|
39 | 39 | {% block script %} |
|
40 |
<script> |
|
|
41 | var socket = new WebSocket('ws://' + window.location.host +'/ws/main/'); | |
|
40 | <script> | |
|
41 | var ws_scheme = window.location.protocol == "https:" ? "wss" : "ws"; | |
|
42 | var socket = new WebSocket(ws_scheme + '://' + window.location.host +'/ws/main/'); | |
|
42 | 43 | socket.onopen = function open() { |
|
43 | 44 | console.log('Main WebSockets connection created.'); |
|
44 | 45 | }; |
@@ -54,10 +54,11 | |||
|
54 | 54 | /* This conditional is used to know if we have to setup the data |
|
55 | 55 | or just update the last data*/ |
|
56 | 56 | $("#loader").css("display", "block"); |
|
57 | var ws_scheme = window.location.protocol == "https:" ? "wss" : "ws"; | |
|
57 | 58 | {% if realtime %} |
|
58 |
var socket = new WebSocket( |
|
|
59 | var socket = new WebSocket(ws_scheme + '://' + window.location.host + '/ws/realtime/{{code}}/{{plot}}/'); | |
|
59 | 60 | {% else %} |
|
60 |
var socket = new WebSocket( |
|
|
61 | var socket = new WebSocket(ws_scheme + '://' + window.location.host + '/ws/database/{{code}}/{{plot}}/'); | |
|
61 | 62 | {% endif %} |
|
62 | 63 | socket.onopen = function open() { |
|
63 | 64 | console.log('WebSockets connection created: ' + socket.url); |
@@ -102,4 +103,4 | |||
|
102 | 103 | plt.restyle(values); |
|
103 | 104 | }); |
|
104 | 105 | |
|
105 | </script> {% endblock script %} No newline at end of file | |
|
106 | </script> {% endblock script %} |
@@ -71,7 +71,7 class SPCSetupForm(forms.Form): | |||
|
71 | 71 | def main(request, tag=None): |
|
72 | 72 | |
|
73 | 73 | kwargs = {} |
|
74 |
date = request.GET.get('date', datetime. |
|
|
74 | date = request.GET.get('date', datetime.now().strftime('%d-%m-%Y')) | |
|
75 | 75 | exps = ExpDetail.objects(date=datetime.strptime(date, '%d-%m-%Y')) |
|
76 | 76 | |
|
77 | 77 | tmp = {} |
@@ -167,7 +167,7 def plot(request, code=None, plot=None): | |||
|
167 | 167 | realtime = False |
|
168 | 168 | date = request.GET.get('date', None) |
|
169 | 169 | if date is None: |
|
170 |
date = datetime. |
|
|
170 | date = datetime.now().strftime('%d-%m-%Y') | |
|
171 | 171 | realtime = True |
|
172 | 172 | exp = Experiment.objects.get(code=int(code)) |
|
173 | 173 | detail = ExpDetail.objects.get(experiment=exp, date=datetime.strptime(date, '%d-%m-%Y')) |
@@ -235,4 +235,4 def plot_overjro(request): | |||
|
235 | 235 | data = skynoise_plot(date.year, date.month, date.day) |
|
236 | 236 | response = HttpResponse(data.getvalue(), content_type='image/png') |
|
237 | 237 | |
|
238 | return response No newline at end of file | |
|
238 | return response |
@@ -70,7 +70,7 TEMPLATES = [ | |||
|
70 | 70 | }, |
|
71 | 71 | ] |
|
72 | 72 | |
|
73 | WSGI_APPLICATION = 'realtime.wsgi.application' | |
|
73 | # WSGI_APPLICATION = 'realtime.wsgi.application' | |
|
74 | 74 | |
|
75 | 75 | |
|
76 | 76 | # Database |
@@ -121,10 +121,13 USE_TZ = True | |||
|
121 | 121 | # https://docs.djangoproject.com/en/1.11/howto/static-files/ |
|
122 | 122 | |
|
123 | 123 | STATIC_URL = '/static/' |
|
124 | STATIC_ROOT = '/static/' | |
|
124 | 125 | |
|
125 | 126 | #======================== YONG ================================ |
|
126 | 127 | host = os.environ.get('HOST_REDIS', '127.0.0.1') |
|
127 | 128 | |
|
129 | ASGI_APPLICATION = 'realtime.asgi.application' | |
|
130 | ||
|
128 | 131 | CHANNEL_LAYERS = { |
|
129 | 132 | "default": { |
|
130 | 133 | 'BACKEND': 'channels_redis.core.RedisChannelLayer', |
@@ -134,4 +137,3 CHANNEL_LAYERS = { | |||
|
134 | 137 | }, |
|
135 | 138 | } |
|
136 | 139 | |
|
137 | ASGI_APPLICATION = "realtime.routing.application" |
@@ -10,4 +10,5 requests | |||
|
10 | 10 | simplejson |
|
11 | 11 | numpy |
|
12 | 12 | matplotlib |
|
13 | scipy No newline at end of file | |
|
13 | scipy | |
|
14 | gunicorn |
@@ -116,12 +116,16 | |||
|
116 | 116 | "name" : "JULIA Bistatic" |
|
117 | 117 | }, |
|
118 | 118 | { |
|
119 | "code" : 210, | |
|
120 | "name" : "High Altitude Drift" | |
|
121 | }, | |
|
122 | { | |
|
119 | 123 | "code" : 230, |
|
120 | 124 | "name" : "Valley Bottonside 150 Km" |
|
121 | 125 | }, |
|
122 | 126 | { |
|
123 | 127 | "code" : 240, |
|
124 |
"name" : "Simone |
|
|
128 | "name" : "Simone Ancon" | |
|
125 | 129 | }, |
|
126 | 130 | { |
|
127 | 131 | "code" : 241, |
@@ -137,6 +141,6 | |||
|
137 | 141 | }, |
|
138 | 142 | { |
|
139 | 143 | "code" : 244, |
|
140 |
"name" : "Simone |
|
|
144 | "name" : "Simone Chaclacayo" | |
|
141 | 145 | } |
|
142 | 146 | ] |
@@ -44,7 +44,7 def loaddata(): | |||
|
44 | 44 | |
|
45 | 45 | #============== funcion para modificar datos en la tabla ============== |
|
46 | 46 | def update(buffer): |
|
47 |
dt = datetime. |
|
|
47 | dt = datetime.fromtimestamp(buffer['time']) | |
|
48 | 48 | interval = buffer['metadata'].pop('interval') |
|
49 | 49 | tag = buffer['metadata'].pop('tag') if 'tag' in buffer['metadata'] else '' |
|
50 | 50 | exp = Experiment.objects.get(code=buffer['code']) |
@@ -129,7 +129,10 def main(): | |||
|
129 | 129 | |
|
130 | 130 | while True: |
|
131 | 131 | |
|
132 | buffer = receiver.recv_json() | |
|
132 | try: | |
|
133 | buffer = receiver.recv_json() | |
|
134 | except: | |
|
135 | continue | |
|
133 | 136 | if not isinstance(buffer, dict): |
|
134 | 137 | print('Invalid data received: {}').format(str(buffer)) |
|
135 | 138 | continue |
@@ -119,7 +119,7 class Time: | |||
|
119 | 119 | Converts datetime to number of seconds respect to 1970. |
|
120 | 120 | """ |
|
121 | 121 | |
|
122 | dtime = dt(self.year, self.month, self.dom) | |
|
122 | dtime = dt(self.year[0], self.month[0], self.dom[0]) | |
|
123 | 123 | return (dtime-dt(1970, 1, 1)).total_seconds() |
|
124 | 124 | |
|
125 | 125 | year = self.year |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now