3cardblind (646B)
1 #!/sbin/openrc-run 2 name="3cardblind" 3 description="3 Card Blind Flask Web Application" 4 5 user="web" 6 command="/usr/bin/gunicorn" 7 command_args="--bind 0.0.0.0:5000 --workers 4 app:app" 8 command_background="yes" 9 command_user="${user}" 10 directory="/opt/3cardblind" 11 pidfile="/var/run/${name}.pid" 12 output_log="/var/log/3cardblind.log" 13 error_log="/var/log/3cardblind.log" 14 15 export FLASK_ENV=production 16 17 start_pre() { 18 touch "${output_log}" 19 chown "${user}:${user}" "${output_log}" 20 # Initialize the materialized view 21 cd "${directory}" 22 su -s /bin/sh -c "python3 -c 'from app import init_db; init_db()'" "${user}" 23 } 24 25 depend() { 26 need net 27 }