Feat(WIP): Producction Mode
This commit is contained in:
parent
049b1f697a
commit
b1f8e15530
4
production/entrypoint.sh
Normal file
4
production/entrypoint.sh
Normal file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
19
production/nginx.conf
Normal file
19
production/nginx.conf
Normal file
@ -0,0 +1,19 @@
|
||||
server {
|
||||
server_name ${SERVER_NAME};
|
||||
listen ${NGINX_PORT};
|
||||
client_max_body_size 50M;
|
||||
|
||||
sendfile on;
|
||||
send_timeout 300s;
|
||||
|
||||
location / {
|
||||
proxy_pass http://tryton:8000/; # "trytond" is the service name of another Docker container on port 8000
|
||||
proxy_read_timeout 300;
|
||||
proxy_connect_timeout 300;
|
||||
proxy_send_timeout 300;
|
||||
proxy_set_header Host ${INIT_VAR_NAME}host;
|
||||
proxy_set_header X-Real-IP ${INIT_VAR_NAME}remote_addr;
|
||||
proxy_set_header X-Forwarded-For ${INIT_VAR_NAME}proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host ${INIT_VAR_NAME}server_name;
|
||||
}
|
||||
}
|
21
production/start.sh
Normal file
21
production/start.sh
Normal file
@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -s /etc/trytond_populate.conf ]; then
|
||||
if [ "$DEVELOP" == "True" ]; then
|
||||
trytond -c /etc/trytond.conf --dev --logconf /etc/trytond_logging.conf
|
||||
else
|
||||
uwsgi --ini /etc/uwsgi.conf
|
||||
fi
|
||||
else
|
||||
sleep $SLEEP_TRYTOND_ADMIN &&
|
||||
echo $TRYTONADMINPASS > $TRYTONPASSFILE
|
||||
if [ "$Provider" == "Kalenis" ]; then
|
||||
trytond-admin -c /etc/trytond.conf -d $POSTGRES_DB --all --email $EMAIL -u user_view -vv
|
||||
else
|
||||
trytond-admin -c /etc/trytond.conf -d $POSTGRES_DB --all --email $EMAIL -vv
|
||||
fi
|
||||
echo "1" > /etc/trytond_populate.conf &&
|
||||
/bin/bash /opt/start.sh
|
||||
fi
|
||||
|
||||
|
7
production/trytond.conf
Normal file
7
production/trytond.conf
Normal file
@ -0,0 +1,7 @@
|
||||
[web]
|
||||
listen=0.0.0.0:8000
|
||||
root=/var/lib/trytond/www
|
||||
|
||||
[database]
|
||||
list=False
|
||||
path=/mnt/attachment
|
26
production/trytond_cron_logging.conf
Normal file
26
production/trytond_cron_logging.conf
Normal file
@ -0,0 +1,26 @@
|
||||
[formatters]
|
||||
keys=simple
|
||||
|
||||
[handlers]
|
||||
keys=rotate,console
|
||||
|
||||
[loggers]
|
||||
keys=root
|
||||
|
||||
[formatter_simple]
|
||||
format=[%(asctime)s] %(levelname)s:%(name)s:%(message)s
|
||||
datefmt=%a %b %d %H:%M:%S %Y
|
||||
|
||||
[handler_rotate]
|
||||
class=handlers.TimedRotatingFileHandler
|
||||
args=('/var/log/trytond/trytond_cron.log', 'D', 1, 30)
|
||||
formatter=simple
|
||||
|
||||
[handler_console]
|
||||
class=StreamHandler
|
||||
formatter=simple
|
||||
args=(sys.stdout,)
|
||||
|
||||
[logger_root]
|
||||
level=INFO
|
||||
handlers=rotate,console
|
26
production/trytond_logging.conf
Normal file
26
production/trytond_logging.conf
Normal file
@ -0,0 +1,26 @@
|
||||
[formatters]
|
||||
keys=simple
|
||||
|
||||
[handlers]
|
||||
keys=rotate,console
|
||||
|
||||
[loggers]
|
||||
keys=root
|
||||
|
||||
[formatter_simple]
|
||||
format=[%(asctime)s] %(levelname)s:%(name)s:%(message)s
|
||||
datefmt=%a %b %d %H:%M:%S %Y
|
||||
|
||||
[handler_rotate]
|
||||
class=handlers.TimedRotatingFileHandler
|
||||
args=('/var/log/trytond/trytond.log', 'D', 1, 30)
|
||||
formatter=simple
|
||||
|
||||
[handler_console]
|
||||
class=StreamHandler
|
||||
formatter=simple
|
||||
args=(sys.stdout,)
|
||||
|
||||
[logger_root]
|
||||
level=INFO
|
||||
handlers=rotate,console
|
26
production/trytond_worker_logging.conf
Normal file
26
production/trytond_worker_logging.conf
Normal file
@ -0,0 +1,26 @@
|
||||
[formatters]
|
||||
keys=simple
|
||||
|
||||
[handlers]
|
||||
keys=rotate,console
|
||||
|
||||
[loggers]
|
||||
keys=root
|
||||
|
||||
[formatter_simple]
|
||||
format=[%(asctime)s] %(levelname)s:%(name)s:%(message)s
|
||||
datefmt=%a %b %d %H:%M:%S %Y
|
||||
|
||||
[handler_rotate]
|
||||
class=handlers.TimedRotatingFileHandler
|
||||
args=('/var/log/trytond/trytond_worker.log', 'D', 1, 30)
|
||||
formatter=simple
|
||||
|
||||
[handler_console]
|
||||
class=StreamHandler
|
||||
formatter=simple
|
||||
args=(sys.stdout,)
|
||||
|
||||
[logger_root]
|
||||
level=INFO
|
||||
handlers=rotate,console
|
9
production/uwsgi.conf
Normal file
9
production/uwsgi.conf
Normal file
@ -0,0 +1,9 @@
|
||||
[uwsgi]
|
||||
http-socket=0.0.0.0:8000
|
||||
plugins=python3
|
||||
env=TRYTOND_CONFIG=$(TRYTOND_CONFIG)
|
||||
env=TRYTOND_DATABASE_URI=$(TRYTOND_DATABASE_URI)
|
||||
env=PYTHONOPTIMIZE=$(PYTHONOPTIMIZE)
|
||||
wsgi=trytond.application:app
|
||||
processes=1
|
||||
threads=4
|
Loading…
Reference in New Issue
Block a user