diff --git a/doc/ADMIN.md b/doc/ADMIN.md index 697dfd8..15203f5 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -1,9 +1,9 @@ -We have added the mandatory sandbox domain for you but you still need to configure your DNS and generate Let's Encrypt Certificates for it !! +We have added the mandatory sandbox domain for you but you still need to configure your DNS and generate Let's Encrypt Certificates for it! Once CryptPad is installed, create an account via the Register button on the home page. To make this account an instance administrator: 1. Copy the public key found in User Menu (avatar at the top right) > Settings > Account > Public Signing Key -2. Paste this key in `/var/www/cryptpad/config/config.js` in the following array (uncomment and replace the placeholder): +2. Paste this key in `__INSTALL_DIR__/config/config.js` in the following array (uncomment and replace the placeholder): ``` adminKeys: [ "[cryptpad-user1@my.awesome.website/YZgXQxKR0Rcb6r6CmxHPdAGLVludrAF2lEnkbx1vVOo=]", diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md index b349804..0181737 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -5,7 +5,7 @@ Nous avons ajouté le domaine obligatoire sandbox pour vous mais vous devez enco Une fois CryptPad installé, créez un compte via le bouton S'inscrire sur la page d'accueil. Pour faire de ce compte un administrateur d'instance : 1. Copiez la clé publique trouvée dans le menu utilisateur (avatar en haut à droite) > Paramètres > Compte > Clé de signature publique -2. Collez cette clé dans `/var/www/cryptpad/config/config.js` dans le tableau suivant (décommentez et remplacez l'espace réservé) : +2. Collez cette clé dans `__INSTALL_DIR__/config/config.js` dans le tableau suivant (décommentez et remplacez l'espace réservé) : ``` adminKeys: [ "[cryptpad-user1@my.awesome.website/YZgXQxKR0Rcb6r6CmxHPdAGLVludrAF2lEnkbx1vVOo=]", diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md index 9c530ab..72e066f 100644 --- a/doc/POST_INSTALL.md +++ b/doc/POST_INSTALL.md @@ -7,7 +7,7 @@ Once CryptPad is installed, create an account via the Sign Up button on the home To make this account an instance administrator: 1. Copy the public key found in User Menu (avatar at the top right) > Settings > Account > Public Signing Key -2. Paste this key in `/var/www/cryptpad/config/config.js` in the following array (uncomment and replace the placeholder): +2. Paste this key in `__INSTALL_DIR__/config/config.js` in the following array (uncomment and replace the placeholder): ``` adminKeys: [ diff --git a/doc/POST_UPGRADE.md b/doc/POST_UPGRADE.md index 6023335..4192e11 100644 --- a/doc/POST_UPGRADE.md +++ b/doc/POST_UPGRADE.md @@ -3,7 +3,7 @@ If not already done, then you can please open CryptPad domain: https://__DOMAIN_ Create an account via the Register button on the home page. To make this account an instance administrator: 1. Copy the public key found in User Menu (avatar at the top right) > Settings > Account > Public Signing Key -2. Paste this key in /var/www/cryptpad/config/config.js in the following array (uncomment and replace the placeholder): +2. Paste this key in `__INSTALL_DIR__/config/config.js` in the following array (uncomment and replace the placeholder): adminKeys: [ "[cryptpad-user1@my.awesome.website/YZgXQxKR0Rcb6r6CmxHPdAGLVludrAF2lEnkbx1vVOo=]", ], diff --git a/scripts/change_url b/scripts/change_url index 5d35e69..2e774f4 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -16,7 +16,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # MODIFY URL IN NGINX CONF @@ -32,7 +32,7 @@ ynh_change_url_nginx_config #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="server available" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="server available" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 2a05bac..ea74202 100644 --- a/scripts/install +++ b/scripts/install @@ -87,18 +87,12 @@ chown $app "$install_dir/config/config.js" #================================================= # INSTALL CRYPTPAD #================================================= -ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=60 +ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=30 pushd "$install_dir" ynh_use_nodejs ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm ci ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm run install:components - - #ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm install --allow-root - #ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm install -g bower - #ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH bower install --allow-root - #ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH bower update --allow-root - #ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm run build popd #================================================= diff --git a/scripts/remove b/scripts/remove index dbc0282..b8c65e8 100644 --- a/scripts/remove +++ b/scripts/remove @@ -16,24 +16,16 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 -# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null then ynh_script_progression --message="Removing $app service integration..." --weight=3 yunohost service remove $app fi -# Remove the dedicated systemd config ynh_remove_systemd_config -# Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=3 - ynh_remove_nodejs #================================================= @@ -56,7 +48,7 @@ if ! [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then sandboxdomain=sandbox-$domain fi - ynh_script_progression --message="Removing sandbox domain : $sandboxdomain" --weight=1 + ynh_script_progression --message="Removing sandbox domain: $sandboxdomain" --weight=1 if yunohost domain list | grep -q $sandboxdomain then #if domain exist we remove it diff --git a/scripts/restore b/scripts/restore index b8a266e..717ab6e 100644 --- a/scripts/restore +++ b/scripts/restore @@ -6,7 +6,6 @@ # IMPORT GENERIC HELPERS #================================================= -# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers diff --git a/scripts/upgrade b/scripts/upgrade index e55c805..5a328bd 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -39,7 +39,6 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=1 - # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" #--keep="config/config.js" chmod -R o-rwx "$install_dir" @@ -69,7 +68,7 @@ if [[ $domain == *".local" ]]; then sandboxdomain=sandbox-$domain fi -ynh_script_progression --message="Setting up sandobx domain: $sandboxdomain" --weight=1 +ynh_script_progression --message="Setting up sandbox domain: $sandboxdomain" --weight=1 # We don't test that in CI if ! [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then @@ -89,6 +88,10 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - ynh_add_nginx_config env_path="$PATH" +ynh_add_systemd_config + +yunohost service add $app --description="Zero Knowledge realtime collaborative editor" --log="/var/log/$app/$app.log" + #================================================= # UPGRADE DEPENDENCIES #================================================= @@ -96,37 +99,27 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=6 ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -#================================================= -# INSTALL CRYPTPAD -#================================================= -ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=60 - -pushd "$install_dir" - ynh_exec_warn_less npm install --allow-root - ynh_exec_warn_less npm install -g bower - ynh_exec_warn_less bower update --allow-root - ynh_exec_warn_less npm i - ynh_exec_warn_less npm run build -popd - -#================================================= -# CREATE SYSTEMD SERVICE -#================================================= -# Create a dedicated systemd config -ynh_add_systemd_config - -yunohost service add $app --description="Zero Knowledge realtime collaborative editor" --log="/var/log/$app/$app.log" - #================================================= # ADD UPGRADED CONFIG WITH SANDBOX #================================================= ynh_script_progression --message="Updating a configuration file..." --weight=1 -ynh_add_config --template="../conf/config.js" --destination="$install_dir/config/config.js" +ynh_add_config --template="config.js" --destination="$install_dir/config/config.js" chmod 600 "$install_dir/config/config.js" chown $app "$install_dir/config/config.js" +#================================================= +# INSTALL CRYPTPAD +#================================================= +ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=30 + +pushd "$install_dir" + ynh_use_nodejs + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm ci + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm run install:components +popd + #================================================= # START SYSTEMD SERVICE #=================================================