1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/glitchsoc_ynh.git synced 2024-09-03 19:15:59 +02:00

Merge remote-tracking branch 'refs/remotes/YunoHost-Apps/master' into upgrade-from-pre-release

This commit is contained in:
nemsia 2017-07-13 00:27:17 +02:00
commit 60ae6587fe
7 changed files with 79 additions and 40 deletions

View file

@ -1,14 +1,18 @@
# Mastodon for YunoHost # 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.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) [![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) [![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) [![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.5.6_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) [![GitHub issues](https://img.shields.io/github/issues/YunoHost-Apps/mastodon_ynh.svg?style=flat)](https://github.com/YunoHost-Apps/mastodon_ynh/issues)
: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: Cette application utilise les packages backports de Debian, nous vous recommendons de ne pas installer cette application directement en production
: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 :warning: This application uses the Debian backports packages, do not install this application directly in production
## Mastodon c'est quoi ? ## Mastodon c'est quoi ?
@ -17,27 +21,35 @@ Mastodon est un réseau social gratuit et open source. Une alternative décentra
[Source code](https://github.com/tootsuite/mastodon) [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 ### 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 L'utilisateur admin est crée automatiquement comme: user@domain.tld
<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>
<del>**se connecter en sudo sur l'utilisateur**</del>
<del>`$ sudo su mastodon`</del>
<del>**se placer dans le répertoire où est installé Mastodon**</del>
<del>`$ cd /opt/mastodon/live`</del>
<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
#### Utilisation de __screen__ fortement recommandé
`$ sudo yunohost app upgrade --verbose mastodon -u https://github.com/YunoHost-Apps/mastodon_ynh.git` `$ sudo yunohost app upgrade --verbose mastodon -u https://github.com/YunoHost-Apps/mastodon_ynh.git`
@ -53,27 +65,34 @@ Mastodon is a free, open-source social network. A decentralized alternative to c
[Source code](https://github.com/tootsuite/mastodon) [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 ### Install
#### Using __screen__ in case of disconnect
`$ sudo yunohost app install https://github.com/YunoHost-Apps/mastodon_ynh.git` ```
$ 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 The admin user is automatically created as: user@domain.tld
<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>
<del>**sudo to the user**</del>
<del>`$ sudo su mastodon`</del>
<del>**change directory where Mastodon is installed**</del>
<del>`$ cd /opt/mastodon/live`</del>
<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
#### Using __screen__ highly recommended
`$ sudo yunohost app upgrade --verbose mastodon -u https://github.com/YunoHost-Apps/mastodon_ynh.git` `$ sudo yunohost app upgrade --verbose mastodon -u https://github.com/YunoHost-Apps/mastodon_ynh.git`

View file

@ -2,7 +2,7 @@
client_max_body_size 100M; client_max_body_size 100M;
# add to v1.4 assets # add to v1.4 assets
root /opt/mastodon/live/public; root __FINALPATH__/live/public;
location / { location / {

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.3.3", "version": "1.4.7",
"url": "https://github.com/tootsuite/mastodon", "url": "https://github.com/tootsuite/mastodon",
"license": "AGPL v3.0", "license": "AGPL v3.0",
"maintainer": { "maintainer": {

View file

@ -23,6 +23,9 @@ domain=$(ynh_app_setting_get "$app" domain)
final_path="/opt/${app}" final_path="/opt/${app}"
ynh_backup "$final_path" "sources" 1 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 # Copy the nginx conf files
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf" ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"
ynh_backup "/etc/cron.d/${app}" "cron.conf" ynh_backup "/etc/cron.d/${app}" "cron.conf"
@ -32,9 +35,13 @@ 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/backports.list" "apt_backports.list"
ynh_backup "/etc/apt/sources.list.d/yarn.list" "apt_yarn.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 # Backup db
sudo su - postgres <<COMMANDS sudo su - postgres <<COMMANDS
pg_dump --role=mastodon -U postgres --no-password mastodon_production > mastodon_db.sql pg_dump --role=mastodon -U postgres --no-password mastodon_production > mastodon_db.sql
COMMANDS COMMANDS
ynh_backup "/var/lib/postgresql/${app}_db.sql" "${app}_db.sql" 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

View file

@ -52,6 +52,13 @@ ynh_package_install postgresql postgresql-contrib
# Install Ruby # Install Ruby
ynh_package_install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev 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 # Install source.list debian package backports & yarn
sudo cp ../conf/backports.list /etc/apt/sources.list.d/ 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 curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
@ -206,7 +213,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 RAILS_ENV=production bin/bundle exec rails mastodon:confirm_email USER_EMAIL=$admin_mastodon_mail
ACOMMANDS 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 sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
# Install crontab # Install crontab

View file

@ -162,7 +162,9 @@ yarn install --pure-lockfile
#RAILS_ENV=production bin/bundle exec rails assets:precompile #RAILS_ENV=production bin/bundle exec rails assets:precompile
RCOMMANDS 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" sudo cp -a ./nginx.conf "$nginx_conf"
# Restore crontab # Restore crontab
sudo cp -a ./cron.conf "$crontab_conf" sudo cp -a ./cron.conf "$crontab_conf"

View file

@ -31,7 +31,7 @@ db_name=$app
# Modify Nginx configuration file and copy it to Nginx conf directory # 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@__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 sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
# Stop Mastodon Services # Stop Mastodon Services
@ -71,6 +71,8 @@ sudo su - $app <<COMMANDS
pushd ~/live pushd ~/live
bin/bundle install bin/bundle install
yarn install --pure-lockfile yarn install --pure-lockfile
# For 1.4.1 -> 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:clean
RAILS_ENV=production bundle exec rails assets:precompile RAILS_ENV=production bundle exec rails assets:precompile
RAILS_ENV=production bundle exec rails db:migrate RAILS_ENV=production bundle exec rails db:migrate