From 04fcb6e460d4a39f7c3083e7f4e021af5a20a3d2 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Feb 2021 16:37:57 +0100 Subject: [PATCH] Fix --- conf/systemd.service | 6 +++--- scripts/install | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 6033abb..cfb9b2b 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,10 +7,10 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__ -Environment="NODE_ENV=production" -Environment="__YNH_NODE_LOAD_PATH__" -ExecStart=__FINALPATH__/ mywiki --listen port=__port__ authenticated-user-header=basic +ExecStart=__NODEJS_PATH__/node __FINALPATH__/tiddlywiki monwiki --listen port=__port__ authenticated-user-header=basic Restart=always +Environment=PATH=/usr/bin:/usr/local/bin:__NODEJS_PATH__ +Environment=NODE_ENV=production [Install] WantedBy=multi-user.target diff --git a/scripts/install b/scripts/install index 7b00230..14ba753 100755 --- a/scripts/install +++ b/scripts/install @@ -92,12 +92,23 @@ ynh_script_progression --message="Configuring system user..." --weight=1 # Create a system user ynh_system_user_create --username=$app --home_dir=$final_path +#================================================= +# SPECIFIC SETUP +#================================================= +ynh_script_progression --message="tiddlywiki..." --weight=2 + +pushd $final_path + $nodejs_path/node $final_path/tiddlywiki monwiki --init server +popd + #================================================= # SETUP SYSTEMD #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=1 -ynh_add_systemd_config --others_var=ynh_node_load_PATH +ynh_replace_string --match_string="__NODEJS_PATH__" --replace_string="$nodejs_path" --target_file="../conf/systemd.service" +ynh_replace_string --match_string="__port__" --replace_string="$port" --target_file="../conf/systemd.service" +ynh_add_systemd_config #================================================= # GENERIC FINALIZATION @@ -107,7 +118,7 @@ ynh_add_systemd_config --others_var=ynh_node_load_PATH # Set permissions to app files chown -R $app: $final_path -chmod -R 755 $final_path +chmod-R 755 $final_path #================================================= # ADVERTISE SERVICE IN ADMIN PANEL