mirror of
https://github.com/YunoHost-Apps/mastodon_ynh.git
synced 2024-09-03 19:46:02 +02:00
Merge remote-tracking branch 'refs/remotes/YunoHost-Apps/master'
This commit is contained in:
commit
890b3f2328
5 changed files with 69 additions and 35 deletions
12
README.md
12
README.md
|
@ -4,7 +4,7 @@
|
|||
[![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.4.2_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)
|
||||
|
||||
:warning: Cette application utilise les packages backports de Debian, nous vous recommendons de ne pas installer cette application directement en production
|
||||
|
@ -82,13 +82,3 @@ The admin user is automatically created as: user@domain.tld
|
|||
You can't install Mastodon in subdirectory, you must use a domain or subdomain for this application.
|
||||
|
||||
It seems important to close the inscriptions for your Mastodon, so that it remains a private body. We invite you to block remote malicious instances from the administration interface. You can also add text on your home page.
|
||||
|
||||
## TODO
|
||||
|
||||
- [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] Fix restore
|
||||
- [x] Install from a release
|
||||
- [x] Tune [Create automatic user](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Administration-guide.md#creating-users-while-registration-is-closed)
|
||||
- [x] Change SMTP settings
|
||||
- [ ] Fix errors on jenkins
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
# upload max size
|
||||
client_max_body_size 100M;
|
||||
|
||||
# add to v1.4 assets
|
||||
root /opt/mastodon/live/public;
|
||||
|
||||
location / {
|
||||
|
||||
if ($scheme = http) {
|
||||
|
@ -13,6 +16,12 @@ location / {
|
|||
include conf.d/yunohost_panel.conf.inc;
|
||||
}
|
||||
|
||||
# add to v1.4 assets
|
||||
location ~ ^/(assets|system/media_attachments/files|system/accounts/avatars) {
|
||||
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||
try_files $uri @proxy;
|
||||
}
|
||||
|
||||
location @proxy {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
|
|
@ -41,7 +41,7 @@ ynh_app_setting_set $app language $language
|
|||
sudo adduser $app --home /opt/$app --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password --disabled-login
|
||||
|
||||
# Install debian package
|
||||
ynh_package_install imagemagick libpq-dev libxml2-dev libxslt1-dev file curl apt-transport-https
|
||||
ynh_package_install imagemagick libpq-dev libxml2-dev libxslt1-dev file curl apt-transport-https pkg-config libprotobuf-dev protobuf-compiler
|
||||
|
||||
# Install redis package
|
||||
ynh_package_install redis-server redis-tools
|
||||
|
@ -66,7 +66,7 @@ ynh_app_setting_set $app final_path $final_path
|
|||
|
||||
# Install de Node.js
|
||||
pushd /opt
|
||||
curl -sL https://deb.nodesource.com/setup_4.x | sudo bash -
|
||||
curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
|
||||
sudo apt-get -y install nodejs
|
||||
|
||||
# Install Yarn
|
||||
|
@ -95,9 +95,11 @@ 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)
|
||||
sudo su - $app <<SWITCHCOMMANDS
|
||||
pushd ~/live
|
||||
git checkout $(git tag | tail -n 1)
|
||||
git checkout $version
|
||||
SWITCHCOMMANDS
|
||||
|
||||
# Be king rewind (/var/cache/yunohost/from_file/scripts)
|
||||
|
|
|
@ -67,7 +67,7 @@ sudo adduser $app --home /opt/$app --gecos "First Last,RoomNumber,WorkPhone,Home
|
|||
|
||||
# Reinstall dependencies
|
||||
# Install debian package
|
||||
ynh_package_install imagemagick libpq-dev libxml2-dev libxslt1-dev file curl apt-transport-https
|
||||
ynh_package_install imagemagick libpq-dev libxml2-dev libxslt1-dev file curl apt-transport-https pkg-config libprotobuf-dev protobuf-compiler
|
||||
|
||||
# Install redis package
|
||||
ynh_package_install redis-server redis-tools
|
||||
|
@ -89,7 +89,7 @@ sudo adduser $app --home /opt/$app --gecos "First Last,RoomNumber,WorkPhone,Home
|
|||
|
||||
# Install de Node.js
|
||||
pushd /opt
|
||||
curl -sL https://deb.nodesource.com/setup_4.x | sudo bash -
|
||||
curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
|
||||
sudo apt-get -y install nodejs
|
||||
|
||||
# Install Yarn
|
||||
|
@ -117,21 +117,23 @@ sudo su -c "psql" postgres <<< \
|
|||
sudo su -c "psql" postgres <<< \
|
||||
"update pg_database set datistemplate='true' where datname='template1';"
|
||||
|
||||
# Install rbenv
|
||||
sudo su - $app <<COMMANDS
|
||||
pushd ~/.rbenv
|
||||
src/configure && make -C src
|
||||
echo 'export PATH="/opt/mastodon/.rbenv/bin:/opt/mastodon/live/bin:$PATH"' >> ~/.profile
|
||||
echo 'export PATH="/opt/mastodon/.rbenv/bin:/opt/mastodon/live/bin:$PATH"' >> ~/.bashrc
|
||||
echo 'eval "\$(rbenv init -)"' >> ~/.profile
|
||||
COMMANDS
|
||||
|
||||
# Create user for db postgresql
|
||||
ynh_psql_create_db_without_password "$app"
|
||||
|
||||
# Setup database
|
||||
sudo su - $app <<SCOMMANDS
|
||||
cd ~/live
|
||||
RAILS_ENV=production bin/bundle exec rails db:setup
|
||||
SCOMMANDS
|
||||
|
||||
# Restore Mastodon
|
||||
sudo su - $app <<RCOMMANDS
|
||||
cd ~/live
|
||||
RAILS_ENV=production bin/bundle exec rails db:migrate
|
||||
RAILS_ENV=production bin/bundle exec rails assets:precompile
|
||||
RCOMMANDS
|
||||
#sudo su - $app <<SCOMMANDS
|
||||
#cd ~/live
|
||||
#RAILS_ENV=production bin/bundle exec rails db:setup
|
||||
#SCOMMANDS
|
||||
|
||||
# copy database dump
|
||||
sudo cp $YNH_APP_BACKUP_DIR/mastodon_db.sql $final_path
|
||||
|
@ -150,6 +152,16 @@ 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
|
||||
|
||||
# Upgrade Mastodon
|
||||
sudo su - $app <<RCOMMANDS
|
||||
cd ~/live
|
||||
bin/bundle install
|
||||
yarn install --pure-lockfile
|
||||
#RAILS_ENV=production bin/bundle exec rails db:migrate
|
||||
#RAILS_ENV=production bundle exec rails assets:clean
|
||||
#RAILS_ENV=production bin/bundle exec rails assets:precompile
|
||||
RCOMMANDS
|
||||
|
||||
# Restore nginx configuration files
|
||||
sudo cp -a ./nginx.conf "$nginx_conf"
|
||||
# Restore crontab
|
||||
|
|
|
@ -40,6 +40,14 @@ sudo systemctl stop mastodon-*.service
|
|||
# Change owner of live folder
|
||||
sudo chown -R $app: $final_path/live
|
||||
|
||||
# upgrade Node.js v4 to v6
|
||||
node_version=$(nodejs --version)
|
||||
if [[ $node_version =~ ^v4.*$ ]]; then
|
||||
pushd /opt
|
||||
curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
|
||||
sudo apt-get -y install nodejs
|
||||
fi
|
||||
|
||||
# Download Mastodon
|
||||
sudo su - $app <<PULLCOMMANDS
|
||||
pushd ~/live
|
||||
|
@ -50,11 +58,24 @@ PULLCOMMANDS
|
|||
|
||||
# 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)
|
||||
sudo su - $app <<SWITCHCOMMANDS
|
||||
pushd ~/live
|
||||
git checkout $(git tag | tail -n 1)
|
||||
git checkout $version
|
||||
SWITCHCOMMANDS
|
||||
|
||||
# upgrade Node.js v4 to v6
|
||||
node_version=$(nodejs --version)
|
||||
if [[ $node_version =~ ^v4.*$ ]]; then
|
||||
pushd /opt
|
||||
curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
|
||||
sudo apt-get -y install nodejs
|
||||
fi
|
||||
|
||||
# add additional package for release 1.4
|
||||
ynh_package_install pkg-config libprotobuf-dev protobuf-compiler
|
||||
|
||||
# Apply Mastodon upgrade
|
||||
sudo su - $app <<COMMANDS
|
||||
pushd ~/live
|
||||
|
|
Loading…
Reference in a new issue