From cbbe9d3cc53f6b9445b592ca7949ffc2cfbc0055 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 10 May 2019 17:24:58 +0200 Subject: Add cache clear --- scripts/upgrade | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts/upgrade') diff --git a/scripts/upgrade b/scripts/upgrade index b90dddd..0cbd88a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -229,6 +229,7 @@ pushd "$final_path/live" sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.0/bin/bundle exec rails assets:clean sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.0/bin/bundle exec rails assets:precompile sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.0/bin/bundle exec rails db:migrate + sudo -u "$app" env PATH=$PATH RAILS_ENV=production bin/tootctl cache clear popd # If vapid_private_key doesn't exist, retrieve it or create it -- cgit v1.2.3-70-g09d2 From c8a9c0321297570867c4b7404f9693b709c9889b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 10 May 2019 17:28:21 +0200 Subject: upgrade to ruby 2.6.1 --- conf/cron | 2 +- conf/mastodon-sidekiq.service | 2 +- conf/mastodon-web.service | 2 +- scripts/install | 14 +++++++------- scripts/restore | 4 ++-- scripts/upgrade | 18 +++++++++--------- 6 files changed, 21 insertions(+), 21 deletions(-) (limited to 'scripts/upgrade') diff --git a/conf/cron b/conf/cron index 2c319fa..6463d70 100644 --- a/conf/cron +++ b/conf/cron @@ -1,2 +1,2 @@ RAILS_ENV=production -@daily cd __FINAL__PATH__/live && /opt/rbenv/versions/2.6.0/bin/bundle exec rake __USER__:media:remove_remote +@daily cd __FINAL__PATH__/live && /opt/rbenv/versions/2.6.1/bin/bundle exec rake __USER__:media:remove_remote diff --git a/conf/mastodon-sidekiq.service b/conf/mastodon-sidekiq.service index 920fcf4..cd7db81 100644 --- a/conf/mastodon-sidekiq.service +++ b/conf/mastodon-sidekiq.service @@ -9,7 +9,7 @@ Environment="RAILS_ENV=production" Environment="DB_POOL=25" Environment="MALLOC_ARENA_MAX=2" - ExecStart=/opt/rbenv/versions/2.6.0/bin/bundle exec sidekiq -c 25 + ExecStart=/opt/rbenv/versions/2.6.1/bin/bundle exec sidekiq -c 25 TimeoutSec=15 Restart=always StandardError=syslog diff --git a/conf/mastodon-web.service b/conf/mastodon-web.service index c95ba7f..d2f5fdd 100644 --- a/conf/mastodon-web.service +++ b/conf/mastodon-web.service @@ -8,7 +8,7 @@ WorkingDirectory=__FINALPATH__/live Environment="RAILS_ENV=production" Environment="PORT=__PORT_WEB__" - ExecStart=/opt/rbenv/versions/2.6.0/bin/bundle exec puma -C config/puma.rb + ExecStart=/opt/rbenv/versions/2.6.1/bin/bundle exec puma -C config/puma.rb ExecReload=/bin/kill -SIGUSR1 $MAINPID TimeoutSec=15 Restart=always diff --git a/scripts/install b/scripts/install index 337f7be..ac619f8 100644 --- a/scripts/install +++ b/scripts/install @@ -160,9 +160,9 @@ ynh_system_user_create $app $final_path # INSTALLING RUBY AND BUNDLER #================================================= -ynh_install_ruby --ruby_version=2.6.0 -/opt/rbenv/versions/2.6.0/bin/gem update --system -#/opt/rbenv/versions/2.6.0/bin/gem install bundler --no-document +ynh_install_ruby --ruby_version=2.6.1 +/opt/rbenv/versions/2.6.1/bin/gem update --system +#/opt/rbenv/versions/2.6.1/bin/gem install bundler --no-document #================================================= # MODIFY A CONFIG FILE @@ -199,12 +199,12 @@ chown -R "$app": "$final_path" pushd "$final_path/live" ynh_use_nodejs - sudo -u "$app" env PATH=$PATH /opt/rbenv/versions/2.6.0/bin/bundle install -j$(getconf _NPROCESSORS_ONLN) --deployment --without development test + sudo -u "$app" env PATH=$PATH /opt/rbenv/versions/2.6.1/bin/bundle install -j$(getconf _NPROCESSORS_ONLN) --deployment --without development test sudo -u "$app" env PATH=$PATH yarn install --pure-lockfile sudo -u "$app" echo "SAFETY_ASSURED=1">> .env.production - sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.0/bin/bundle exec rails db:migrate --quiet - sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.0/bin/bundle exec rails assets:precompile --quiet - sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.0/bin/bundle exec rake mastodon:webpush:generate_vapid_key > key.txt + sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.1/bin/bundle exec rails db:migrate --quiet + sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.1/bin/bundle exec rails assets:precompile --quiet + sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.1/bin/bundle exec rake mastodon:webpush:generate_vapid_key > key.txt sudo -u "$app" env PATH=$PATH RAILS_ENV=production bin/tootctl accounts create "$admin" --email="$admin_mail" --confirmed --role=admin > acc.txt popd diff --git a/scripts/restore b/scripts/restore index 6e39fb5..a31fa29 100644 --- a/scripts/restore +++ b/scripts/restore @@ -104,8 +104,8 @@ ynh_install_app_dependencies $pkg_dependencies # INSTALLING RUBY AND BUNDLER #================================================= -ynh_install_ruby --ruby_version=2.6.0 -/opt/rbenv/versions/2.6.0/bin/gem update --system +ynh_install_ruby --ruby_version=2.6.1 +/opt/rbenv/versions/2.6.1/bin/gem update --system #================================================= # RESTORE THE POSTGRESQL DATABASE diff --git a/scripts/upgrade b/scripts/upgrade index 0cbd88a..98b923f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -187,9 +187,9 @@ ynh_system_user_create $app # INSTALLING RUBY AND BUNDLER #================================================= -ynh_install_ruby --ruby_version=2.6.0 -/opt/rbenv/versions/2.6.0/bin/gem update --system -#/opt/rbenv/versions/2.6.0/bin/gem install bundler +ynh_install_ruby --ruby_version=2.6.1 +/opt/rbenv/versions/2.6.1/bin/gem update --system +#/opt/rbenv/versions/2.6.1/bin/gem install bundler #================================================= # MODIFY A CONFIG FILE @@ -221,20 +221,20 @@ chown -R "$app": "$final_path" pushd "$final_path/live" ynh_use_nodejs if [ "$(lsb_release --codename --short)" == "jessie" ]; then - sudo -u "$app" env PATH=$PATH /opt/rbenv/versions/2.6.0/bin/bundle install --deployment --without development test + sudo -u "$app" env PATH=$PATH /opt/rbenv/versions/2.6.1/bin/bundle install --deployment --without development test else - sudo -u "$app" env PATH=$PATH /opt/rbenv/versions/2.6.0/bin/bundle install --deployment --force --without development test + sudo -u "$app" env PATH=$PATH /opt/rbenv/versions/2.6.1/bin/bundle install --deployment --force --without development test fi sudo -u "$app" env PATH=$PATH yarn install --pure-lockfile - sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.0/bin/bundle exec rails assets:clean - sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.0/bin/bundle exec rails assets:precompile - sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.0/bin/bundle exec rails db:migrate + sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.1/bin/bundle exec rails assets:clean + sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.1/bin/bundle exec rails assets:precompile + sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.1/bin/bundle exec rails db:migrate sudo -u "$app" env PATH=$PATH RAILS_ENV=production bin/tootctl cache clear popd # If vapid_private_key doesn't exist, retrieve it or create it if [[ -z "$vapid_private_key" ]]; then - sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.0/bin/bundle exec rake mastodon:webpush:generate_vapid_key > key.txt + sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.1/bin/bundle exec rake mastodon:webpush:generate_vapid_key > key.txt vapid_private_key=$(grep -oP "VAPID_PRIVATE_KEY=\K\w+" "$final_path/live/key.txt") vapid_public_key=$(grep -oP "VAPID_PUBLIC_KEY=\K\w+" "$final_path/live/key.txt") ynh_app_setting_set "$app" vapid_private_key "$vapid_private_key" -- cgit v1.2.3-70-g09d2 From 80f60b149c9643917739511e4e041d02d9ecf335 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 10 May 2019 19:34:48 +0200 Subject: remove ruby before upgrade --- scripts/upgrade | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts/upgrade') diff --git a/scripts/upgrade b/scripts/upgrade index 98b923f..55c3b07 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -187,6 +187,7 @@ ynh_system_user_create $app # INSTALLING RUBY AND BUNDLER #================================================= +ynh_remove_ruby ynh_install_ruby --ruby_version=2.6.1 /opt/rbenv/versions/2.6.1/bin/gem update --system #/opt/rbenv/versions/2.6.1/bin/gem install bundler -- cgit v1.2.3-70-g09d2 From 9719db911b1cbd6c4ad06dc34c3295b87cfc43f3 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 10 May 2019 21:07:21 +0200 Subject: fix upgrade --- scripts/upgrade | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'scripts/upgrade') diff --git a/scripts/upgrade b/scripts/upgrade index b90dddd..53fcfb8 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -72,7 +72,7 @@ fi # If paperclip_secret doesn't exist, retrieve it or create it if [[ -z "$paperclip_secret" ]]; then - paperclip_secret=$(grep -oP "PAPERCLIP_SECRET=\K\w+" test) + paperclip_secret=$(grep -oP "PAPERCLIP_SECRET=\K\w+" ${final_path}/live/.env.production) if [[ -z "$paperclip_secret" ]]; then paperclip_secret=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128) fi @@ -81,7 +81,7 @@ fi # If secret_key_base doesn't exist, retrieve it or create it if [[ -z "$secret_key_base" ]]; then - secret_key_base=$(grep -oP "SECRET_KEY_BASE=\K\w+" test) + secret_key_base=$(grep -oP "SECRET_KEY_BASE=\K\w+" ${final_path}/live/.env.production) if [[ -z "$secret_key_base" ]]; then secret_key_base=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128) fi @@ -90,13 +90,21 @@ fi # If otp_secret doesn't exist, retrieve it or create it if [[ -z "$otp_secret" ]]; then - otp_secret=$(grep -oP "OTP_SECRET=\K\w+" test) + otp_secret=$(grep -oP "OTP_SECRET=\K\w+" ${final_path}/live/.env.production) if [[ -z "$otp_secret" ]]; then otp_secret=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128) fi ynh_app_setting_set "$app" otp_secret "$otp_secret" fi +# If vapid_private_key doesn't exist, retrieve it or create it +if [[ -z "$vapid_private_key" ]]; then + vapid_private_key=$(grep -oP "VAPID_PRIVATE_KEY=\K\w+" ${final_path}/live/.env.production) + vapid_public_key=$(grep -oP "VAPID_PUBLIC_KEY=\K\w+" ${final_path}/live/.env.production) + ynh_app_setting_set "$app" vapid_private_key "$vapid_private_key" + ynh_app_setting_set "$app" vapid_public_key "$vapid_public_key" +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -211,6 +219,9 @@ ynh_replace_string "__SECRET_KEY_BASE__" "$secret_key_base" "$final_path/live/.e ynh_replace_string "__OTP_SECRET__" "$otp_secret" "$final_path/live/.env.production" +ynh_replace_string "__VAPID_PRIVATE_KEY__" "$vapid_private_key" "$final_path/live/.env.production" +ynh_replace_string "__VAPID_PUBLIC_KEY__" "$vapid_public_key" "$final_path/live/.env.production" + #================================================= # UPGRADE MASTODON #================================================= @@ -239,6 +250,8 @@ if [[ -z "$vapid_private_key" ]]; then ynh_app_setting_set "$app" vapid_private_key "$vapid_private_key" ynh_app_setting_set "$app" vapid_public_key "$vapid_public_key" ynh_secure_remove "$final_path/live/key.txt" + ynh_replace_string "__VAPID_PRIVATE_KEY__" "$vapid_private_key" "${final_path}/live/.env.production" + ynh_replace_string "__VAPID_PUBLIC_KEY__" "$vapid_public_key" "${final_path}/live/.env.production" fi # Recalculate and store the checksum of the file for the next upgrade. -- cgit v1.2.3-70-g09d2 From 750402c9c2c8bca9c172b67a5e78d2788f211c04 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 10 May 2019 22:29:00 +0200 Subject: removing vapid_private_key --- scripts/upgrade | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'scripts/upgrade') diff --git a/scripts/upgrade b/scripts/upgrade index 53fcfb8..46e13a6 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -243,16 +243,16 @@ pushd "$final_path/live" popd # If vapid_private_key doesn't exist, retrieve it or create it -if [[ -z "$vapid_private_key" ]]; then - sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.0/bin/bundle exec rake mastodon:webpush:generate_vapid_key > key.txt - vapid_private_key=$(grep -oP "VAPID_PRIVATE_KEY=\K\w+" "$final_path/live/key.txt") - vapid_public_key=$(grep -oP "VAPID_PUBLIC_KEY=\K\w+" "$final_path/live/key.txt") - ynh_app_setting_set "$app" vapid_private_key "$vapid_private_key" - ynh_app_setting_set "$app" vapid_public_key "$vapid_public_key" - ynh_secure_remove "$final_path/live/key.txt" - ynh_replace_string "__VAPID_PRIVATE_KEY__" "$vapid_private_key" "${final_path}/live/.env.production" - ynh_replace_string "__VAPID_PUBLIC_KEY__" "$vapid_public_key" "${final_path}/live/.env.production" -fi +#if [[ -z "$vapid_private_key" ]]; then +# sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.0/bin/bundle exec rake mastodon:webpush:generate_vapid_key > key.txt +# vapid_private_key=$(grep -oP "VAPID_PRIVATE_KEY=\K\w+" "$final_path/live/key.txt") +# vapid_public_key=$(grep -oP "VAPID_PUBLIC_KEY=\K\w+" "$final_path/live/key.txt") +# ynh_app_setting_set "$app" vapid_private_key "$vapid_private_key" +# ynh_app_setting_set "$app" vapid_public_key "$vapid_public_key" +# ynh_secure_remove "$final_path/live/key.txt" +# ynh_replace_string "__VAPID_PRIVATE_KEY__" "$vapid_private_key" "${final_path}/live/.env.production" +# ynh_replace_string "__VAPID_PUBLIC_KEY__" "$vapid_public_key" "${final_path}/live/.env.production" +#fi # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum "${final_path}/live/.env.production" -- cgit v1.2.3-70-g09d2 From 74af5c0b9bdd3690b7e44eb60ffea5486588c3f8 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 11 May 2019 14:44:23 +0200 Subject: remove remove_ruby --- scripts/upgrade | 1 - 1 file changed, 1 deletion(-) (limited to 'scripts/upgrade') diff --git a/scripts/upgrade b/scripts/upgrade index 6b03cb7..405519e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -195,7 +195,6 @@ ynh_system_user_create $app # INSTALLING RUBY AND BUNDLER #================================================= -ynh_remove_ruby ynh_install_ruby --ruby_version=2.6.1 /opt/rbenv/versions/2.6.1/bin/gem update --system #/opt/rbenv/versions/2.6.1/bin/gem install bundler -- cgit v1.2.3-70-g09d2