mirror of
https://github.com/YunoHost-Apps/mastodon_ynh.git
synced 2024-09-03 19:46:02 +02:00
[fix] Add release mastodon 1.1.1
This commit is contained in:
parent
4dfe275942
commit
8d75549471
6 changed files with 63 additions and 10 deletions
|
@ -89,6 +89,27 @@ FIND_PORT () { # Search free port
|
|||
CHECK_VAR "$port" "port empty"
|
||||
}
|
||||
|
||||
SETUP_SOURCE () { # Download source, decompress and copu into $final_path
|
||||
src=$(cat ../sources/source_md5 | awk -F' ' {'print $2'})
|
||||
sudo wget -nv -i ../sources/source_url -O $src
|
||||
# Checks the checksum of the downloaded source.
|
||||
# md5sum -c ../sources/source_md5 --status || ynh_die "Corrupt source"
|
||||
# Decompress source
|
||||
if [ "$(echo ${src##*.})" == "tgz" ]; then
|
||||
tar -x -f $src
|
||||
elif [ "$(echo ${src##*.})" == "zip" ]; then
|
||||
unzip -q $src
|
||||
else
|
||||
false # Unsupported archive format.
|
||||
fi
|
||||
# Copy file source
|
||||
sudo cp -a $(cat ../sources/source_dir)/. "$final_path/live"
|
||||
# Copy additional file and modified
|
||||
if test -e "../sources/ajouts"; then
|
||||
sudo cp -a ../sources/ajouts/. "$final_path"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
### REMOVE SCRIPT
|
||||
|
||||
|
@ -173,6 +194,15 @@ ynh_psql_create_db() {
|
|||
|
||||
}
|
||||
|
||||
# Drop a role
|
||||
#
|
||||
# usage: ynh_mysql_drop_role db
|
||||
# | arg: db - the database name to drop
|
||||
ynh_psql_drop_role() {
|
||||
sudo su -c "psql" postgres <<< \
|
||||
"DROP ROLE ${1};"
|
||||
}
|
||||
|
||||
# Drop a database
|
||||
#
|
||||
# usage: ynh_mysql_drop_db db
|
||||
|
|
|
@ -61,23 +61,32 @@ ynh_app_setting_set $app final_path $final_path
|
|||
|
||||
# Install de Node.js
|
||||
pushd /opt
|
||||
curl -sL https://deb.nodesource.com/setup_4.x | bash -
|
||||
curl -sL https://deb.nodesource.com/setup_4.x | sudo bash -
|
||||
sudo apt-get -y install nodejs
|
||||
npm install -g yarn
|
||||
|
||||
# Create DB without password
|
||||
sudo systemctl restart postgresql
|
||||
ynh_psql_create_db_without_password "$app"
|
||||
|
||||
# Download all Ruby source
|
||||
sudo git clone https://github.com/rbenv/rbenv.git $final_path/.rbenv
|
||||
git clone https://github.com/rbenv/ruby-build.git $final_path/.rbenv/plugins/ruby-build
|
||||
git clone https://github.com/tootsuite/mastodon.git $final_path/live
|
||||
sudo git clone https://github.com/rbenv/ruby-build.git $final_path/.rbenv/plugins/ruby-build
|
||||
|
||||
# Be king rewind (/var/cache/yunohost/from_file/scripts)
|
||||
popd
|
||||
|
||||
# Get Mastodon last version
|
||||
sudo mkdir "${final_path}/live"
|
||||
SETUP_SOURCE
|
||||
sudo chown -R $app: "${final_path}"
|
||||
|
||||
# Install de rbenv
|
||||
sudo su - $app <<COMMANDS
|
||||
pushd ~/.rbenv
|
||||
src/configure && make -C src
|
||||
echo 'cd $HOME' >> ~/.bashrc
|
||||
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 -)"' >> ~/.bashrc
|
||||
COMMANDS
|
||||
|
@ -91,7 +100,7 @@ RCOMMANDS
|
|||
# Create symlink for ruby
|
||||
sudo ln -s /opt/mastodon/.rbenv/versions/2.3.1/bin/ruby /usr/bin/ruby || true
|
||||
|
||||
# # Install Mastodon
|
||||
# Install Mastodon
|
||||
sudo su - $app <<MCOMMANDS
|
||||
pushd ~/live
|
||||
/opt/mastodon/.rbenv/versions/2.3.1/bin/gem install bundler
|
||||
|
@ -99,6 +108,12 @@ bin/bundle install --deployment --without development test
|
|||
yarn install
|
||||
MCOMMANDS
|
||||
|
||||
# Vérif Mastodon
|
||||
sudo su - $app <<VCOMMANDS
|
||||
pushd ~
|
||||
type rbenv
|
||||
VCOMMANDS
|
||||
|
||||
# Adjust Mastodon config
|
||||
pushd $final_path/live/
|
||||
sudo cp -a .env.production.sample .env.production
|
||||
|
@ -118,16 +133,20 @@ sudo sed -i 's,SMTP_FROM_ADDRESS=notifications@example.com,SMTP_FROM_ADDRESS='${
|
|||
|
||||
# Create database
|
||||
# Preconfig CSS & JS
|
||||
# Create admin user
|
||||
# Create confirm email
|
||||
sudo su - $app <<ENDCOMMANDS
|
||||
|
||||
sudo su - $app <<CCOMMANDS
|
||||
pushd ~/live
|
||||
RAILS_ENV=production bin/bundle exec rails db:setup
|
||||
RAILS_ENV=production bin/bundle exec rails assets:precompile
|
||||
ENDCOMMANDS
|
||||
# RAILS_ENV=production bin/bundle exec rails assets:precompile
|
||||
CCOMMANDS
|
||||
|
||||
# Create admin user
|
||||
# Create confirm email
|
||||
sudo su - $app <<ACOMMANDS
|
||||
pushd ~/live
|
||||
# RAILS_ENV=production bin/bundle exec rails mastodon:make_admin USERNAME=$admin_mastodon
|
||||
# RAILS_ENV=production bin/bundle exec rails mastodon:confirm_email USER_EMAIL=$admin_mastodon@$domain
|
||||
ACOMMANDS
|
||||
|
||||
# Add Services
|
||||
pushd /var/cache/yunohost/from_file/scripts
|
||||
|
@ -174,5 +193,5 @@ fi
|
|||
# Reload SSOwat configuration
|
||||
sudo yunohost app ssowatconf
|
||||
|
||||
# Reload Nginx and regenerate SSOwat conf
|
||||
# Reload Nginx
|
||||
sudo systemctl reload nginx
|
|
@ -60,6 +60,7 @@ fi
|
|||
|
||||
# delete postgresql database & user
|
||||
ynh_psql_drop_db "${app}_production"
|
||||
ynh_psql_drop_role "${app}"
|
||||
|
||||
# Remove Debian package
|
||||
#sudo apt-get remove --purge -y imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev file curl git
|
||||
|
|
1
sources/source_dir
Normal file
1
sources/source_dir
Normal file
|
@ -0,0 +1 @@
|
|||
mastodon-1.1.1
|
1
sources/source_md5
Normal file
1
sources/source_md5
Normal file
|
@ -0,0 +1 @@
|
|||
4bfc3fc2ccc27cc88505cfc0dfb74cac v1.1.1.zip
|
1
sources/source_url
Normal file
1
sources/source_url
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/tootsuite/mastodon/archive/v1.1.1.zip
|
Loading…
Reference in a new issue