From 13cad968d88c7fbe519e4ce232844eb62424a478 Mon Sep 17 00:00:00 2001 From: magikcypress Date: Sun, 21 May 2017 15:05:54 +0200 Subject: [PATCH 01/11] [fix] add additional package for release 1.4 #30 --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 0c71505..8772b18 100644 --- a/scripts/install +++ b/scripts/install @@ -41,7 +41,7 @@ ynh_app_setting_set $app language $language sudo adduser $app --home /opt/$app --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password --disabled-login # Install debian package -ynh_package_install imagemagick libpq-dev libxml2-dev libxslt1-dev file curl apt-transport-https +ynh_package_install imagemagick libpq-dev libxml2-dev libxslt1-dev file curl apt-transport-https pkg-config libprotobuf-dev protobuf-compiler # Install redis package ynh_package_install redis-server redis-tools From a074e13ef5da22c5880d31e37c7793d6c6c42b04 Mon Sep 17 00:00:00 2001 From: magikcypress Date: Sun, 21 May 2017 15:17:07 +0200 Subject: [PATCH 02/11] [fix] update node version to 6 #29 --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 8772b18..ebe4569 100644 --- a/scripts/install +++ b/scripts/install @@ -66,7 +66,7 @@ ynh_app_setting_set $app final_path $final_path # Install de Node.js pushd /opt -curl -sL https://deb.nodesource.com/setup_4.x | sudo bash - +curl -sL https://deb.nodesource.com/setup_6.x | sudo bash - sudo apt-get -y install nodejs # Install Yarn From c7eb4ace251956c4ef69a3b4478c8611aab442fc Mon Sep 17 00:00:00 2001 From: nemsia Date: Sun, 21 May 2017 15:23:14 +0200 Subject: [PATCH 03/11] Upgrade with latest stable version (#31) * [enh] Upgrade on latest Upgrade with latest mastodon stable version --- scripts/upgrade | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index f070bbd..d217de6 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -50,9 +50,11 @@ PULLCOMMANDS # Switch branch to tagged release cd $final_path/live +url=$(curl -s https://api.github.com/repos/tootsuite/mastodon/releases/latest | sort -r | head -1 | cut -d\" -f4) +version=$(echo $url | cut -d/ -f8) sudo su - $app < Date: Sun, 21 May 2017 17:02:13 +0200 Subject: [PATCH 04/11] [fix] upgrade ndeojs version --- scripts/upgrade | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index d217de6..4038fa7 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -40,6 +40,14 @@ sudo systemctl stop mastodon-*.service # Change owner of live folder sudo chown -R $app: $final_path/live +# upgrade Node.js v4 to v6 +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 + # Download Mastodon sudo su - $app < Date: Sun, 21 May 2017 17:48:52 +0200 Subject: [PATCH 05/11] [fix] Install lastest release --- scripts/install | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index ebe4569..1634c52 100644 --- a/scripts/install +++ b/scripts/install @@ -95,9 +95,11 @@ CLONECOMMANDS # Switch branch to tagged release cd $final_path/live +url=$(curl -s https://api.github.com/repos/tootsuite/mastodon/releases/latest | sort -r | head -1 | cut -d\" -f4) +version=$(echo $url | cut -d/ -f8) sudo su - $app < Date: Mon, 22 May 2017 00:42:09 +0200 Subject: [PATCH 06/11] Fix upgrade 1.4 (#33) * [fix] Upgrade nodejs + conf protobuf Fix mastodon 1.4 upgrade --- conf/nginx.conf | 9 +++++++++ scripts/upgrade | 13 ++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 0d48dc5..85f883c 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,6 +1,9 @@ # upload max size client_max_body_size 100M; +# add to v1.4 assets +root /opt/mastodon/live/public; + location / { if ($scheme = http) { @@ -13,6 +16,12 @@ location / { include conf.d/yunohost_panel.conf.inc; } +# add to v1.4 assets +location ~ ^/(assets|system/media_attachments/files|system/accounts/avatars) { + add_header Cache-Control "public, max-age=31536000, immutable"; + try_files $uri @proxy; + } + location @proxy { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; diff --git a/scripts/upgrade b/scripts/upgrade index 4038fa7..2a9b0fe 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -40,7 +40,7 @@ sudo systemctl stop mastodon-*.service # Change owner of live folder sudo chown -R $app: $final_path/live -# upgrade Node.js v4 to v6 +# upgrade Node.js v4 to v6 node_version=$(nodejs --version) if [[ $node_version =~ ^v4.*$ ]]; then pushd /opt @@ -65,6 +65,17 @@ pushd ~/live git checkout $version SWITCHCOMMANDS +# upgrade Node.js v4 to v6 +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 + +# add additional package for release 1.4 +ynh_package_install pkg-config libprotobuf-dev protobuf-compiler + # Apply Mastodon upgrade sudo su - $app < Date: Mon, 22 May 2017 15:01:37 +0200 Subject: [PATCH 07/11] [fix] Readme ynh version 2.5.6 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 725c9ef..08c19aa 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Status](https://img.shields.io/badge/status-testing-yellow.svg?style=flat)](https://github.com/YunoHost-Apps/mastodon_ynh/milestones) [![Dependencies](https://img.shields.io/badge/dependencies-includes-lightgrey.svg?style=flat)](https://github.com/YunoHost-Apps/mastodon_ynh#dependencies) [![GitHub license](https://img.shields.io/badge/license-GPLv3-blue.svg?style=flat)](https://raw.githubusercontent.com/YunoHost-Apps/mastodon_ynh/master/LICENSE) -[![Yunohost version](https://img.shields.io/badge/yunohost-2.4.2_tested-orange.svg?style=flat)](https://github.com/YunoHost/yunohost) +[![Yunohost version](https://img.shields.io/badge/yunohost-2.5.6_tested-orange.svg?style=flat)](https://github.com/YunoHost/yunohost) [![GitHub issues](https://img.shields.io/github/issues/YunoHost-Apps/mastodon_ynh.svg?style=flat)](https://github.com/YunoHost-Apps/mastodon_ynh/issues) :warning: Cette application utilise les packages backports de Debian, nous vous recommendons de ne pas installer cette application directement en production From ca180ba2517dc9b6f32aa9f8264b46a023635039 Mon Sep 17 00:00:00 2001 From: nemsia Date: Mon, 22 May 2017 17:07:21 +0200 Subject: [PATCH 08/11] [enh] Remove TODO TODO moved to projects repo page --- README.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/README.md b/README.md index 08c19aa..fa352a0 100644 --- a/README.md +++ b/README.md @@ -82,13 +82,3 @@ The admin user is automatically created as: user@domain.tld You can't install Mastodon in subdirectory, you must use a domain or subdomain for this application. It seems important to close the inscriptions for your Mastodon, so that it remains a private body. We invite you to block remote malicious instances from the administration interface. You can also add text on your home page. - -## TODO - -- [x] Fix upgrade -- [x] [Create automatic user](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Administration-guide.md#creating-users-while-registration-is-closed) -- [x] Fix restore -- [x] Install from a release -- [x] Tune [Create automatic user](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Administration-guide.md#creating-users-while-registration-is-closed) -- [x] Change SMTP settings -- [ ] Fix errors on jenkins From eabe291999e71c199dcc167834263017b26874d2 Mon Sep 17 00:00:00 2001 From: nemsia Date: Thu, 25 May 2017 00:07:57 +0200 Subject: [PATCH 09/11] [fix] Restore dependencies --- scripts/restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index 3a2eeaf..e0969ee 100644 --- a/scripts/restore +++ b/scripts/restore @@ -67,7 +67,7 @@ sudo adduser $app --home /opt/$app --gecos "First Last,RoomNumber,WorkPhone,Home # Reinstall dependencies # Install debian package - ynh_package_install imagemagick libpq-dev libxml2-dev libxslt1-dev file curl apt-transport-https + ynh_package_install imagemagick libpq-dev libxml2-dev libxslt1-dev file curl apt-transport-https pkg-config libprotobuf-dev protobuf-compiler # Install redis package ynh_package_install redis-server redis-tools From 77a80d633c49963e2de3c4f9f97b2afd6cc9f713 Mon Sep 17 00:00:00 2001 From: nemsia Date: Thu, 25 May 2017 14:09:20 +0200 Subject: [PATCH 10/11] [fix] Nodejs 6 on restore --- scripts/restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index e0969ee..84828b1 100644 --- a/scripts/restore +++ b/scripts/restore @@ -89,7 +89,7 @@ sudo adduser $app --home /opt/$app --gecos "First Last,RoomNumber,WorkPhone,Home # Install de Node.js pushd /opt - curl -sL https://deb.nodesource.com/setup_4.x | sudo bash - + curl -sL https://deb.nodesource.com/setup_6.x | sudo bash - sudo apt-get -y install nodejs # Install Yarn From 097bd9dec81c64fe8830a8fe7863451056e13def Mon Sep 17 00:00:00 2001 From: nemsia Date: Fri, 26 May 2017 21:20:07 +0200 Subject: [PATCH 11/11] Fix restore 1.4 (#38) * [fix] Remove db:setup * [enh] add install rben on restore * [enh] Remove asset:precompile and db:migrate on restore * [enh] bundle and yarn install on restore --- scripts/restore | 48 ++++++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/scripts/restore b/scripts/restore index 84828b1..5860e2c 100644 --- a/scripts/restore +++ b/scripts/restore @@ -35,30 +35,30 @@ fi # Check configuration files nginx nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf" if [ -f $nginx_conf ]; then - ynh_die "The NGINX configuration already exists at '${nginx_conf}'. + ynh_die "The NGINX configuration already exists at '${nginx_conf}'. You should safely delete it before restoring this app." fi # Check configuration files php-fpm crontab_conf="/etc/cron.d/${app}" -if [ -f $crontab_conf ]; then - ynh_die "The CRONTAB configuration already exists at '${crontab_conf}'. +if [ -f $crontab_conf ]; then + ynh_die "The CRONTAB configuration already exists at '${crontab_conf}'. You should safely delete it before restoring this app." fi # Restore services web_systemd="/etc/systemd/system/${app}-web.service" if [ -f "${web_systemd}" ]; then - ynh_die "The MASTODON WEB configuration already exists at '${web_systemd}'. + ynh_die "The MASTODON WEB configuration already exists at '${web_systemd}'. You should safely delete it before restoring this app." fi sidekiq_systemd="/etc/systemd/system/${app}-sidekiq.service" if [ -f "${sidekiq_systemd}" ]; then - ynh_die "The MASTODON SIDEKIQ configuration already exists at '${sidekiq_systemd}'. + ynh_die "The MASTODON SIDEKIQ configuration already exists at '${sidekiq_systemd}'. You should safely delete it before restoring this app." fi streaming_systemd="/etc/systemd/system/${app}-streaming.service" if [ -f "${streaming_systemd}" ]; then - ynh_die "The MASTODON STREAMING configuration already exists at '${streaming_systemd}'. + ynh_die "The MASTODON STREAMING configuration already exists at '${streaming_systemd}'. You should safely delete it before restoring this app." fi @@ -97,7 +97,7 @@ sudo adduser $app --home /opt/$app --gecos "First Last,RoomNumber,WorkPhone,Home # Return to home popd - + # Restore sources & data sudo cp -a ./sources/. "$final_path" @@ -117,21 +117,23 @@ sudo su -c "psql" postgres <<< \ sudo su -c "psql" postgres <<< \ "update pg_database set datistemplate='true' where datname='template1';" +# Install rbenv +sudo su - $app <> ~/.profile +echo 'export PATH="/opt/mastodon/.rbenv/bin:/opt/mastodon/live/bin:$PATH"' >> ~/.bashrc +echo 'eval "\$(rbenv init -)"' >> ~/.profile +COMMANDS + # Create user for db postgresql ynh_psql_create_db_without_password "$app" # Setup database -sudo su - $app <