From 6e6f3cd38d0f589415ab71acd5c00d487f0b668e Mon Sep 17 00:00:00 2001 From: nemsia Date: Fri, 21 Apr 2017 14:29:37 +0200 Subject: [PATCH 01/22] Acl for Postgres user dump --- scripts/restore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index f754d81..80233af 100644 --- a/scripts/restore +++ b/scripts/restore @@ -81,6 +81,9 @@ sudo su -c "psql" postgres <<< \ sudo su -c "psql" postgres <<< \ "update pg_database set datistemplate='true' where datname='template1';" +# Acl for Postgres user dump +sudo setfacl -R -m u:postgres:r $YNH_APP_BACKUP_DIR || true + # Restore db ynh_psql_create_db_without_password "$app" sudo su - postgres < Date: Mon, 24 Apr 2017 23:52:44 +0200 Subject: [PATCH 02/22] [fix] Stop streaming service --- scripts/remove | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/remove b/scripts/remove index 6ddf97b..373d028 100644 --- a/scripts/remove +++ b/scripts/remove @@ -32,7 +32,7 @@ fi # Stop mastodon-sidekiq if [ -e "/etc/systemd/system/mastodon-streaming.service" ]; then echo "Delete systemd script" - sudo systemctl stop mastodon-sidekiq.streaming + sudo systemctl stop mastodon-streaming.service ynh_secure_remove "/etc/systemd/system/mastodon-streaming.service" sudo systemctl disable mastodon-streaming.service fi From 3604622ae5400c7d757943d70cf528904149dbdf Mon Sep 17 00:00:00 2001 From: nemsia Date: Tue, 25 Apr 2017 00:04:58 +0200 Subject: [PATCH 03/22] [fix] replace setfact by chmod --- scripts/restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index 80233af..a0498f0 100644 --- a/scripts/restore +++ b/scripts/restore @@ -82,7 +82,7 @@ sudo su -c "psql" postgres <<< \ "update pg_database set datistemplate='true' where datname='template1';" # Acl for Postgres user dump -sudo setfacl -R -m u:postgres:r $YNH_APP_BACKUP_DIR || true +sudo chmod o+r $YNH_APP_BACKUP_DIR/mastodon_db.sql || true # Restore db ynh_psql_create_db_without_password "$app" From fadf3e03b9361e04d55ca738fdff8ce7a71ac906 Mon Sep 17 00:00:00 2001 From: nemsia Date: Tue, 25 Apr 2017 12:46:21 +0200 Subject: [PATCH 04/22] [fix] Chmod .sql --- scripts/restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index a0498f0..c7e380c 100644 --- a/scripts/restore +++ b/scripts/restore @@ -82,7 +82,7 @@ sudo su -c "psql" postgres <<< \ "update pg_database set datistemplate='true' where datname='template1';" # Acl for Postgres user dump -sudo chmod o+r $YNH_APP_BACKUP_DIR/mastodon_db.sql || true +sudo chmod a+rx $YNH_APP_BACKUP_DIR/mastodon_db.sql || true # Restore db ynh_psql_create_db_without_password "$app" From d15d28745678bc9a9e9bf285988b83e3cb534bf4 Mon Sep 17 00:00:00 2001 From: nemsia Date: Tue, 25 Apr 2017 14:46:40 +0200 Subject: [PATCH 05/22] [fix] Acl backup directory --- scripts/restore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index c7e380c..414a5f5 100644 --- a/scripts/restore +++ b/scripts/restore @@ -82,7 +82,8 @@ sudo su -c "psql" postgres <<< \ "update pg_database set datistemplate='true' where datname='template1';" # Acl for Postgres user dump -sudo chmod a+rx $YNH_APP_BACKUP_DIR/mastodon_db.sql || true +sudo chmod a+rx $YNH_APP_BACKUP_DIR +sudo chmod a+rx $YNH_APP_BACKUP_DIR/mastodon_db.sql # Restore db ynh_psql_create_db_without_password "$app" From 5850d816620c8b6c1664f0c478321570591f9118 Mon Sep 17 00:00:00 2001 From: nemsia Date: Tue, 25 Apr 2017 21:21:11 +0200 Subject: [PATCH 06/22] [fix] Copy dump in $finalpath --- scripts/restore | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/restore b/scripts/restore index 414a5f5..f931f0d 100644 --- a/scripts/restore +++ b/scripts/restore @@ -81,16 +81,18 @@ sudo su -c "psql" postgres <<< \ sudo su -c "psql" postgres <<< \ "update pg_database set datistemplate='true' where datname='template1';" -# Acl for Postgres user dump -sudo chmod a+rx $YNH_APP_BACKUP_DIR -sudo chmod a+rx $YNH_APP_BACKUP_DIR/mastodon_db.sql +# Copy postgresql dump +sudo cp $YNH_APP_BACKUP_DIR/mastodon_db.sql $final_path # Restore db ynh_psql_create_db_without_password "$app" sudo su - postgres < Date: Wed, 26 Apr 2017 10:40:39 +0200 Subject: [PATCH 07/22] [fix] Chmod on backup/tmp --- scripts/restore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/restore b/scripts/restore index f931f0d..8d0df6a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -70,6 +70,8 @@ sudo cp -a ./sources "$final_path" # Set permissions sudo chown -R $app: "$final_path" +sudo chmod -R a+rx /home/yunohost.backup/tmp + # Set UTF8 encoding by default sudo su -c "psql" postgres <<< \ From ed08bd31ad591bbae6fbd66f910ccf0d129738ef Mon Sep 17 00:00:00 2001 From: nemsia Date: Wed, 26 Apr 2017 13:52:17 +0200 Subject: [PATCH 08/22] [fix] Add restart postgre --- scripts/restore | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/restore b/scripts/restore index 8d0df6a..65a4af8 100644 --- a/scripts/restore +++ b/scripts/restore @@ -88,6 +88,7 @@ sudo cp $YNH_APP_BACKUP_DIR/mastodon_db.sql $final_path # Restore db ynh_psql_create_db_without_password "$app" +sudo systemctl restart postgresql sudo su - postgres < Date: Wed, 26 Apr 2017 16:12:34 +0200 Subject: [PATCH 09/22] [fix] PG restore --- scripts/restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index 65a4af8..7820e04 100644 --- a/scripts/restore +++ b/scripts/restore @@ -90,7 +90,7 @@ sudo cp $YNH_APP_BACKUP_DIR/mastodon_db.sql $final_path ynh_psql_create_db_without_password "$app" sudo systemctl restart postgresql sudo su - postgres < Date: Thu, 27 Apr 2017 22:34:49 +0200 Subject: [PATCH 10/22] [enh] Install tagged release --- scripts/install | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install b/scripts/install index ed2b1e7..67e69b0 100644 --- a/scripts/install +++ b/scripts/install @@ -87,6 +87,8 @@ sudo su - $app < Date: Fri, 28 Apr 2017 11:42:08 +0200 Subject: [PATCH 11/22] [fix] Replace pushd by cd on upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 655f22f..076e3fb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -39,7 +39,7 @@ sudo systemctl stop mastodon-*.service # Update Mastodon sudo su - $app < Date: Fri, 28 Apr 2017 13:30:04 +0200 Subject: [PATCH 12/22] [enh] Install tagged releases --- scripts/install | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install b/scripts/install index ed2b1e7..67e69b0 100644 --- a/scripts/install +++ b/scripts/install @@ -87,6 +87,8 @@ sudo su - $app < Date: Fri, 28 Apr 2017 18:02:28 +0200 Subject: [PATCH 13/22] [fix] Install tagged release --- scripts/install | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 67e69b0..d58f08e 100644 --- a/scripts/install +++ b/scripts/install @@ -82,12 +82,13 @@ sudo su -c "psql" postgres <<< \ ynh_psql_create_db_without_password "$app" sudo systemctl restart postgresql -# Download all Ruby source +# Download all sources rbenv, ruby and mastodon +pushd $final_path/live sudo su - $app < Date: Fri, 28 Apr 2017 18:07:45 +0200 Subject: [PATCH 14/22] [fix] Upgrade on tagged release --- scripts/upgrade | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 076e3fb..bd9c46a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -38,8 +38,9 @@ sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf sudo systemctl stop mastodon-*.service # Update Mastodon +pushd /opt/mastodon/live sudo su - $app < Date: Fri, 28 Apr 2017 18:37:00 +0200 Subject: [PATCH 15/22] [fix] Error on upgrade with yarn.lock --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index bd9c46a..f909d05 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -45,7 +45,7 @@ git fetch git pull https://github.com/tootsuite/mastodon.git master git checkout $(git tag | tail -n 1) bin/bundle install -yarn install --production +yarn install --pure-lockfile RAILS_ENV=production bundle exec rails assets:clean RAILS_ENV=production bundle exec rails assets:precompile RAILS_ENV=production bundle exec rails db:migrate From 1e9438883eaacd698eafe2a62a8906c595328975 Mon Sep 17 00:00:00 2001 From: nemsia Date: Fri, 28 Apr 2017 18:54:02 +0200 Subject: [PATCH 16/22] upgrade on master --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index f909d05..e3afa94 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -43,7 +43,7 @@ sudo su - $app < Date: Sat, 29 Apr 2017 22:02:55 +0200 Subject: [PATCH 17/22] [FIX] Switch to tagged release --- scripts/install | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index d58f08e..55ab135 100644 --- a/scripts/install +++ b/scripts/install @@ -83,15 +83,16 @@ ynh_psql_create_db_without_password "$app" sudo systemctl restart postgresql # Download all sources rbenv, ruby and mastodon -pushd $final_path/live sudo su - $app < Date: Sat, 29 Apr 2017 22:05:18 +0200 Subject: [PATCH 18/22] [FIX] Upgrade with tagged release --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index e3afa94..f909d05 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -43,7 +43,7 @@ sudo su - $app < Date: Sat, 29 Apr 2017 23:48:37 +0200 Subject: [PATCH 19/22] [fix] Switch branch to tagged release --- scripts/upgrade | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index f909d05..117a95f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -37,13 +37,19 @@ sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf # Stop Mastodon Services sudo systemctl stop mastodon-*.service -# Update Mastodon -pushd /opt/mastodon/live -sudo su - $app < Date: Sat, 29 Apr 2017 23:50:30 +0200 Subject: [PATCH 20/22] [fix] Pushd --- scripts/upgrade | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/upgrade b/scripts/upgrade index 117a95f..d1f985e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -50,6 +50,7 @@ sudo git checkout $(git tag | tail -n 1) # Apply Mastodon upgrade sudo su - $app < Date: Sat, 29 Apr 2017 23:53:33 +0200 Subject: [PATCH 21/22] [fix] Restore with psql --- scripts/restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index 3f63380..965f6f0 100644 --- a/scripts/restore +++ b/scripts/restore @@ -104,7 +104,7 @@ RAILS_ENV=production bin/bundle exec rails assets:precompile RCOMMANDS # restore database -sudo pg_dump mastodon_production < $YNH_APP_BACKUP_DIR/mastodon_db.sql +sudo psql mastodon_production < $YNH_APP_BACKUP_DIR/mastodon_db.sql # Create symlink for ruby sudo ln -s /opt/mastodon/.rbenv/versions/2.4.1/bin/ruby /usr/bin/ruby || true From 96c72ba22523bd2485a08a111e9aadcb87344d53 Mon Sep 17 00:00:00 2001 From: nemsia Date: Sun, 30 Apr 2017 00:32:05 +0200 Subject: [PATCH 22/22] [fix] popd error --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index b6be33c..a633a5d 100644 --- a/scripts/install +++ b/scripts/install @@ -162,7 +162,7 @@ type rbenv BCOMMANDS # Add Services -pushd $(popd) +popd sudo cp ../conf/mastodon-web.service /etc/systemd/system/mastodon-web.service sudo chown root: /etc/systemd/system/mastodon-web.service