diff options
| author | nemsia <nemsia@nemsia.org> | 2018-08-31 00:13:03 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-31 00:13:03 +0200 |
| commit | 09a07f19c518c1555f7cb09fc0d84be7b55e74f1 (patch) | |
| tree | 217fd016f98ebb3ec6a33806a1c5bbcf82d9e87d /scripts/upgrade | |
| parent | 29399adc3d0049ddefe33a509e263d36881a31fe (diff) | |
| parent | 20fe4996b6fdee3d1ff341ad953f21af0474e109 (diff) | |
| download | mastodon_ynh-09a07f19c518c1555f7cb09fc0d84be7b55e74f1.tar.gz mastodon_ynh-09a07f19c518c1555f7cb09fc0d84be7b55e74f1.tar.bz2 mastodon_ynh-09a07f19c518c1555f7cb09fc0d84be7b55e74f1.zip | |
Merge branch 'develop' into patch-frju365
Diffstat (limited to 'scripts/upgrade')
| -rw-r--r-- | scripts/upgrade | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/scripts/upgrade b/scripts/upgrade index 15075a3..207858e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,6 +25,8 @@ admin=$(ynh_app_setting_get "$app" admin) language=$(ynh_app_setting_get "$app" language) final_path=$(ynh_app_setting_get "$app" final_path) path_url="/" +port_web=$(ynh_app_setting_get "$app" port_web) +port_stream=$(ynh_app_setting_get "$app" port_stream) #================================================= # ENSURE DOWNWARD COMPATIBILITY @@ -48,13 +50,13 @@ if [[ "$admin" = "" || "$language" = "" ]]; then ynh_die fi -# If db_pwd doesn't exist, create it +# If db_pwd doesn't exist, create it, need for old install if [[ -z "$db_pwd" ]]; then db_pwd=$(ynh_string_random) ynh_app_setting_set $app db_pwd $db_pwd ynh_psql_test_if_first_run sudo --login --user=postgres psql -c"ALTER user $app WITH PASSWORD '$db_pwd'" postgres - sed -i "s@DB_PASS=@DB_PASS=${db_pwd}@g" "${final_path}/live/.env.production" + ynh_replace_string "DB_PASS=" "DB_PASS=${db_pwd}" "${final_path}/live/.env.production" fi #================================================= @@ -86,14 +88,7 @@ echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.lis # INSTALL DEPENDENCIES #================================================= -# upgrade Node.js v4 to v6 -# TODO: use https://github.com/YunoHost-Apps/Experimental_helpers/blob/master/ynh_install_nodejs/ynh_install_nodejs -node_version=$(nodejs --version) -if [[ $node_version =~ ^v4.*$ ]]; then - pushd /opt - curl -sL https://deb.nodesource.com/setup_6.x | sudo bash - - sudo apt-get -y install nodejs -fi +ynh_install_nodejs 8 # add additional package for upgrade ynh_package_install pkg-config libprotobuf-dev protobuf-compiler libicu-dev libidn11-dev postgresql-server-dev-all @@ -112,9 +107,9 @@ yunohost service stop "$app-sidekiq" yunohost service stop "$app-streaming" # Download Mastodon -ynh_setup_source "$final_path/live" "app-mastodon" +ynh_setup_source "$final_path/live" "app-mastodon" -# Clean un-need Files +# Clean files which are not needed anymore ynh_secure_remove $final_path/live/config/initializers/timeout.rb #================================================= @@ -176,9 +171,25 @@ RAILS_ENV=production $final_path/.rbenv/versions/2.5.1/bin/bundle exec rails db: COMMANDS ) #================================================= -# RESTART MASTODON +# SETUP SYSTEMD +#================================================= + +# Create a dedicated systemd config +ynh_replace_string "__PORT_WEB__" "$port_web" "../conf/mastodon-web.service" +ynh_replace_string "__PORT_STREAM__" "$port_stream" "../conf/mastodon-streaming.service" +ynh_add_systemd_config "$app-web" "mastodon-web.service" +ynh_add_systemd_config "$app-sidekiq" "mastodon-sidekiq.service" +ynh_add_systemd_config "$app-streaming" "mastodon-streaming.service" + +#================================================= +# ADVERTISE SERVICE IN ADMIN PANEL #================================================= +# Add service YunoHost +yunohost service add "$app-web" +yunohost service add "$app-sidekiq" +yunohost service add "$app-streaming" + yunohost service start "$app-web" yunohost service start "$app-sidekiq" yunohost service start "$app-streaming" |
