From 64d3147a7b68f9e94f231b9a8aa6e9199b2824aa Mon Sep 17 00:00:00 2001 From: nemsia Date: Thu, 31 May 2018 13:41:03 +0200 Subject: [PATCH] Yunohost 3.0 Stretch app upgrade (#85) * Ready to Debian Stretch * rb 2.5.1 on install * Yarn install on root * Ready to mastodon 2.4.1 --- README.md | 4 ++-- manifest.json | 2 +- scripts/backup | 7 +++--- scripts/install | 44 +++++++++++++++++++++++------------ scripts/remove | 15 +++++------- scripts/restore | 61 +++++++++++++++++++++++++++++++------------------ scripts/upgrade | 8 +++---- 7 files changed, 85 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index 103ebcd..488481d 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # Mastodon for YunoHost -[![Latest Version](https://img.shields.io/badge/version-2.4.0-green.svg?style=flat)](https://github.com/YunoHost-Apps/mastodon_ynh/releases) +[![Latest Version](https://img.shields.io/badge/version-2.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) -[![Yunohost version](https://img.shields.io/badge/yunohost-2.7.7_tested-orange.svg?style=flat)](https://github.com/YunoHost/yunohost) +[![Yunohost version](https://img.shields.io/badge/yunohost-2.7.12_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) [![Install Mastodon with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=mastodon) diff --git a/manifest.json b/manifest.json index 2952e49..8bf61fe 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": "2.4.0", + "version": "2.4.1", "url": "https://github.com/tootsuite/mastodon", "license": "AGPL v3.0", "maintainer": { diff --git a/scripts/backup b/scripts/backup index e4a5bba..b7ff222 100644 --- a/scripts/backup +++ b/scripts/backup @@ -32,7 +32,10 @@ ynh_backup "/etc/cron.d/${app}" "cron.conf" ynh_backup "/etc/systemd/system/mastodon-web.service" "systemd_web.service" ynh_backup "/etc/systemd/system/mastodon-sidekiq.service" "systemd_sidekiq.service" ynh_backup "/etc/systemd/system/mastodon-streaming.service" "systemd_streaming.service" -ynh_backup "/etc/apt/sources.list.d/backports.list" "apt_backports.list" +debian_version=$(lsb_release -c -s) +if [[ $debian_version = jessie ]]; then + ynh_backup "/etc/apt/sources.list.d/backports.list" "apt_backports.list" +fi ynh_backup "/etc/apt/sources.list.d/yarn.list" "apt_yarn.list" # final_path on nginx @@ -43,5 +46,3 @@ sudo su - postgres < mastodon_db.sql COMMANDS ynh_backup "/var/lib/postgresql/${app}_db.sql" "${app}_db.sql" -# Fix backup fail on yunohost 2.6 -#ynh_secure_remove /var/lib/postgresql/mastodon_db.sql diff --git a/scripts/install b/scripts/install index 3d5172f..d92e0ed 100644 --- a/scripts/install +++ b/scripts/install @@ -47,7 +47,7 @@ ynh_package_install imagemagick libpq-dev libxml2-dev libxslt1-dev file curl apt ynh_package_install redis-server redis-tools # Install postgresql -ynh_package_install postgresql postgresql-contrib postgresql-server-dev-9.4 +ynh_package_install postgresql postgresql-contrib postgresql-server-dev-all # Install Ruby ynh_package_install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev @@ -59,14 +59,23 @@ if [[ $arch = arm* ]]; then 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/ +# Install source.list debian yarn package sudo curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - sudo cp ../conf/yarn.list /etc/apt/sources.list.d/ -ynh_package_update -# Install debian package backports +# Install source.list debian jessie package backports +debian_version=$(lsb_release -c -s) +if [[ $debian_version = jessie ]]; then +sudo cp ../conf/backports.list /etc/apt/sources.list.d/ +ynh_package_update sudo apt-get -t jessie-backports -y install ffmpeg +else +ynh_package_update +ynh_package_install ffmpeg +fi + +# Install Yarn +ynh_package_install yarn # Creates the destination directory and stores its location. ynh_app_setting_set $app final_path $final_path @@ -76,9 +85,6 @@ pushd /opt curl -sL https://deb.nodesource.com/setup_6.x | sudo bash - sudo apt-get -y install nodejs -# Install Yarn -ynh_package_install yarn - # Set UTF8 encoding by default sudo su -c "psql" postgres <<< \ "update pg_database set datistemplate='false' where datname='template1';" @@ -122,22 +128,26 @@ COMMANDS # Install ruby-build sudo su - $app <> .env.production RAILS_ENV=production bin/bundle exec rails db:setup -RAILS_ENV=production bin/bundle exec rails --trace assets:precompile CCOMMANDS +# Rails precompile on root +pushd $final_path/live +RAILS_ENV=production bin/bundle exec rails --trace assets:precompile +popd + # init rbenv & create bundle sudo su - $app <