diff --git a/scripts/install b/scripts/install index 32df2a2..43349d9 100644 --- a/scripts/install +++ b/scripts/install @@ -47,10 +47,22 @@ ynh_setup_source --dest_dir="$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" +#================================================= +# BUILD YARN DEPENDENCIES +#================================================= +ynh_script_progression --message="Building Yarn dependencies..." + +pushd "$install_dir" + ynh_use_nodejs + npm install -g npm + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --production --pure-lockfile + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean +popd + #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring NGINX web server..." +ynh_script_progression --message="Adding system configurations..." # Create a dedicated NGINX config ynh_add_nginx_config @@ -66,22 +78,10 @@ ynh_use_logrotate yunohost service add $app --description="Federated video streaming platform" --log="/var/log/$app/$app.log" --needs_exposed_ports $port_rtmp -#================================================= -# BUILD YARN DEPENDENCIES -#================================================= -ynh_script_progression --message="Building Yarn dependencies..." - -pushd "$install_dir" - ynh_use_nodejs - npm install -g npm - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --production --pure-lockfile - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean -popd - #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Adding a configuration file..." +ynh_script_progression --message="Adding peertube configuration file..." ynh_add_config --template="production.yaml" --destination="$install_dir/config/production.yaml" chmod 400 "$install_dir/config/production.yaml" @@ -92,6 +92,14 @@ echo '{}' > "$install_dir/config/local-production.json" chmod 600 "$install_dir/config/local-production.json" chown $app:$app "$install_dir/config/local-production.json" +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Starting a systemd service..." + +# Start a systemd service +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP server listening on localhost" + #================================================= # INSTALL LDAP PLUGIN #================================================= @@ -103,14 +111,6 @@ pushd "$install_dir" echo "$admin_pass" | ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run reset-password -- -u root popd -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." - -# Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP server listening on localhost" - #================================================= # END OF SCRIPT #=================================================