1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/glitchsoc_ynh.git synced 2024-09-03 19:15:59 +02:00
* [enh] Switch to tagged release

* [enh] Switch to tagged release on upgrade

* [fix] Restore pg dump

Restore pg dump with mastodon user.

* Change version on manifest

* [fix] Change rm dump to ynh_secure_remove

* [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
        ....

* [fix] Owner of live

* [fix] Reinstall dependencies on restore

* Return to home

* [fix] Jenkins upgrade error

* Check .fonctions

* Remove unneeded comment

* Add apt lists to backup

* Change .list name on backup

* Copy Apt .lists on restore

* version 1.3.3 on manifest

* Remove admin instructions + TODO
This commit is contained in:
nemsia 2017-05-07 23:22:41 +02:00 committed by GitHub
parent f12507fbf0
commit 3d39136865
6 changed files with 71 additions and 26 deletions

View file

@ -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` `$ 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** <del>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 :</del>
`$ sudo su mastodon` <del>**se connecter en sudo sur l'utilisateur**</del>
**se placer dans le répertoire où est installé Mastodon** <del>`$ sudo su mastodon`</del>
`$ cd /opt/mastodon/live` <del>**se placer dans le répertoire où est installé Mastodon**</del>
**lancer la commande de création de l'administrateur** <del>`$ cd /opt/mastodon/live`</del>
`$ RAILS_ENV=production bin/bundle exec rails mastodon:make_admin USERNAME=*Nom de votre utilisateur*` <del>**lancer la commande de création de l'administrateur**</del>
<del>`$ RAILS_ENV=production bin/bundle exec rails mastodon:make_admin USERNAME=*Nom de votre utilisateur*`</del>
### Mise à jour ### 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` `$ 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** <del>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:</del>
`$ sudo su mastodon` <del>**sudo to the user**</del>
**change directory where Mastodon is installed** <del>`$ sudo su mastodon`</del>
`$ cd /opt/mastodon/live` <del>**change directory where Mastodon is installed**</del>
**launch the command to create the administrator** <del>`$ cd /opt/mastodon/live`</del>
`$ RAILS_ENV=production bin/bundle exec rails mastodon:make_admin USERNAME=*username*` <del>**launch the command to create the administrator**</del>
<del>`$ RAILS_ENV=production bin/bundle exec rails mastodon:make_admin USERNAME=*username*`</del>
### Update ### Update
@ -83,5 +87,7 @@ It seems important to close the inscriptions for your Mastodon, so that it remai
- [x] Fix upgrade - [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] [Create automatic user](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Administration-guide.md#creating-users-while-registration-is-closed)
- [ ] Fix restore - [x] Fix restore
- [ ] Install from a release - [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

View file

@ -9,7 +9,7 @@
"en": "Mastodon is a free, open-source social network.", "en": "Mastodon is a free, open-source social network.",
"fr": "Mastodon est un réseau social gratuit et open source." "fr": "Mastodon est un réseau social gratuit et open source."
}, },
"version": "1.1.1", "version": "1.3.3",
"url": "https://github.com/tootsuite/mastodon", "url": "https://github.com/tootsuite/mastodon",
"license": "AGPL v3.0", "license": "AGPL v3.0",
"maintainer": { "maintainer": {

View file

@ -29,6 +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-web.service" "systemd_web.service"
ynh_backup "/etc/systemd/system/mastodon-sidekiq.service" "systemd_sidekiq.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/systemd/system/mastodon-streaming.service" "systemd_streaming.service"
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 # Backup db
sudo su - postgres <<COMMANDS sudo su - postgres <<COMMANDS

View file

@ -3,6 +3,12 @@
# Exit on command errors and treat unset variables as an error # Exit on command errors and treat unset variables as an error
set -u 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 .fonctions # Loads the generic functions usually used in the script
# Source app helpers # Source app helpers
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers

View file

@ -65,6 +65,39 @@ fi
# Create user unix # Create user unix
sudo adduser $app --home /opt/$app --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password --disabled-login 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 ./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 ./apt_yarn.list /etc/apt/sources.list.d/yarn.list
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
# Return to home
popd
# Restore sources & data # Restore sources & data
sudo cp -a ./sources/. "$final_path" sudo cp -a ./sources/. "$final_path"
@ -74,8 +107,6 @@ sudo chown -R $app: "$final_path"
# Debug # Debug
sudo ls -alh "$final_path" sudo ls -alh "$final_path"
# Change directory for create user & database postgresql
# Set UTF8 encoding by default # Set UTF8 encoding by default
sudo su -c "psql" postgres <<< \ sudo su -c "psql" postgres <<< \
"update pg_database set datistemplate='false' where datname='template1';" "update pg_database set datistemplate='false' where datname='template1';"
@ -102,11 +133,11 @@ RAILS_ENV=production bin/bundle exec rails db:migrate
RAILS_ENV=production bin/bundle exec rails assets:precompile RAILS_ENV=production bin/bundle exec rails assets:precompile
RCOMMANDS RCOMMANDS
# copy database # copy database dump
sudo cp $YNH_APP_BACKUP_DIR/mastodon_db.sql $final_path sudo cp $YNH_APP_BACKUP_DIR/mastodon_db.sql $final_path
sudo chmod a+r $final_path/mastodon_db.sql sudo chmod a+r $final_path/mastodon_db.sql
# Restore database # Restore database dump
sudo su - $app <<RECOMMANDS sudo su - $app <<RECOMMANDS
dropdb mastodon_production dropdb mastodon_production
createdb mastodon_production createdb mastodon_production
@ -114,7 +145,7 @@ psql mastodon_production < $final_path/mastodon_db.sql
RECOMMANDS RECOMMANDS
# Remove dump # Remove dump
sudo rm $final_path/mastodon_db.sql ynh_secure_remove $final_path/mastodon_db.sql
# Create symlink for ruby # Create symlink for ruby
sudo ln -s /opt/mastodon/.rbenv/versions/2.4.1/bin/ruby /usr/bin/ruby || true sudo ln -s /opt/mastodon/.rbenv/versions/2.4.1/bin/ruby /usr/bin/ruby || true

View file

@ -62,6 +62,9 @@ RAILS_ENV=production bundle exec rails assets:precompile
RAILS_ENV=production bundle exec rails db:migrate RAILS_ENV=production bundle exec rails db:migrate
COMMANDS COMMANDS
# Restart Mastodon
sudo systemctl start mastodon-*.service
# Reload Nginx # Reload Nginx
sudo systemctl reload nginx sudo systemctl reload nginx
@ -70,6 +73,3 @@ ynh_app_setting_set "$app" unprotected_uris "/"
# Reload SSOwat configuration # Reload SSOwat configuration
sudo yunohost app ssowatconf sudo yunohost app ssowatconf
# Restart Mastodon
sudo systemctl start mastodon-*.service