From 9e2c4dd9f9d8bb8d5e7a6b3681d70fd2ec4fc127 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 28 Dec 2019 01:57:36 +0100 Subject: [PATCH 1/5] Upgrade to 0.4.0-alpha-4 --- README.md | 2 +- conf/.env | 48 +++++++++++++++++++++-------- conf/Cargo.toml | 81 ------------------------------------------------- conf/x86-64.src | 4 +-- manifest.json | 2 +- scripts/install | 3 -- 6 files changed, 39 insertions(+), 101 deletions(-) delete mode 100644 conf/Cargo.toml diff --git a/README.md b/README.md index 65762ce..f92bcf3 100755 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to ## Overview Federated blogging engine, based on ActivityPub. It uses the Rocket framework, and Diesel to interact with the database. -**Shipped version:** 0.3.0-alpha-2 +**Shipped version:** 0.4.0-alpha-4 **Warning:** The package can take **15 to 30 minutes** to complete depending on your system configuration. **Don't intrupt the installation process while installing.** diff --git a/conf/.env b/conf/.env index 9574cd9..ffb27a1 100755 --- a/conf/.env +++ b/conf/.env @@ -1,25 +1,47 @@ -# The address of the database -# (replace USER, PASSWORD, PORT and DATABASE_NAME with your values) -# -# If you are using SQlite, use the path of the database file (`plume.db` for instance) -DATABASE_URL=postgres://__DB_NAME__:__DB_PWD__@localhost:5432/__DB_NAME__ +# This file contains your instance configuration +# Some documentation about these variables is available here: +# https://docs.joinplu.me/environment/ + +## GENERAL SETTINGS ## -# For PostgreSQL: migrations/postgres +# The directory containing database migrations +# For Postgres: migrations/postgres # For SQlite: migrations/sqlite MIGRATION_DIRECTORY=migrations/postgres -# The domain on which your instance will be available -BASE_URL=__DOMAIN__ +# The URL of your database (or its path for SQlite databases) +DATABASE_URL=postgres://__DB_NAME__:__DB_PWD__@localhost:5432/__DB_NAME__ -ROCKET_PORT=__PORT__ -ROCKET_ADDRESS=127.0.0.1 +# The domain of your instance +BASE_URL=__DOMAIN__ -# Secret key used for private cookies and CSRF protection +# The secret key for private cookies and CSRF protection # You can generate one with `openssl rand -base64 32` ROCKET_SECRET_KEY=__SECRET_KEY__ -# Mail settings +# Port and address which Plume will use +ROCKET_PORT=__PORT__ +ROCKET_ADDRESS=127.0.0.1 + +## MAIL CONFIG ## MAIL_SERVER=localhost +MAIL_ADDRESS=no-reply@__DOMAIN__ #MAIL_USER=example #MAIL_PASSWORD=123456 -MAIL_HELO_NAME=__DOMAIN__ \ No newline at end of file +MAIL_HELO_NAME=no-reply@__DOMAIN__ + +## ADVANCED OPTIONS ## +#MEDIA_UPLOAD_DIRECTORY=static/media +#SEARCH_INDEX=search_index + +# Sample logo configuration +#PLUME_LOGO=icons/trwnh/paragraphs/plumeParagraphs.svg +#PLUME_LOGO_FAVICON=icons/trwnh/paragraphs/plumeParagraphs32.png +#PLUME_LOGO_48=icons/trwnh/paragraphs/plumeParagraphs48.png +#PLUME_LOGO_72=icons/trwnh/paragraphs/plumeParagraphs72.png +#PLUME_LOGO_96=icons/trwnh/paragraphs/plumeParagraphs96.png +#PLUME_LOGO_144=icons/trwnh/paragraphs/plumeParagraphs144.png +#PLUME_LOGO_160=icons/trwnh/paragraphs/plumeParagraphs160.png +#PLUME_LOGO_192=icons/trwnh/paragraphs/plumeParagraphs192.png +#PLUME_LOGO_256=icons/trwnh/paragraphs/plumeParagraphs256.png +#PLUME_LOGO_512=icons/trwnh/paragraphs/plumeParagraphs512.png diff --git a/conf/Cargo.toml b/conf/Cargo.toml deleted file mode 100644 index 0926cbc..0000000 --- a/conf/Cargo.toml +++ /dev/null @@ -1,81 +0,0 @@ -[package] -authors = ["Plume contributors"] -name = "plume" -version = "0.3.0" -repository = "https://github.com/Plume-org/Plume" - -[dependencies] -activitypub = "0.1.3" -askama_escape = "0.1" -atom_syndication = "0.6" -canapi = "0.2" -colored = "1.7" -dotenv = "0.13" -gettext = { git = "https://github.com/Plume-org/gettext/", rev = "294c54d74c699fbc66502b480a37cc66c1daa7f3" } -gettext-macros = { git = "https://github.com/Plume-org/gettext-macros/", rev = "a7c605f7edd6bfbfbfe7778026bfefd88d82db10" } -gettext-utils = { git = "https://github.com/Plume-org/gettext-macros/", rev = "a7c605f7edd6bfbfbfe7778026bfefd88d82db10" } -guid-create = "0.1" -heck = "0.3.0" -lettre = { git = "https://github.com/lettre/lettre", rev = "c988b1760ad8179d9e7f3fb8594d2b86cf2a0a49" } -lettre_email = { git = "https://github.com/lettre/lettre", rev = "c988b1760ad8179d9e7f3fb8594d2b86cf2a0a49" } -num_cpus = "1.0" -rocket = "0.4.0" -rocket_contrib = { version = "0.4.0", features = ["json"] } -rocket_i18n = { git = "https://github.com/Plume-org/rocket_i18n", rev = "e922afa7c366038b3433278c03b1456b346074f2" } -rpassword = "2.0" -runtime-fmt = "0.3.0" -scheduled-thread-pool = "0.2.0" -serde = "1.0" -serde_json = "1.0" -serde_qs = "0.4" -validator = "0.8" -validator_derive = "0.8" -webfinger = "0.3.1" - -[[bin]] -name = "plume" -path = "src/main.rs" - -[dependencies.chrono] -features = ["serde"] -version = "0.4" - -[dependencies.ctrlc] -features = ["termination"] -version = "3.1.1" - -[dependencies.diesel] -features = ["r2d2", "chrono"] -version = "*" - -[dependencies.multipart] -default-features = false -features = ["server"] -version = "0.16" - -[dependencies.plume-api] -path = "plume-api" - -[dependencies.plume-common] -path = "plume-common" - -[dependencies.plume-models] -path = "plume-models" - -[dependencies.rocket_csrf] -git = "https://github.com/fdb-hiroshima/rocket_csrf" -rev = "4a72ea2ec716cb0b26188fb00bccf2ef7d1e031c" - -[build-dependencies] -ructe = "0.5.6" -rsass = "0.9" - -[features] -default = ["postgres"] -postgres = ["plume-models/postgres", "diesel/postgres"] -sqlite = ["plume-models/sqlite", "diesel/sqlite"] -debug-mailer = [] -test = [] - -[workspace] -members = ["plume-api", "plume-cli", "plume-models", "plume-common", "plume-front"] diff --git a/conf/x86-64.src b/conf/x86-64.src index b38afa3..f399288 100644 --- a/conf/x86-64.src +++ b/conf/x86-64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/Plume-org/Plume/releases/download/0.3.0-alpha-2/plume-postgres.tar.gz -SOURCE_SUM=e0c33a38367a5428606ae7bf8524c325edea09fdb4511c80a7aa8f4eb8f30905 +SOURCE_URL=https://github.com/Plume-org/Plume/releases/download/0.4.0-alpha-4/plume-postgres.tar.gz +SOURCE_SUM=4cb02ae873cf11e04999bf2e2295ff96ea27fe18fdc395c6cce5c8f7cd05ccee SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=false diff --git a/manifest.json b/manifest.json index f0073ab..2c41dab 100755 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Federated blogging application", "fr": "Une application de blogging fédérée." }, - "version": "0.3.0-alpha-2~ynh1", + "version": "0.4.0-alpha-4~ynh1", "url": "https://baptiste.gelez.xyz/", "license": "AGPL-3.0-only", "maintainer": [ diff --git a/scripts/install b/scripts/install index 59cfb79..86b9744 100755 --- a/scripts/install +++ b/scripts/install @@ -164,9 +164,6 @@ ynh_replace_string --match_string="__SECRET_KEY__" --replace_string="$secret_key # MAKE SETUP #================================================= -# Fix missing Cargo.toml -cp "../conf/Cargo.toml" "$final_path/$app/Cargo.toml" - # Set right permissions chown -R "$app":"$app" $final_path From b725945d7871c185d8c62eeddb7f73366ed3408b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 28 Dec 2019 14:01:03 +0100 Subject: [PATCH 2/5] Fix install --- conf/x86-64.src | 2 +- scripts/install | 3 ++- scripts/upgrade | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/conf/x86-64.src b/conf/x86-64.src index f399288..d802420 100644 --- a/conf/x86-64.src +++ b/conf/x86-64.src @@ -1,5 +1,5 @@ SOURCE_URL=https://github.com/Plume-org/Plume/releases/download/0.4.0-alpha-4/plume-postgres.tar.gz -SOURCE_SUM=4cb02ae873cf11e04999bf2e2295ff96ea27fe18fdc395c6cce5c8f7cd05ccee +SOURCE_SUM=10b467eb62c862178a8e00e28890b24871ed6d8e77a631eede44bc7c2a1c3bef SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=false diff --git a/scripts/install b/scripts/install index 86b9744..cdca45a 100755 --- a/scripts/install +++ b/scripts/install @@ -16,6 +16,7 @@ source /usr/share/yunohost/helpers ynh_clean_setup () { ynh_clean_check_starting + read -p "key" } # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -170,7 +171,7 @@ chown -R "$app":"$app" $final_path export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin" pushd $final_path/$app - sudo -u "$app" env PATH=$PATH diesel migration run + sudo -u "$app" env PATH=$PATH plm migration run # Add new instance if [ $registration -eq 1 ] diff --git a/scripts/upgrade b/scripts/upgrade index 0c30beb..394b793 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -170,7 +170,7 @@ chown -R "$app":"$app" $final_path export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin" pushd $final_path/$app - sudo -u "$app" env PATH=$PATH diesel migration run + sudo -u "$app" env PATH=$PATH plm migration run popd #================================================= From 7c9d049f648df08865cb689016ff5fb3da3b1cf6 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 28 Dec 2019 14:08:49 +0100 Subject: [PATCH 3/5] cleanup --- scripts/install | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/install b/scripts/install index cdca45a..bc90df2 100755 --- a/scripts/install +++ b/scripts/install @@ -16,7 +16,6 @@ source /usr/share/yunohost/helpers ynh_clean_setup () { ynh_clean_check_starting - read -p "key" } # Exit if an error occurs during the execution of the script ynh_abort_if_errors From 481bd9690e8242cfa3fa01440bc5532f0cc30066 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 29 Dec 2019 02:12:39 +0100 Subject: [PATCH 4/5] Update check_process --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index a9e9ae9..8620c42 100755 --- a/check_process +++ b/check_process @@ -14,7 +14,7 @@ setup_private=1 setup_public=1 upgrade=1 - upgrade=1 from_commit=4b6b14d8f63874c12507106e08033ec661b25d20 + upgrade=1 from_commit=279716dff5fc79cc84ae2d7799c8094017ac028e backup_restore=1 multi_instance=1 # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version. From 7580d8a425cf484d12a2d4c0dd465450dad4d12f Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 29 Dec 2019 13:59:51 +0100 Subject: [PATCH 5/5] Fix upgrade --- scripts/backup | 4 ++-- scripts/change_url | 4 ++-- scripts/install | 2 +- scripts/upgrade | 15 ++++++++++----- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/scripts/backup b/scripts/backup index 2ed898d..a7b4fbc 100755 --- a/scripts/backup +++ b/scripts/backup @@ -38,7 +38,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) #================================================= ynh_print_info --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped plume" #================================================= # BACKUP THE APP MAIN DIR @@ -82,7 +82,7 @@ ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started plume" #================================================= # END OF SCRIPT diff --git a/scripts/change_url b/scripts/change_url index 8e90651..62db616 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -58,7 +58,7 @@ fi #================================================= ynh_print_info --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped plume" #================================================= # MODIFY URL IN NGINX CONF @@ -114,7 +114,7 @@ ynh_store_file_checksum --file="$final_path/$app/.env" #================================================= ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action=start +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started plume" #================================================= # RELOAD NGINX diff --git a/scripts/install b/scripts/install index bc90df2..9a3b1cc 100755 --- a/scripts/install +++ b/scripts/install @@ -230,7 +230,7 @@ yunohost service add $app --description "$app daemon for XXX" --log "/var/log/$a #================================================= ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started plume" #================================================= # SETUP SSOWAT diff --git a/scripts/upgrade b/scripts/upgrade index 394b793..280001d 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,9 +24,6 @@ is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) -admin_email=$(ynh_app_setting_get --app=$app --key=admin_email) -secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) -name=$(ynh_app_setting_get --app=$app --key=name) port=$(ynh_app_setting_get --app=$app --key=port) architecture=$(ynh_detect_arch) @@ -91,6 +88,7 @@ ynh_print_info --message="Backing up the app before upgrading (may take a while) # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { + read -p "key" # restore it if the upgrade fails ynh_restore_upgradebackup ynh_clean_check_starting @@ -112,7 +110,7 @@ path_url=$(ynh_normalize_url_path --path_url=$path_url) #================================================= ynh_print_info --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action=stop +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped plume" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -124,6 +122,13 @@ then # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source "$final_path/$app" $architecture + + # Move binaries + mv $final_path/$app/bin/* $final_path/.cargo/bin/ + chmod +x $final_path/.cargo/bin/* + + # Remove empty bin directory + ynh_secure_remove --file="$final_path/$app/bin/" fi #================================================= @@ -225,7 +230,7 @@ fi #================================================= ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action=start +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started plume" #================================================= # RELOAD NGINX