diff --git a/conf/app.src b/conf/app.src index a21d937..49d722a 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/os-js/OS.js/archive/v2.1.6.tar.gz -SOURCE_SUM=8cac584aa5405b9b5190537dbbcb58c1627bfdcf9dc851b49ead98cab793cf21 +SOURCE_URL=https://github.com/os-js/OS.js/archive/1380d4b98048dee2d7e95b9dddbf9af323f5fdab.tar.gz +SOURCE_SUM=2cbfad95c59016a404bec35db0a4e7b6ebf4e6f782ee17745ca553fdbc23f1b4 SOURCE_SUM_PRG=sha256sum ARCH_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/systemd.service b/conf/systemd.service index b2dd810..684ff99 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -10,7 +10,7 @@ Group=__APP__ WorkingDirectory=__FINALPATH__ ExecStartPre=__NODEJS__ Environment="PATH=__ENV_PATH__" -ExecStart=__NODE__/node osjs run --hostname=0.0.0.0 --port=__PORT__ >> /var/log/__APP__/osjs.log +ExecStart=__NODE__/npm run serve >> /var/log/__APP__/osjs.log Restart=always [Install] diff --git a/scripts/_common.sh b/scripts/_common.sh index 6f6f85f..5ab9822 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,7 +3,8 @@ #================================================= # COMMON VARIABLES #================================================= -node_version=8.11.1 + +node_version=8 #================================================= # BACKUP diff --git a/scripts/install b/scripts/install index 49bf50f..4b6ea5a 100644 --- a/scripts/install +++ b/scripts/install @@ -55,7 +55,7 @@ ynh_app_setting_set $app is_public $is_public #================================================= # Find a free port -port=$(ynh_find_port 4000) +port=$(ynh_find_port 8000) # Open this port yunohost firewall allow --no-upnp TCP $port 2>&1 ynh_app_setting_set $app port $port @@ -126,13 +126,18 @@ sudo chown admin -R $install_log pushd $final_path ynh_use_nodejs npm install >> $install_log 2>&1 -node osjs build +NODE_ENV=production npm run build >> $install_log 2>&1 +npm run package:discover popd #================================================= -# Configure init script +# Set right on directory and configure init script #================================================= +ynh_replace_string "8000" "$port" "$final_path/src/server/config.js" +chown $app:$app $final_path -R +chmod 755 $final_path -R +chown $app:$app /var/log/$app/$app.log systemctl daemon-reload systemctl enable "$app".service systemctl start "$app".service @@ -148,13 +153,14 @@ ynh_use_logrotate # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add NAME_INIT.D --log "/var/log/FILE.log" +yunohost service add $app --log "/var/log/$app/$app.log" #================================================= # Check if the service started #================================================= -ynh_check_starting "Running..." "/var/log/$app/osjs.log" "120" +#ynh_check_starting "HTTP Listening at localhost:$port" "/var/log/$app/$app.log" "120" +sleep 10 #================================================= # SETUP SSOWAT