diff --git a/conf/.env.production b/conf/.env.production index 121bc80..e097485 100644 --- a/conf/.env.production +++ b/conf/.env.production @@ -2,40 +2,40 @@ # (can overwrite variables present in Makefile.config) # Application -export FLASK_APP=fittrackee -export FLASK_SKIP_DOTENV=1 -# export HOST= -export PORT=__PORT__ -# export APP_SETTINGS=fittrackee.config.ProductionConfig -export APP_SECRET_KEY='__KEY__' -# export APP_WORKERS= -export APP_LOG=/var/log/__APP__/__APP__.log -export UPLOAD_FOLDER=/home/yunohost.app/__APP__/data +FLASK_APP=fittrackee +FLASK_SKIP_DOTENV=1 +# HOST= +PORT=__PORT__ +# APP_SETTINGS=fittrackee.config.ProductionConfig +APP_SECRET_KEY='__KEY__' +# APP_WORKERS= +APP_LOG=/var/log/__APP__/__APP__.log +UPLOAD_FOLDER=/home/yunohost.app/__APP__/data # PostgreSQL -export DATABASE_URL=postgresql://__DB_USER__:__DB_PWD__@:5432/__DB_NAME__ -# export DATABASE_DISABLE_POOLING= +DATABASE_URL=postgresql://__DB_USER__:__DB_PWD__@:5432/__DB_NAME__ +# DATABASE_DISABLE_POOLING= # Redis (required for API rate limits and email sending) -export REDIS_URL=redis:// +REDIS_URL=redis:// # API rate limits -# export API_RATE_LIMITS="300 per 5 minutes" +# API_RATE_LIMITS="300 per 5 minutes" # Emails -export UI_URL=__DOMAIN__ -export EMAIL_URL=__ADMIN_MAIL__ -export SENDER_EMAIL=__ADMIN_MAIL__ -# export WORKERS_PROCESSES= +UI_URL=__DOMAIN__ +EMAIL_URL=__ADMIN_MAIL__ +SENDER_EMAIL=__ADMIN_MAIL__ +# WORKERS_PROCESSES= # Workouts -# export TILE_SERVER_URL= -# export STATICMAP_SUBDOMAINS= -# export MAP_ATTRIBUTION= -# export DEFAULT_STATICMAP=False +# TILE_SERVER_URL= +# STATICMAP_SUBDOMAINS= +# MAP_ATTRIBUTION= +# DEFAULT_STATICMAP=False # Weather # available weather API providers: darksky, visualcrossing -# export WEATHER_API_PROVIDER=visualcrossing -# export WEATHER_API_KEY= +# WEATHER_API_PROVIDER=visualcrossing +# WEATHER_API_KEY= diff --git a/conf/fittrackee.service b/conf/fittrackee.service index 835f6cf..f0e0d0a 100644 --- a/conf/fittrackee.service +++ b/conf/fittrackee.service @@ -12,11 +12,20 @@ Restart=always RestartSec=1 User=__APP__ Group=__APP__ -StandardOutput=syslog StandardError=syslog -SyslogIdentifier=fittrackee SyslogIdentifier=__APP__ -EnvironmentFile=/etc/systemd/system/__APP__.service.d/variables.conf +Environment="APP_SECRET_KEY=" +Environment="APP_LOG=" +Environment="UPLOAD_FOLDER=" +Environment="DATABASE_URL=" +Environment="UI_URL=" +Environment="EMAIL_URL=" +Environment="SENDER_EMAIL=" +Environment="REDIS_URL=" +Environment="TILE_SERVER_URL=" +Environment="STATICMAP_SUBDOMAINS=" +Environment="MAP_ATTRIBUTION=" +Environment="WEATHER_API_KEY=" WorkingDirectory=__INSTALL_DIR__/ ExecStart=__INSTALL_DIR__/.venv/bin/gunicorn -b 127.0.0.1:__PORT__ "fittrackee:create_app()" --error-logfile /var/log/__APP__/__APP__.log Restart=always diff --git a/conf/fittrackee_workers.service b/conf/fittrackee_workers.service index b4305eb..0e3c271 100644 --- a/conf/fittrackee_workers.service +++ b/conf/fittrackee_workers.service @@ -12,10 +12,17 @@ Restart=always RestartSec=1 User=__APP__ Group=__APP__ -StandardOutput=syslog StandardError=syslog SyslogIdentifier=__APP___workers -EnvironmentFile=/etc/systemd/system/__APP___workers.service.d/variables.conf +Environment="FLASK_APP=fittrackee" +Environment="APP_SECRET_KEY=" +Environment="APP_LOG=" +Environment="UPLOAD_FOLDER=" +Environment="DATABASE_URL=" +Environment="UI_URL=" +Environment="EMAIL_URL=" +Environment="SENDER_EMAIL=" +Environment="REDIS_URL=" WorkingDirectory=__INSTALL_DIR__/ ExecStart=__INSTALL_DIR__/.venv/bin/flask worker --processes 2 Restart=always diff --git a/scripts/install b/scripts/install index 7cf8c48..c4ed3c5 100755 --- a/scripts/install +++ b/scripts/install @@ -98,24 +98,6 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=1 ynh_add_systemd_config --service="${app}" --template="${app}.service" ynh_add_systemd_config --service="${app}_workers" --template="${app}_workers.service" - -mkdir /etc/systemd/system/${app}.service.d/ -chown $app: /etc/systemd/system/${app}.service.d/ - -ynh_add_config --template="../conf/variables_fittrackee_workers.conf" --destination="/etc/systemd/system/${app}.service.d/variables.conf" -chmod 600 /etc/systemd/system/${app}.service.d/variables.conf -chown $app: "/etc/systemd/system/${app}.service.d/variables.conf" - -mkdir /etc/systemd/system/${app}_workers.service.d/ -chown $app: /etc/systemd/system/${app}_workers.service.d/ - -ynh_add_config --template="../conf/variables_fittrackee_workers.conf" --destination="/etc/systemd/system/${app}_workers.service.d/variables.conf" -chmod 600 /etc/systemd/system/${app}_workers.service.d/variables.conf -chown $app: "/etc/systemd/system/${app}_workers.service.d/variables.conf" - - -systemctl daemon-reload - #================================================= # GENERIC FINALIZATION #=================================================