Add Trytond configuration and scripts for deployment
This commit introduces essential files and scripts for setting up a Trytond environment, including configuration, logging, systemd services, NGINX, and utility scripts for managing Trytond.
This commit is contained in:
37
logging.conf
Normal file
37
logging.conf
Normal file
@@ -0,0 +1,37 @@
|
||||
[formatters]
|
||||
keys: simple, default
|
||||
|
||||
[handlers]
|
||||
keys: rotate, console, sentry
|
||||
|
||||
[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/tryton/also60prod.log', 'D', 1, 30)
|
||||
formatter: simple
|
||||
|
||||
[logger_root]
|
||||
level: INFO
|
||||
handlers: rotate, console, sentry
|
||||
propagate: False
|
||||
|
||||
[formatter_default]
|
||||
format=%(process)s %(thread)s [%(asctime)s] %(levelname)s %(name)s %(message)s
|
||||
|
||||
[handler_console]
|
||||
level=INFO
|
||||
class=logging.StreamHandler
|
||||
args=(sys.stdout,)
|
||||
formatter=default
|
||||
|
||||
[handler_sentry]
|
||||
level=ERROR
|
||||
class=sentry_tryton.SentryTrytonHandler
|
||||
args=('https://28b6aa6a4ee7463faaab678f7e558d00@glitch.aklaro.si/2?verify_ssl=0', 'An error have been occurred.\nOur suport team have been reported.', 'Use "{event_id}" to reference this error.',)
|
||||
|
||||
31
nginx/tryton
Normal file
31
nginx/tryton
Normal file
@@ -0,0 +1,31 @@
|
||||
server {
|
||||
listen 8000;
|
||||
server_name _;
|
||||
|
||||
root /home/tryton/atl60prod/sao/;
|
||||
index index.html;
|
||||
|
||||
charset utf-8;
|
||||
|
||||
client_max_body_size 2G;
|
||||
|
||||
# ssl on;
|
||||
# ssl_certificate /home/tryton/also56/ssl/fullchain.pem
|
||||
# ssl_certificate_key /home/tryton/also56/ssl/privkey.pem
|
||||
|
||||
location / {
|
||||
proxy_set_header Origin '';
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $server_name;
|
||||
|
||||
keepalive_timeout 900s;
|
||||
proxy_read_timeout 1800s;
|
||||
proxy_send_timeout 1200s;
|
||||
send_timeout 1200s;
|
||||
proxy_ignore_client_abort on;
|
||||
|
||||
proxy_pass http://127.0.0.1:5160;
|
||||
}
|
||||
}
|
||||
2
scripts/run-trytond-admin.sh
Normal file
2
scripts/run-trytond-admin.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
trytond-admin -c trytond.conf --logconf logging.conf -d also -v -u $1
|
||||
2
scripts/run-trytond-cron.sh
Normal file
2
scripts/run-trytond-cron.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
trytond-cron -c trytond.conf --logconf logging.conf -d also
|
||||
2
scripts/run-trytond-install.sh
Normal file
2
scripts/run-trytond-install.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
pip install --upgrade "$1 <5.3=>5.2"
|
||||
18
scripts/run-trytond-upgrade.sh
Normal file
18
scripts/run-trytond-upgrade.sh
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
list_packages() {
|
||||
pip freeze | grep '^trytond' | sed 's/==.*//'
|
||||
}
|
||||
|
||||
upgrade_package() {
|
||||
local package_name=$1
|
||||
local version=$2
|
||||
pip install --upgrade "${package_name}<${version}"
|
||||
}
|
||||
|
||||
packages=$(list_packages)
|
||||
|
||||
for package in $packages; do
|
||||
echo "Upgrading package: $package"
|
||||
upgrade_package "$package" "$1"
|
||||
done
|
||||
2
scripts/run-trytond-worker.sh
Normal file
2
scripts/run-trytond-worker.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
trytond-worker -c trytond.conf --logconf logging.conf -d also -n 1
|
||||
2
scripts/run-trytond.sh
Normal file
2
scripts/run-trytond.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
trytond -c trytond.conf -v --logconf logging.conf
|
||||
16
system/trytond-also60prod.cron.service
Normal file
16
system/trytond-also60prod.cron.service
Normal file
@@ -0,0 +1,16 @@
|
||||
[Unit]
|
||||
Description = Cron Trytond
|
||||
After = syslog.target
|
||||
|
||||
[Service]
|
||||
ExecStart = /opt/kitchen/venv/bin/trytond-cron -c /opt/kitchen/trytond.conf --logconf /opt/kitchen/logging.conf -d kitchen
|
||||
Restart = always
|
||||
KillSignal = SIGQUIT
|
||||
Type = simple
|
||||
StandardError = syslog
|
||||
NotifyAccess = all
|
||||
User=blaz
|
||||
Group=blaz
|
||||
|
||||
[Install]
|
||||
WantedBy = multi-user.target
|
||||
16
system/trytond-also60prod.uwsgi.service
Normal file
16
system/trytond-also60prod.uwsgi.service
Normal file
@@ -0,0 +1,16 @@
|
||||
[Unit]
|
||||
Description = uWSGI Trytond
|
||||
After = syslog.target
|
||||
|
||||
[Service]
|
||||
ExecStart = /usr/bin/uwsgi --ini /opt/kitchen/uwsgi.ini
|
||||
Restart = always
|
||||
KillSignal = SIGQUIT
|
||||
Type = notify
|
||||
StandardError = syslog
|
||||
NotifyAccess = all
|
||||
User=blaz
|
||||
Group=blaz
|
||||
|
||||
[Install]
|
||||
WantedBy = multi-user.target
|
||||
16
system/trytond.also60prod.worker.service
Normal file
16
system/trytond.also60prod.worker.service
Normal file
@@ -0,0 +1,16 @@
|
||||
[Unit]
|
||||
Description = Worker Trytond
|
||||
After = syslog.target
|
||||
|
||||
[Service]
|
||||
ExecStart = /opt/kitchen/venv/bin/trytond-worker -c /opt/kitchen/trytond.conf --logconf /opt/kitchen/logging.conf -d kitchen
|
||||
Restart = always
|
||||
KillSignal = SIGQUIT
|
||||
Type = simple
|
||||
StandardError = syslog
|
||||
NotifyAccess = all
|
||||
User=blaz
|
||||
Group=blaz
|
||||
|
||||
[Install]
|
||||
WantedBy = multi-user.target
|
||||
19
trytond.conf
Normal file
19
trytond.conf
Normal file
@@ -0,0 +1,19 @@
|
||||
[web]
|
||||
listen = 0.0.0.0:8003
|
||||
root = /home/tryton/atl60prod/sao
|
||||
#email_validation_url = http://minerva.dissidens.si:4000/validate/
|
||||
#reset_password_url = http://minerva.dissidens.si:4000/passwordreset/
|
||||
|
||||
[email]
|
||||
uri = smtp://de-smtp.root.local
|
||||
#uri = smtp://10.75.9.56
|
||||
from = tryton.si@also.com
|
||||
|
||||
[database]
|
||||
uri = postgresql://tryton:tryton@localhost
|
||||
path = var/lib/trytond
|
||||
language = en
|
||||
#list = False
|
||||
|
||||
[queue]
|
||||
worker = True
|
||||
12
uwsgi.ini
Normal file
12
uwsgi.ini
Normal file
@@ -0,0 +1,12 @@
|
||||
[uwsgi]
|
||||
http-socket = 0.0.0.0:5160
|
||||
master = true
|
||||
chdir = /home/tryton/also60prod
|
||||
virtualenv = /home/tryton/also60prod/.venv
|
||||
wsgi = trytond.application:app
|
||||
processes = 4
|
||||
threads = 2
|
||||
env = TRYTOND_CONFIG=/home/tryton/also60prod/trytond.conf
|
||||
env = TRYTOND_LOGGING_CONFIG=/home/tryton/also60prod/logging.conf
|
||||
# env = TRYTOND_COROUTINE=True
|
||||
env = TRYTOND_DATABASE_NAMES=also
|
||||
Reference in New Issue
Block a user