diff --git a/conf/exporter.env b/conf/exporter.env new file mode 100644 index 0000000..9ae4511 --- /dev/null +++ b/conf/exporter.env @@ -0,0 +1,5 @@ +NODE_ENV=production +PENPOT_HTTP_SERVER_PORT=__PORT_EXPORTER__ +PENPOT_HTTP_SERVER_host=127.0.0.1 +PENPOT_PUBLIC_URI=https://__DOMAIN__ +PENPOT_REDIS_URI=redis://127.0.0.1:6379/__REDIS_DB__ \ No newline at end of file diff --git a/conf/exporter.service b/conf/exporter.service index 1cab20f..89079e1 100644 --- a/conf/exporter.service +++ b/conf/exporter.service @@ -9,12 +9,9 @@ User=__APP__ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/exporter -ExecStart=__YNH_NODE__ app.js --http-server-port=__PORT__ +ExecStart=__YNH_NODE__ --env-file=.env app.js Restart=always Environment=__YNH_NODE_LOAD_PATH__ -Environment=NODE_ENV=production -Environment=PENPOT_PUBLIC_URI=https://__DOMAIN__ -Environment=PENPOT_REDIS_URI=redis://127.0.0.1:6379:__REDIS_DB__ StandardOutput=append:/var/log/__APP__/__APP__-exporter.log StandardError=inherit Restart=on-failure diff --git a/scripts/install b/scripts/install index 93cd800..77bca85 100644 --- a/scripts/install +++ b/scripts/install @@ -51,7 +51,8 @@ ynh_script_progression --message="Setting up source files..." ynh_setup_source --dest_dir="$install_dir/build" -chown -R $app:$app "$install_dir" +chown -R $app:www-data "$install_dir" +chmod -R 755 "$install_dir" #================================================= # INSTALL APP @@ -157,15 +158,19 @@ ynh_add_config --template="environ" --destination="$install_dir/backend/environ" chmod 400 "$install_dir/backend/environ" chown $app:$app "$install_dir/backend/environ" +ynh_add_config --template="exporter.env" --destination="$install_dir/exporter/.env" +chmod 400 "$install_dir/exporter/.env" +chown $app:$app "$install_dir/exporter/.env" + #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name=$app-api --action="start" --log_path="/var/log/$app/$app-api.log" --line_match="welcome to penpot" +ynh_systemd_action --service_name=$app-backend --action="start" --log_path="/var/log/$app/$app-backend.log" --line_match="welcome to penpot" -#ynh_systemd_action --service_name=$app-proxy --action="start" --log_path="/var/log/$app/$app-proxy.log" --line_match="Running server!" +ynh_systemd_action --service_name=$app-exporter --action="start" --log_path="/var/log/$app/$app-exporter.log" --line_match="redis connection established" #================================================= # END OF SCRIPT