- nodejs >10.10.0
- npm
- python 3.6
- pip [python 3.6]
- venv [python 3.6]
- celery compatible Broker documentation
- celery scheduler for recurring tasks documentation
After you've cloned this repo you have to do the install routine for both backend AND frontend before starting the backend!
Backend:
# setup virtualenv
virtualenv venv
. venv/bin/activate
# install requirements
pip install -r requirements_developement.txt
pip install -r requirements.txt
pip install -e .
Frontend:
cd total_tolles_ferleihsystem
npm install
npm run build
Start the webpack developement server:
cd total_tolles_ferleihsystem
npm run start
First start:
. venv/bin/activate
export FLASK_APP=total_tolles_ferleihsystem
export FLASK_DEBUG=1 # to enable autoreload
export MODE=debug
# export MODE=production
# export MODE=test
# create and init debug db:
flask create_db
# start server
flask run
# start celery worker (needs new terminal) with beats (only for debugging!)
celery -A total_tolles_ferleihsystem.celery worker -B --loglevel=info
## start celery worker for production:
# celery -A total_tolles_ferleihsystem.celery worker
## startcelery scheduler (beats) for production (needed for periodic tasks):
# celery -A total_tolles_ferleihsystem.celery beat -s <path to persitence db>
Subsequent starts:
flask run
Drop and recreate DB:
flask drop_db
flask create_db
The following sites are available after starting the flask development server:
Only in debug mode: debug
The migrations use Flask-Migrate.
Commands:
# create new migration after model changes:
flask db migrate
# update db to newest migration:
flask db upgrade
# get help for db operations:
flask db --help
After creating a new migration file with flask db migrate
it is neccessary to manually check the generated upgrade script. Please refer to the alembic documentation.
Prerequisites:
- Python >3.6, Virtualenv, Pip
- npm, node >8
- Apache2, mod-wsgi
- Celery Broker documentation
- Celery Scheduler celery scheduler for recurring tasks documentation
Installation / Upgrade process:
- Install Prerequisites
- Download/Clone Repository
- Copy
install.sh
to a different location outside of the repository- Make it executable
- update the variables at the top of the script
- execute
install.sh
- check options: documentation
- (Re-) Start Celery workers and scheduler
For use with MySql or other db engine:
- Setup Database User and scheme
- For MySql/Mariadb use utf8mb4 charset
- Install a driver for your selected Database in the virtualenv
- Update the database url in the config file
- For MySql/Mariadb use utf8mb4 charset
- execute
install.sh
to generate database
Troubleshooting:
- Check all file permissions (use
install.sh
as reference) - Check AppArmor/Selinux permissions
- Check apache logs
- Check apache config
- Check TTF logs
- Check Python version (>3.6!)
- Check if Celery Broker is running
- Check if workers are running
- Check if Celery Scheduler is running