From e8870da4b377fe6ef5671ff869b4f3c821ac6432 Mon Sep 17 00:00:00 2001 From: nemsia Date: Mon, 29 May 2017 13:32:23 +0200 Subject: [PATCH 1/9] [fix] Install and Upgrade to tag n-1 (#39) --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 1634c52..e747241 100644 --- a/scripts/install +++ b/scripts/install @@ -99,7 +99,7 @@ url=$(curl -s https://api.github.com/repos/tootsuite/mastodon/releases/latest | version=$(echo $url | cut -d/ -f8) sudo su - $app < Date: Mon, 29 May 2017 13:56:45 +0200 Subject: [PATCH 2/9] Update README and manifest to 1.4.1 --- README.md | 28 ---------------------------- manifest.json | 2 +- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/README.md b/README.md index fa352a0..0b213d0 100644 --- a/README.md +++ b/README.md @@ -23,20 +23,6 @@ Mastodon est un réseau social gratuit et open source. Une alternative décentra L'utilisateur admin est crée automatiquement comme: user@domain.tld -Une fois l'installation effectuée, vous pouvez créer un compte manuellement sur Mastodon depuis votre navigateur. Lorsque vous avez crée le premier utilisateur vous pouvez créer l'administrateur de votre Mastodon. Pour celà, il faut impérativement passer par une interface en ligne de commande et taper les commandes suivantes : - -**se connecter en sudo sur l'utilisateur** - -`$ sudo su mastodon` - -**se placer dans le répertoire où est installé Mastodon** - -`$ cd /opt/mastodon/live` - -**lancer la commande de création de l'administrateur** - -`$ RAILS_ENV=production bin/bundle exec rails mastodon:make_admin USERNAME=*Nom de votre utilisateur*` - ### Mise à jour `$ sudo yunohost app upgrade --verbose mastodon -u https://github.com/YunoHost-Apps/mastodon_ynh.git` @@ -59,20 +45,6 @@ Mastodon is a free, open-source social network. A decentralized alternative to c The admin user is automatically created as: user@domain.tld -After installation, you can create an account manually on Mastodon from your browser. When you have created the first user you can create the administrator of your Mastodon. For this, it is imperative to go through a command line and type the following commands: - -**sudo to the user** - -`$ sudo su mastodon` - -**change directory where Mastodon is installed** - -`$ cd /opt/mastodon/live` - -**launch the command to create the administrator** - -`$ RAILS_ENV=production bin/bundle exec rails mastodon:make_admin USERNAME=*username*` - ### Update `$ sudo yunohost app upgrade --verbose mastodon -u https://github.com/YunoHost-Apps/mastodon_ynh.git` diff --git a/manifest.json b/manifest.json index fa2886b..b096d4f 100644 --- a/manifest.json +++ b/manifest.json @@ -9,7 +9,7 @@ "en": "Mastodon is a free, open-source social network.", "fr": "Mastodon est un réseau social gratuit et open source." }, - "version": "1.3.3", + "version": "1.4.1", "url": "https://github.com/tootsuite/mastodon", "license": "AGPL v3.0", "maintainer": { From 165c4cd07d175e4618b761532a0376e845b89daa Mon Sep 17 00:00:00 2001 From: nemsia Date: Mon, 29 May 2017 14:07:19 +0200 Subject: [PATCH 3/9] Update version on badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0b213d0..e6aae5e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Mastodon for YunoHost -[![Latest Version](https://img.shields.io/badge/version-_--_-green.svg?style=flat)](https://github.com/YunoHost-Apps/mastodon_ynh/releases) +[![Latest Version](https://img.shields.io/badge/version-1.4.1-green.svg?style=flat)](https://github.com/YunoHost-Apps/mastodon_ynh/releases) [![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) From 7b5077419be7e5cc5f682fac3b80d23f565e6296 Mon Sep 17 00:00:00 2001 From: nemsia Date: Mon, 29 May 2017 21:24:43 +0200 Subject: [PATCH 4/9] [fix] upgrade and install 1.4.1 (#40) --- scripts/install | 5 ++--- scripts/upgrade | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index e747241..a4faed3 100644 --- a/scripts/install +++ b/scripts/install @@ -95,11 +95,10 @@ 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) +version=$(curl -s https://api.github.com/repos/tootsuite/mastodon/releases/latest | grep tag_name | cut -d\" -f4) sudo su - $app < Date: Wed, 31 May 2017 17:03:04 +0200 Subject: [PATCH 5/9] Add ARM Warning on README --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index e6aae5e..3cd6796 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,12 @@ [![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 ne fonctionne que sur x86, x86_64 et non sur ARM (Raspberry,Olimex,Labriqueinternet,...). T_T + :warning: Cette application utilise les packages backports de Debian, nous vous recommendons de ne pas installer cette application directement en production +:warning: This app work only on x86, x86_64 and not on ARM (Raspberry,Olimex,InternetCube,...). T_T + :warning: This application uses the Debian backports packages, do not install this application directly in production ## Mastodon c'est quoi ? From e438a0ab3eda6a63150ceaa983e1614836c07b70 Mon Sep 17 00:00:00 2001 From: nemsia Date: Wed, 7 Jun 2017 20:42:42 +0200 Subject: [PATCH 6/9] Fix install on arm (#42) * [fix] Missing pubkey on arm * [enh] Install on arm + update README --- README.md | 57 +++++++++++++++++++++++++++++++++++++++++++------ scripts/install | 7 ++++++ 2 files changed, 57 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 3cd6796..c985c53 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,11 @@ [![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 ne fonctionne que sur x86, x86_64 et non sur ARM (Raspberry,Olimex,Labriqueinternet,...). T_T +:warning: MAJ 05/06/17 :Cette application peut maintenant fonctionner sur ARM, mais l'installation prend plusieurs heures et il faut ajouter un swapfile de 1Go. :warning: Cette application utilise les packages backports de Debian, nous vous recommendons de ne pas installer cette application directement en production -:warning: This app work only on x86, x86_64 and not on ARM (Raspberry,Olimex,InternetCube,...). T_T +:warning: UPDATE 05/06/17 :This app can work now on ARM, but installation takes several hours and you must add a swapfile of 1GB. :warning: This application uses the Debian backports packages, do not install this application directly in production @@ -21,13 +21,35 @@ Mastodon est un réseau social gratuit et open source. Une alternative décentra [Source code](https://github.com/tootsuite/mastodon) +#### Ajout d'un "swapfile" si vous avez moins de 2Go de RAM +``` +sudo dd if=/dev/zero of=/swapfile bs=1024 count=1024000 +sudo chmod 600 /swapfile +sudo mkswap /swapfile +sudo swapon /swapfile +``` +ajouter cette ligne dans /etc/fstab +``` +/swapfile none swap sw 0 0 +``` + ### Installation -`$ sudo yunohost app install https://github.com/YunoHost-Apps/mastodon_ynh.git` - +#### Utilisation de __screen__ en cas de déconnection +``` +$ sudo apt-get install screen +$ screen +$ sudo yunohost app install https://github.com/YunoHost-Apps/mastodon_ynh.git +``` +Récuperer l'installation après une deconnection: +``` +$ screen -d +$ screen -r +``` L'utilisateur admin est crée automatiquement comme: user@domain.tld ### Mise à jour +#### Utilisation de __screen__ fortement recommandé `$ sudo yunohost app upgrade --verbose mastodon -u https://github.com/YunoHost-Apps/mastodon_ynh.git` @@ -43,13 +65,34 @@ Mastodon is a free, open-source social network. A decentralized alternative to c [Source code](https://github.com/tootsuite/mastodon) +#### Adding "swapfile" If you have less than 2Go of RAM +``` +sudo dd if=/dev/zero of=/swapfile bs=1024 count=1024000 +sudo chmod 600 /swapfile +sudo mkswap /swapfile +sudo swapon /swapfile +``` +add this line on /etc/fstab +``` +/swapfile none swap sw 0 0 +``` + ### Install - -`$ sudo yunohost app install https://github.com/YunoHost-Apps/mastodon_ynh.git` - +#### Using __screen__ in case of disconnect +``` +$ sudo apt-get install screen +$ screen +$ sudo yunohost app install https://github.com/YunoHost-Apps/mastodon_ynh.git +``` +Recover after disconnect: +``` +$ screen -d +$ screen -r +``` The admin user is automatically created as: user@domain.tld ### Update +#### Using __screen__ highly recommended `$ sudo yunohost app upgrade --verbose mastodon -u https://github.com/YunoHost-Apps/mastodon_ynh.git` diff --git a/scripts/install b/scripts/install index a4faed3..17a4573 100644 --- a/scripts/install +++ b/scripts/install @@ -52,6 +52,13 @@ ynh_package_install postgresql postgresql-contrib # Install Ruby ynh_package_install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev +# Import debian archive pubkey, need on ARM arch +arch=$(uname -m) +if [[ $arch = arm* ]]; then + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8B48AD6246925553 + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7638D0442B90D010 +fi + # Install source.list debian package backports & yarn sudo cp ../conf/backports.list /etc/apt/sources.list.d/ sudo curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - From d7b8bd7b23e3603c099bfff78be4a58926108e67 Mon Sep 17 00:00:00 2001 From: MCMic Date: Thu, 15 Jun 2017 10:47:06 +0200 Subject: [PATCH 7/9] Added needed line for 1.4.2 migration --- scripts/upgrade | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index a741c4d..4308838 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -72,6 +72,8 @@ sudo su - $app < 1.4.2 migration prepare_for_foreign_keys is needed +RAILS_ENV=production bundle exec rails mastodon:maintenance:prepare_for_foreign_keys 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 7cd6bc84ac242c38b719077a7ad5fcf23497421c Mon Sep 17 00:00:00 2001 From: nemsia Date: Sat, 8 Jul 2017 21:28:38 +0200 Subject: [PATCH 8/9] Fix backup fail on yunohost 2.6 + update mastodon version to 1.4.7 --- manifest.json | 2 +- scripts/backup | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index b096d4f..ccf281d 100644 --- a/manifest.json +++ b/manifest.json @@ -9,7 +9,7 @@ "en": "Mastodon is a free, open-source social network.", "fr": "Mastodon est un réseau social gratuit et open source." }, - "version": "1.4.1", + "version": "1.4.7", "url": "https://github.com/tootsuite/mastodon", "license": "AGPL v3.0", "maintainer": { diff --git a/scripts/backup b/scripts/backup index cc94aa4..d3bf424 100644 --- a/scripts/backup +++ b/scripts/backup @@ -37,4 +37,5 @@ sudo su - postgres < mastodon_db.sql COMMANDS ynh_backup "/var/lib/postgresql/${app}_db.sql" "${app}_db.sql" -ynh_secure_remove /var/lib/postgresql/mastodon_db.sql +# Fix backup fail on yunohost 2.6 +#ynh_secure_remove /var/lib/postgresql/mastodon_db.sql From 8711b925306be63d7b2b7669fe2ef3cf8ebdc476 Mon Sep 17 00:00:00 2001 From: nemsia Date: Thu, 13 Jul 2017 00:12:42 +0200 Subject: [PATCH 9/9] add __FINALPATH__ on Nginx conf (#46) * [enh] Final_path on nginx * [enh] final_path on nginx.conf * Merge remote-tracking branch 'refs/remotes/YunoHost-Apps/master' into nginx-conf # Conflicts: # scripts/restore * [fix] nginx path on backup * [fix] Error on final_path nginx * Version num in badge --- README.md | 2 +- conf/nginx.conf | 2 +- scripts/backup | 6 ++++++ scripts/install | 4 +++- scripts/restore | 4 +++- scripts/upgrade | 2 +- 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c985c53..2459580 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Mastodon for YunoHost -[![Latest Version](https://img.shields.io/badge/version-1.4.1-green.svg?style=flat)](https://github.com/YunoHost-Apps/mastodon_ynh/releases) +[![Latest Version](https://img.shields.io/badge/version-1.4.7-green.svg?style=flat)](https://github.com/YunoHost-Apps/mastodon_ynh/releases) [![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) diff --git a/conf/nginx.conf b/conf/nginx.conf index 85f883c..585109e 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,7 +2,7 @@ client_max_body_size 100M; # add to v1.4 assets -root /opt/mastodon/live/public; +root __FINALPATH__/live/public; location / { diff --git a/scripts/backup b/scripts/backup index d3bf424..e4a5bba 100644 --- a/scripts/backup +++ b/scripts/backup @@ -23,6 +23,9 @@ domain=$(ynh_app_setting_get "$app" domain) final_path="/opt/${app}" ynh_backup "$final_path" "sources" 1 +# final_path on nginx +sudo sed -i "s@$final_path@__FINALPATH__@g" /etc/nginx/conf.d/${domain}.d/${app}.conf + # Copy the nginx conf files ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf" ynh_backup "/etc/cron.d/${app}" "cron.conf" @@ -32,6 +35,9 @@ ynh_backup "/etc/systemd/system/mastodon-streaming.service" "systemd_streaming.s ynh_backup "/etc/apt/sources.list.d/backports.list" "apt_backports.list" ynh_backup "/etc/apt/sources.list.d/yarn.list" "apt_yarn.list" +# final_path on nginx +sudo sed -i "s@__FINALPATH__@$final_path@g" /etc/nginx/conf.d/${domain}.d/${app}.conf + # Backup db sudo su - postgres < mastodon_db.sql diff --git a/scripts/install b/scripts/install index 17a4573..f769a8b 100644 --- a/scripts/install +++ b/scripts/install @@ -214,7 +214,9 @@ RAILS_ENV=production bin/bundle exec rails mastodon:make_admin USERNAME=$admin_m RAILS_ENV=production bin/bundle exec rails mastodon:confirm_email USER_EMAIL=$admin_mastodon_mail ACOMMANDS -# Copy nginx config +# Modify Nginx configuration file and copy it to Nginx conf directory +sudo sed -i "s@__PATH__@$app@g" ../conf/nginx.conf* +sudo sed -i "s@__FINALPATH__@$final_path@g" ../conf/nginx.conf* sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf # Install crontab diff --git a/scripts/restore b/scripts/restore index 5860e2c..30666df 100644 --- a/scripts/restore +++ b/scripts/restore @@ -162,7 +162,9 @@ yarn install --pure-lockfile #RAILS_ENV=production bin/bundle exec rails assets:precompile RCOMMANDS -# Restore nginx configuration files +# Modify Nginx configuration file and copy it to Nginx conf directory +sudo sed -i "s@__PATH__@$app@g" ./nginx.conf +sudo sed -i "s@__FINALPATH__@$final_path@g" ./nginx.conf sudo cp -a ./nginx.conf "$nginx_conf" # Restore crontab sudo cp -a ./cron.conf "$crontab_conf" diff --git a/scripts/upgrade b/scripts/upgrade index 4308838..dae1d8d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -31,7 +31,7 @@ db_name=$app # Modify Nginx configuration file and copy it to Nginx conf directory sudo sed -i "s@__PATH__@$app@g" ../conf/nginx.conf* -sudo sed -i "s@__FINALPATH__@$final_path/@g" ../conf/nginx.conf* +sudo sed -i "s@__FINALPATH__@$final_path@g" ../conf/nginx.conf* sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf # Stop Mastodon Services