diff --git a/conf/app.src b/conf/app.src index 19052d2..f979fc2 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://github.com/Requarks/wiki/archive/2.0.0-beta.42.tar.gz -SOURCE_SUM=cd1669229f87630498dcbad4e2b652bcd9ce9c88a0fe0c19b55b15f98d44d6e7 +SOURCE_URL=https://github.com/Requarks/wiki/releases/download/2.0.0-beta.42/wiki-js.tar.gz +SOURCE_SUM=e53edc10b7a187b8418acbc069de7560b580540fab51a37e902010152fad2a6d SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true +SOURCE_IN_SUBDIR=false SOURCE_FILENAME= diff --git a/conf/config.sample.yml b/conf/config.sample.yml index 1b0c2b3..1b82962 100644 --- a/conf/config.sample.yml +++ b/conf/config.sample.yml @@ -10,13 +10,6 @@ port: __PORT__ -# --------------------------------------------------------------------- -# IP address the server should listen to -# --------------------------------------------------------------------- -# Do not change unless you know what you are doing! - -bindIP: 0.0.0.0 - # --------------------------------------------------------------------- # Database # --------------------------------------------------------------------- @@ -38,16 +31,47 @@ db: # SQLite only: storage: path/to/database.sqlite -# --------------------------------------------------------------------- -# Redis -# --------------------------------------------------------------------- -# Redis 3.2 or later required +####################################################################### +# ADVANCED OPTIONS # +####################################################################### +# Do not change unless you know what you are doing! -redis: - host: localhost - port: 6379 - db: 0 - password: null +# --------------------------------------------------------------------- +# Use X-Forwarded-For header +# --------------------------------------------------------------------- +# Enable only if Wiki.js is behind a reverse-proxy (nginx, apache, etc) +# or a cloud proxying services like Cloudflare. + +trustProxy: false + +# --------------------------------------------------------------------- +# SSL/TLS Settings +# --------------------------------------------------------------------- +# Consider using a reverse proxy (e.g. nginx) if you require more +# advanced options than those provided below. + +ssl: + enabled: false + + # Certificate format, either 'pem' or 'pfx': + format: pem + # Using PEM format: + key: path/to/key.pem + cert: path/to/cert.pem + # Using PFX format: + pfx: path/to/cert.pfx + # Passphrase when using encrypted PEM / PFX keys (default: null): + passphrase: null + # Diffie Hellman parameters, with key length being greater or equal + # to 1024 bits (default: null): + dhparam: null + +# --------------------------------------------------------------------- +# IP address the server should listen to +# --------------------------------------------------------------------- +# Leave 0.0.0.0 for all interfaces + +bindIP: 0.0.0.0 # --------------------------------------------------------------------- # Log Level diff --git a/conf/systemd.service b/conf/systemd.service index eb1c958..a7fbff7 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,8 +6,11 @@ After=network.target Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__/ -ExecStart=/bin/sh -c '__NODEJS_PATH__/node __FINALPATH__/server >> /var/log/__APP__/__APP__.log 2>&1' +WorkingDirectory=__FINALPATH__ +ExecStart=__FINALPATH__/server/index.js +Restart=always +Environment=PATH=/usr/bin:/usr/local/bin +Environment=NODE_ENV=production [Install] WantedBy=multi-user.target diff --git a/manifest.json b/manifest.json index 0ce340f..aadd732 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "An open source, modern and powerful wiki app built on Node.js, Git and Markdown.", "fr": "Un wiki moderne et open source propulsé Node.js, Git et Markdown." }, - "version": "2.0.0-beta.42~ynh1", + "version": "2.0.0-beta.42~ynh2", "url": "https://wiki.js.org/", "license": "AGPL-3.0-or-later", "maintainer": { diff --git a/scripts/backup b/scripts/backup index fab852a..297bfde 100644 --- a/scripts/backup +++ b/scripts/backup @@ -69,7 +69,7 @@ ynh_psql_dump_db "$db_name" > db.sql #================================================= ynh_print_info "Backing up logrotate configuration..." -ynh_backup "/etc/logrotate.d/$app" +#ynh_backup "/etc/logrotate.d/$app" #================================================= # BACKUP SYSTEMD diff --git a/scripts/install b/scripts/install index c37f768..e53b295 100644 --- a/scripts/install +++ b/scripts/install @@ -89,13 +89,6 @@ port=$(ynh_find_port 8095) #ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port ynh_app_setting_set $app port $port -#================================================= -# INSTALL YARN 1.13.0 -#================================================= -ynh_print_info "Installing yarn 1.13.0..." - -sudo apt install -y ../sources/yarn_1.13.0_all.deb - #================================================= # INSTALL DEPENDENCIES #================================================= @@ -110,7 +103,7 @@ ynh_print_info "Installing dependencies..." ynh_install_nodejs 10 -ynh_install_app_dependencies redis-server postgresql postgresql-contrib build-essential +ynh_install_app_dependencies postgresql postgresql-contrib #================================================= # CREATE A POSTGRESQL DATABASE @@ -186,27 +179,9 @@ ynh_print_info "Configuring php-fpm ..." #================================================= # SPECIFIC SETUP #================================================= -# CREATE LOG FOLDER +# ... #================================================= -mkdir -p "/var/log/$app" -chown -R "$app":"$app" "/var/log/$app" - -#================================================= -# MAKE SETUP -#================================================= - -chown -R "$app":"$app" "$final_path" - -pushd $final_path - ynh_use_nodejs - sudo -u $app env PATH=$PATH yarn cache clean - sudo -u $app env PATH=$PATH yarn --frozen-lockfile --non-interactive - sudo -u $app env PATH=$PATH yarn build - ynh_secure_remove $final_path/node_modules - sudo -u $app env PATH=$PATH yarn --production --frozen-lockfile --non-interactive -popd - #================================================= # SETUP SYSTEMD #================================================= @@ -224,7 +199,6 @@ ynh_print_info "Configuring a systemd service ..." ### - And the section "SETUP SYSTEMD" in the upgrade script # Create a dedicated systemd config -ynh_replace_string "__NODEJS_PATH__" "$nodejs_path" "../conf/systemd.service" ynh_add_systemd_config #================================================= @@ -267,7 +241,6 @@ cp -f ../conf/config.sample.yml "$final_path/config.yml" ### `ynh_replace_string` is used to replace a string in a file. ### (It's compatible with sed regular expressions syntax) -#ynh_replace_string "match_string" "replace_string" "$final_path/config.yml" ynh_replace_string "__PORT__" "$port" "$final_path/config.yml" ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/config.yml" ynh_replace_string "__DB_NAME__" "$db_name" "$final_path/config.yml" @@ -310,7 +283,7 @@ ynh_print_info "Configuring log rotation ..." ### - And the section "SETUP LOGROTATE" in the upgrade script # Use logrotate to manage application logfile(s) -ynh_use_logrotate +#ynh_use_logrotate #================================================= # ADVERTISE SERVICE IN ADMIN PANEL @@ -326,7 +299,7 @@ ynh_use_logrotate #yunohost service add $app --log "/var/log/$app/$app.log" # if using yunohost version 3.2 or more in the 'manifest.json', a description can be added -yunohost service add $app --description "$app daemon for Wiki.js" --log "/var/log/$app/$app.log" +yunohost service add $app --description "$app daemon for Wiki.js" -t systemd #================================================= # SETUP SSOWAT diff --git a/scripts/remove b/scripts/remove index 9912b15..bc82d4d 100644 --- a/scripts/remove +++ b/scripts/remove @@ -62,13 +62,6 @@ ynh_remove_app_dependencies ynh_use_nodejs ynh_remove_nodejs -#================================================= -# REMOVE YARN 1.13.0 -#================================================= -ynh_print_info "Removing yarn 1.13.0..." - -sudo apt remove -y yarn - #================================================= # REMOVE APP MAIN DIR #================================================= @@ -99,7 +92,7 @@ ynh_print_info "Removing php-fpm configuration" ynh_print_info "Removing logrotate configuration" # Remove the app-specific logrotate config -ynh_remove_logrotate +#ynh_remove_logrotate #================================================= # CLOSE A PORT @@ -124,7 +117,7 @@ fi ynh_secure_remove "/etc/$app/" # Remove the log files -ynh_secure_remove "/var/log/$app/" +#ynh_secure_remove "/var/log/$app/" #================================================= # GENERIC FINALIZATION diff --git a/scripts/restore b/scripts/restore index 582e508..d89ccf2 100644 --- a/scripts/restore +++ b/scripts/restore @@ -91,7 +91,7 @@ ynh_print_info "Reinstalling dependencies..." ynh_install_nodejs 10 -ynh_install_app_dependencies redis-server postgresql postgresql-contrib build-essential +ynh_install_app_dependencies postgresql postgresql-contrib #================================================= # RESTORE THE POSTGRESQL DATABASE @@ -115,7 +115,7 @@ systemctl daemon-reload # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add $app --description "$app daemon for Wiki.js" --log "/var/log/$app/$app.log" +yunohost service add $app --description "$app daemon for Wiki.js" -t systemd #================================================= # RESTORE THE CRON FILE @@ -127,7 +127,7 @@ yunohost service add $app --description "$app daemon for Wiki.js" --log "/var/lo # RESTORE THE LOGROTATE CONFIGURATION #================================================= -ynh_restore_file "/etc/logrotate.d/$app" +#ynh_restore_file "/etc/logrotate.d/$app" #================================================= # GENERIC FINALIZATION @@ -139,13 +139,6 @@ ynh_print_info "Reloading nginx web server and php-fpm..." #systemctl reload php7.0-fpm systemctl reload nginx -#================================================= -# CREATE LOG FOLDER -#================================================= - -mkdir -p "/var/log/$app" -chown -R "$app":"$app" "/var/log/$app" - #================================================= # START SERVICE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index b6edd2a..d82e46b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -56,6 +56,12 @@ fi # Remove yarn repository ynh_secure_remove "/etc/apt/sources.list.d/yarn.list" +# Remove old dependencies +ynh_package_autoremove yarn redis-server build-essential + +# Remove old log file +ynh_secure_remove "/var/log/$app/" + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -102,13 +108,6 @@ ynh_print_info "Upgrading nginx web server configuration..." # Create a dedicated nginx config ynh_add_nginx_config -#================================================= -# INSTALL YARN 1.13.0 -#================================================= -ynh_print_info "Installing yarn 1.13.0..." - -sudo apt install -y ../sources/yarn_1.13.0_all.deb - #================================================= # UPGRADE DEPENDENCIES #================================================= @@ -116,7 +115,7 @@ ynh_print_info "Upgrading dependencies..." ynh_install_nodejs 10 -ynh_install_app_dependencies redis-server postgresql postgresql-contrib build-essential +ynh_install_app_dependencies postgresql postgresql-contrib #================================================= # CREATE DEDICATED USER @@ -134,21 +133,6 @@ ynh_print_info "Upgrading php-fpm configuration..." # Create a dedicated php-fpm config #ynh_add_fpm_config -#================================================= -# MAKE SETUP -#================================================= - -chown -R "$app":"$app" "$final_path" - -pushd $final_path - ynh_use_nodejs - sudo -u $app env PATH=$PATH yarn cache clean - sudo -u $app env PATH=$PATH yarn --frozen-lockfile --non-interactive - sudo -u $app env PATH=$PATH yarn build - ynh_secure_remove $final_path/node_modules - sudo -u $app env PATH=$PATH yarn --production --frozen-lockfile --non-interactive -popd - #================================================= # MODIFY A CONFIG FILE #================================================= @@ -158,7 +142,6 @@ cp -f ../conf/config.sample.yml "$final_path/config.yml" ### `ynh_replace_string` is used to replace a string in a file. ### (It's compatible with sed regular expressions syntax) -#ynh_replace_string "match_string" "replace_string" "$final_path/config.yml" ynh_replace_string "__PORT__" "$port" "$final_path/config.yml" ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/config.yml" ynh_replace_string "__DB_NAME__" "$db_name" "$final_path/config.yml" @@ -175,7 +158,7 @@ ynh_store_file_checksum "$final_path/config.yml" ynh_print_info "Upgrading logrotate configuration..." # Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append +#ynh_use_logrotate --non-append #================================================= # SETUP SYSTEMD @@ -183,7 +166,6 @@ ynh_use_logrotate --non-append ynh_print_info "Upgrading systemd configuration..." # Create a dedicated systemd config -ynh_replace_string "__NODEJS_PATH__" "$nodejs_path" "../conf/systemd.service" ynh_add_systemd_config #================================================= diff --git a/sources/yarn_1.13.0_all.deb b/sources/yarn_1.13.0_all.deb deleted file mode 100644 index fe88e47..0000000 Binary files a/sources/yarn_1.13.0_all.deb and /dev/null differ