diff --git a/deployment/nginx/ddb b/deployment/nginx/ddb new file mode 100644 index 0000000..d51c31f --- /dev/null +++ b/deployment/nginx/ddb @@ -0,0 +1,37 @@ +server { + # listen on port 80 (http) + listen 80; + server_name _; + location / { + # redirect any requests to the same URL but on https + return 301 https://$host$request_uri; + } +} +server { + # listen on port 443 (https) + listen 443 ssl; + server_name _; + + # location of the self-signed SSL certificate + ssl_certificate /home/ubuntu/ddb/certs/cert.pem; + ssl_certificate_key /home/ubuntu/ddb/certs/key.pem; + + # write access and error logs to /var/log + access_log /var/log/ddb_access.log; + error_log /var/log/ddb_error.log; + + location / { + # forward application requests to the gunicorn server + proxy_pass http://localhost:8000; + proxy_redirect off; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + + location /static { + # handle static files directly, without forwarding to the application + alias /home/ubuntu/ddb/app/static; + expires 30d; + } +} \ No newline at end of file diff --git a/deployment/supervisor/celerybeatd.conf b/deployment/supervisor/celerybeatd.conf new file mode 100644 index 0000000..3ae0dcc --- /dev/null +++ b/deployment/supervisor/celerybeatd.conf @@ -0,0 +1,15 @@ +[program:celerybeat] +environment=OGN_CONFIG_MODULE='config/default.py' +command=/var/www/html/ogn-python/venv/bin/celery -A ogn_python.collect beat -l info +directory=/var/www/html/ogn-python + +user=www-data +numprocs=1 +stdout_logfile=/var/log/celery/beat.log +stderr_logfile=/var/log/celery/beat.log +autostart=true +autorestart=true +startsecs=10 + +; Causes supervisor to send the termination signal (SIGTERM) to the whole process group. +stopasgroup=true \ No newline at end of file diff --git a/deployment/supervisor/celeryd.conf b/deployment/supervisor/celeryd.conf new file mode 100644 index 0000000..a01afed --- /dev/null +++ b/deployment/supervisor/celeryd.conf @@ -0,0 +1,19 @@ +[program:celery] +environment=OGN_CONFIG_MODULE='config/default.py' +command=/var/www/html/ogn-python/venv/bin/celery -A ogn_python.collect worker -l info +directory=/var/www/html/ogn-python + +user=www-data +numprocs=1 +stdout_logfile=/var/log/celery/worker.log +stderr_logfile=/var/log/celery/worker.log +autostart=true +autorestart=true +startsecs=10 + +; Need to wait for currently executing tasks to finish at shutdown. +; Increase this if you have very long running tasks. +stopwaitsecs = 600 + +; Causes supervisor to send the termination signal (SIGTERM) to the whole process group. +stopasgroup=true \ No newline at end of file diff --git a/deployment/supervisor/flower.conf b/deployment/supervisor/flower.conf new file mode 100644 index 0000000..bf665ff --- /dev/null +++ b/deployment/supervisor/flower.conf @@ -0,0 +1,11 @@ +[program:flower] +environment=OGN_CONFIG_MODULE='config/default.py' +command=/var/www/html/ogn-python/venv/bin/celery flower -A ogn_python.celery --port=1234 --url_prefix=flower --loglevel=debug +directory=/var/www/html/ogn-python + +user=www-data +stderr_logfile=/var/log/celery/flower_err.log +stdout_logfile=/var/log/celery/flower_out.log +autostart=true +autorestart=true +startsecs=10 \ No newline at end of file diff --git a/deployment/supervisor/ogn-feeder.conf b/deployment/supervisor/ogn-feeder.conf new file mode 100644 index 0000000..0ce5107 --- /dev/null +++ b/deployment/supervisor/ogn-feeder.conf @@ -0,0 +1,7 @@ +[program:ogn-feeder] +environment=OGN_CONFIG_MODULE='config/default.py' +command=/var/www/html/ogn-python/venv/bin/python -m flask gateway run +user=www-data +directory=/var/www/html/ogn-python/ogn_python +autostart=true +autorestart=true \ No newline at end of file diff --git a/deployment/supervisor/redmon.conf b/deployment/supervisor/redmon.conf new file mode 100644 index 0000000..1aa465c --- /dev/null +++ b/deployment/supervisor/redmon.conf @@ -0,0 +1,6 @@ +[program:redmon] +command=/usr/local/bin/redmon --base-path /redmon/ +user=root +directory=/var/www/html +autostart=true +autorestart=true \ No newline at end of file