Repository navigation
Install
Lajos Santa edited this page Dec 23, 2020
·
23 revisions
- python v3.9
- virtualenv (optional, but recommended)
- postgresql (and create user, db, etc..)
- redis
sudo pip install virtualenv- pick some folder for the virtualenv's files (eg /var/www/buck)
virtualenv /var/www/bucksource /var/www/buck/bin/activate
TODO- example config:
database: postgresql+asyncpg://user:pass@host/name
redis: redis://localhost:6379/1
logger:
disable_existing_loggers: false
formatters:
standard:
format: '%(asctime)s - %(levelname)s - %(filename)s:%(lineno)s: %(message)s'
handlers:
console:
class: logging.StreamHandler
formatter: standard
level: DEBUG
loggers:
buck:
handlers: [console]
level: DEBUG
propagate: true
version: 1- test the install:
uvicorn buck.app:app --host 0.0.0.0 --port 9000
- make writable
/var/www/buck/by the www-data user (chown www-data /var/www/buck/)
- create systemd service file
/etc/systemd/system/buck-web.servicewith this content:
[Unit]
Description=Buck web service
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=www-data
ExecStart=/var/www/buck/bin/uvicorn buck.app:app --workers 4 --port 9000
[Install]
WantedBy=multi-user.target
- create systemd service file
/etc/systemd/system/buck-celery.servicewith this content:
[Unit]
Description=Buck celery service
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=www-data
ExecStart=/var/www/buck/bin/celery -A buck.celery.app worker --loglevel=info --statedb=/var/www/buck/celery.state
[Install]
WantedBy=multi-user.target