From e7ed942684dd6b2cb0be509878048a85d8642f8d Mon Sep 17 00:00:00 2001 From: nemsia Date: Sun, 30 Apr 2017 14:04:25 +0200 Subject: [PATCH 01/18] [enh] Switch to tagged release --- scripts/install | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index f5522df..3357c1d 100644 --- a/scripts/install +++ b/scripts/install @@ -85,13 +85,17 @@ 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 sudo su - $app < Date: Sun, 30 Apr 2017 14:24:02 +0200 Subject: [PATCH 02/18] [enh] Switch to tagged release on upgrade --- scripts/upgrade | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 07b3ee7..ab4bf58 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -37,12 +37,20 @@ sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf # Stop Mastodon Services sudo systemctl stop mastodon-*.service -# Update Mastodon -sudo su - $app < Date: Mon, 1 May 2017 21:26:46 +0200 Subject: [PATCH 03/18] [fix] Restore pg dump Restore pg dump with mastodon user. --- scripts/restore | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/restore b/scripts/restore index 1340796..a57a33f 100644 --- a/scripts/restore +++ b/scripts/restore @@ -101,8 +101,19 @@ RAILS_ENV=production bin/bundle exec rails db:migrate RAILS_ENV=production bin/bundle exec rails assets:precompile RCOMMANDS -# restore database -sudo psql mastodon_production < $YNH_APP_BACKUP_DIR/mastodon_db.sql +# copy database dump +sudo cp $YNH_APP_BACKUP_DIR/mastodon_db.sql $final_path +sudo chmod a+r $final_path/mastodon_db.sql + +# Restore database dump +sudo su - $app < Date: Mon, 1 May 2017 22:06:37 +0200 Subject: [PATCH 04/18] Change version on manifest --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 8b93539..af14f12 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.1.1", + "version": "1.3.2", "url": "https://github.com/tootsuite/mastodon", "license": "AGPL v3.0", "maintainer": { From 6d0d7a561a4bb3eb7d0e5d4cf53c488c88e07da0 Mon Sep 17 00:00:00 2001 From: nemsia Date: Sat, 6 May 2017 19:37:08 +0200 Subject: [PATCH 05/18] [fix] Change rm dump to ynh_secure_remove --- scripts/restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index a57a33f..500a9b1 100644 --- a/scripts/restore +++ b/scripts/restore @@ -113,7 +113,7 @@ psql mastodon_production < $final_path/mastodon_db.sql RECOMMANDS # Remove dump -sudo rm $final_path/mastodon_db.sql +ynh_secure_remove $final_path/mastodon_db.sql # Create symlink for ruby sudo ln -s /opt/mastodon/.rbenv/versions/2.4.1/bin/ruby /usr/bin/ruby || true From 133eeb1ceff07c323aeb1fdd795e37c5ce9ada5c Mon Sep 17 00:00:00 2001 From: nemsia Date: Sat, 6 May 2017 19:58:45 +0200 Subject: [PATCH 06/18] [fix] Upgrade from 1.3.3 Fix error: Your local changes to the following files would be overwritten by merge: .babelrc .dockerignore .editorconfig .env.production.sample .gitignore .rubocop.yml .travis.yml Capfile Dockerfile README.md Vagrantfile .... --- scripts/upgrade | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/upgrade b/scripts/upgrade index ab4bf58..672900f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -41,6 +41,7 @@ sudo systemctl stop mastodon-*.service sudo su - $app < Date: Sat, 6 May 2017 20:34:29 +0200 Subject: [PATCH 07/18] [fix] Owner of live --- scripts/upgrade | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 672900f..b5d1b31 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -37,6 +37,9 @@ sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf # Stop Mastodon Services sudo systemctl stop mastodon-*.service +# Change owner of live folder +sudo chown -R $app: $final_path/live + # Download Mastodon sudo su - $app < Date: Sat, 6 May 2017 22:30:44 +0200 Subject: [PATCH 08/18] [fix] Reinstall dependencies on restore --- scripts/restore | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/scripts/restore b/scripts/restore index 500a9b1..84a3faf 100644 --- a/scripts/restore +++ b/scripts/restore @@ -65,6 +65,36 @@ fi # Create user unix sudo adduser $app --home /opt/$app --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password --disabled-login +# Reinstall dependencies + # Install debian package + ynh_package_install imagemagick libpq-dev libxml2-dev libxslt1-dev file curl apt-transport-https + + # Install redis package + ynh_package_install redis-server redis-tools + + # Install postgresql + 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 + + # 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 - + sudo cp ../conf/yarn.list /etc/apt/sources.list.d/ + ynh_package_update + + # Install debian package backports + sudo apt-get -t jessie-backports -y install ffmpeg + + # Install de Node.js + pushd /opt + curl -sL https://deb.nodesource.com/setup_4.x | sudo bash - + sudo apt-get -y install nodejs + + # Install Yarn + ynh_package_install yarn + # Restore sources & data sudo cp -a ./sources/. "$final_path" From 39cde5408c542e5a643b662efcfe58c02d728679 Mon Sep 17 00:00:00 2001 From: nemsia Date: Sat, 6 May 2017 22:48:26 +0200 Subject: [PATCH 09/18] Return to home --- scripts/restore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/restore b/scripts/restore index 84a3faf..d9b7e9e 100644 --- a/scripts/restore +++ b/scripts/restore @@ -95,6 +95,9 @@ sudo adduser $app --home /opt/$app --gecos "First Last,RoomNumber,WorkPhone,Home # Install Yarn ynh_package_install yarn + # Return to home + popd + # Restore sources & data sudo cp -a ./sources/. "$final_path" From 9747afe4ec916ea8f2abe83686cad24bc63f722c Mon Sep 17 00:00:00 2001 From: nemsia Date: Sat, 6 May 2017 23:44:21 +0200 Subject: [PATCH 10/18] [fix] Jenkins upgrade error --- scripts/upgrade | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index b5d1b31..f19f3e7 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -62,6 +62,9 @@ RAILS_ENV=production bundle exec rails assets:precompile RAILS_ENV=production bundle exec rails db:migrate COMMANDS +# Restart Mastodon +sudo systemctl start mastodon-*.service + # Reload Nginx sudo systemctl reload nginx @@ -70,6 +73,3 @@ ynh_app_setting_set "$app" unprotected_uris "/" # Reload SSOwat configuration sudo yunohost app ssowatconf - -# Restart Mastodon -sudo systemctl start mastodon-*.service From 7529cf6210d384cfeb9310e9ca04c8c677ab35ec Mon Sep 17 00:00:00 2001 From: nemsia Date: Sun, 7 May 2017 00:23:22 +0200 Subject: [PATCH 11/18] Check .fonctions --- scripts/remove | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/remove b/scripts/remove index 373d028..1b2c405 100644 --- a/scripts/remove +++ b/scripts/remove @@ -3,6 +3,12 @@ # Exit on command errors and treat unset variables as an error set -u +if [ ! -e .fonctions ]; then + # Get file fonction if not been to the current directory + sudo cp ../settings/scripts/.fonctions ./.fonctions + sudo chmod a+rx .fonctions +fi + source .fonctions # Loads the generic functions usually used in the script # Source app helpers source /usr/share/yunohost/helpers From 941ed7b71c2852f9e4ab0eacc1023c2b9bd0481a Mon Sep 17 00:00:00 2001 From: nemsia Date: Sun, 7 May 2017 00:25:15 +0200 Subject: [PATCH 12/18] Remove unneeded comment --- scripts/restore | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/restore b/scripts/restore index d9b7e9e..10b4a19 100644 --- a/scripts/restore +++ b/scripts/restore @@ -106,8 +106,6 @@ sudo chown -R $app: "$final_path" sudo ls -alh "$final_path" -# Change directory for create user & database postgresql - # Set UTF8 encoding by default sudo su -c "psql" postgres <<< \ "update pg_database set datistemplate='false' where datname='template1';" From b72fba54be12399bdc5f3438a28864a486a76384 Mon Sep 17 00:00:00 2001 From: nemsia Date: Sun, 7 May 2017 00:29:36 +0200 Subject: [PATCH 13/18] Add apt lists to backup --- scripts/backup | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/backup b/scripts/backup index bb90997..d2a3c69 100644 --- a/scripts/backup +++ b/scripts/backup @@ -29,10 +29,12 @@ 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" "backports.list" +ynh_backup "/etc/apt/sources.list.d/yarn.list" "yarn.list" # Backup db 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 \ No newline at end of file +ynh_secure_remove /var/lib/postgresql/mastodon_db.sql From ade55f6ef2e36846d6bb2e720616f9c08675cde2 Mon Sep 17 00:00:00 2001 From: nemsia Date: Sun, 7 May 2017 00:30:50 +0200 Subject: [PATCH 14/18] Change .list name on backup --- scripts/backup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/backup b/scripts/backup index d2a3c69..cc94aa4 100644 --- a/scripts/backup +++ b/scripts/backup @@ -29,8 +29,8 @@ 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" "backports.list" -ynh_backup "/etc/apt/sources.list.d/yarn.list" "yarn.list" +ynh_backup "/etc/apt/sources.list.d/backports.list" "apt_backports.list" +ynh_backup "/etc/apt/sources.list.d/yarn.list" "apt_yarn.list" # Backup db sudo su - postgres < Date: Sun, 7 May 2017 14:18:57 +0200 Subject: [PATCH 15/18] Copy Apt .lists on restore --- scripts/restore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/restore b/scripts/restore index 10b4a19..f9861ff 100644 --- a/scripts/restore +++ b/scripts/restore @@ -79,9 +79,9 @@ sudo adduser $app --home /opt/$app --gecos "First Last,RoomNumber,WorkPhone,Home ynh_package_install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev # Install source.list debian package backports & yarn - sudo cp ../conf/backports.list /etc/apt/sources.list.d/ + sudo cp ./apt_backports.list /etc/apt/sources.list.d/backports.list sudo curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - - sudo cp ../conf/yarn.list /etc/apt/sources.list.d/ + sudo cp ./apt_yarn.list /etc/apt/sources.list.d/yarn.list ynh_package_update # Install debian package backports From 9f44a21786e33bd3934234d3ee58340c6113ab7a Mon Sep 17 00:00:00 2001 From: nemsia Date: Sun, 7 May 2017 22:08:24 +0200 Subject: [PATCH 16/18] version 1.3.3 on manifest --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index af14f12..fa2886b 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.2", + "version": "1.3.3", "url": "https://github.com/tootsuite/mastodon", "license": "AGPL v3.0", "maintainer": { From a4a3f5cce430684b26e81613dffc3b88a1c12a95 Mon Sep 17 00:00:00 2001 From: nemsia Date: Sun, 7 May 2017 22:23:01 +0200 Subject: [PATCH 17/18] Remove admin instructions + TODO --- README.md | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 1b295c4..2b4d9ea 100644 --- a/README.md +++ b/README.md @@ -21,19 +21,21 @@ Mastodon est un réseau social gratuit et open source. Une alternative décentra `$ sudo yunohost app install https://github.com/YunoHost-Apps/mastodon_ynh.git` -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 : +L'utilisateur admin est crée automatiquement comme: user@domain.tld -**se connecter en sudo sur l'utilisateur** +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 : -`$ sudo su mastodon` +**se connecter en sudo sur l'utilisateur** -**se placer dans le répertoire où est installé Mastodon** +`$ sudo su mastodon` -`$ cd /opt/mastodon/live` +**se placer dans le répertoire où est installé Mastodon** -**lancer la commande de création de l'administrateur** +`$ cd /opt/mastodon/live` -`$ RAILS_ENV=production bin/bundle exec rails mastodon:make_admin USERNAME=*Nom de votre utilisateur*` +**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 @@ -55,19 +57,21 @@ Mastodon is a free, open-source social network. A decentralized alternative to c `$ sudo yunohost app install https://github.com/YunoHost-Apps/mastodon_ynh.git` -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: +The admin user is automatically created as: user@domain.tld -**sudo to the user** +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 su mastodon` +**sudo to the user** -**change directory where Mastodon is installed** +`$ sudo su mastodon` -`$ cd /opt/mastodon/live` +**change directory where Mastodon is installed** -**launch the command to create the administrator** +`$ cd /opt/mastodon/live` -`$ RAILS_ENV=production bin/bundle exec rails mastodon:make_admin USERNAME=*username*` +**launch the command to create the administrator** + +`$ RAILS_ENV=production bin/bundle exec rails mastodon:make_admin USERNAME=*username*` ### Update @@ -83,5 +87,7 @@ It seems important to close the inscriptions for your Mastodon, so that it remai - [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) -- [ ] Fix restore -- [ ] Install from a release \ No newline at end of file +- [x] Fix restore +- [x] Install from a release +- [ ] Tune [Create automatic user](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Administration-guide.md#creating-users-while-registration-is-closed) +- [ ] Fix errors on jenkins From 70d41205f334c3ce1e8fa4a9715caa2d5ed6c0cb Mon Sep 17 00:00:00 2001 From: nemsia Date: Mon, 8 May 2017 11:06:33 +0200 Subject: [PATCH 18/18] [enh] Admin user creation tune (#25) * [fix] Password lengh check 9 to 8 * [enh] Use the email address from admin user * [fix] Confirm real admin mail * Check TODO * [fix] Warning password to 7 --- README.md | 3 ++- scripts/install | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2b4d9ea..c7583c4 100644 --- a/README.md +++ b/README.md @@ -89,5 +89,6 @@ It seems important to close the inscriptions for your Mastodon, so that it remai - [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 -- [ ] Tune [Create automatic user](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Administration-guide.md#creating-users-while-registration-is-closed) +- [x] Tune [Create automatic user](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Administration-guide.md#creating-users-while-registration-is-closed) +- [ ] Change SMTP settings - [ ] Fix errors on jenkins diff --git a/scripts/install b/scripts/install index 2fd4b23..7d060fd 100644 --- a/scripts/install +++ b/scripts/install @@ -15,6 +15,7 @@ TRAP_ON # Active trap to stop the script if an error is detected. domain=$YNH_APP_ARG_DOMAIN admin_mastodon=$YNH_APP_ARG_ADMIN +admin_mastodon_mail=$(ynh_user_get_info $admin_mastodon 'mail') admin_pass=$YNH_APP_ARG_PASSWD language=$YNH_APP_ARG_LANGUAGE @@ -33,8 +34,8 @@ ynh_app_setting_set $app admin $admin_mastodon ynh_app_setting_set $app pass $admin_pass ynh_app_setting_set $app language $language -[[ ${#admin_pass} -gt 8 ]] || ynh_die \ -"The password is too weak, it must be longer than 8 characters" +[[ ${#admin_pass} -gt 7 ]] || ynh_die \ +"The password is too weak, it must be longer than 7 characters" # Create user unix sudo adduser $app --home /opt/$app --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password --disabled-login @@ -190,14 +191,14 @@ sudo su - $app <