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

Upgrade error fix and cron job

This commit is contained in:
anmol 2018-11-07 09:42:21 +05:30
parent 7b33bf4f03
commit 9d07d121ad
7 changed files with 35 additions and 6 deletions

2
conf/cron Normal file
View file

@ -0,0 +1,2 @@
RAILS_ENV=production
@daily cd __FINAL__PATH__/live && __FINAL__PATH__/.rbenv/shims/bundle exec rake __USER__:media:remove_remote

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": "2.6.2", "version": "2.6.1",
"url": "https://github.com/tootsuite/mastodon", "url": "https://github.com/tootsuite/mastodon",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"maintainer": { "maintainer": {

View file

@ -73,6 +73,12 @@ ynh_backup "/etc/systemd/system/$app-web.service"
ynh_backup "/etc/systemd/system/$app-sidekiq.service" ynh_backup "/etc/systemd/system/$app-sidekiq.service"
ynh_backup "/etc/systemd/system/$app-streaming.service" ynh_backup "/etc/systemd/system/$app-streaming.service"
#=================================================
# BACKUP THE CRON FILE
#=================================================
ynh_backup "/etc/cron.d/$app"
#================================================= #=================================================
# BACKUP THE sources.list FILES # BACKUP THE sources.list FILES
#================================================= #=================================================

View file

@ -161,14 +161,14 @@ eval \"\$(rbenv init -)\"" > $final_path/.profile
# Install ruby-build # Install ruby-build
( (
exec_as "$app" $final_path/.rbenv/bin/rbenv install 2.5.1 exec_as "$app" $final_path/.rbenv/bin/rbenv install 2.5.3
exec_as "$app" $final_path/.rbenv/bin/rbenv global 2.5.1 exec_as "$app" $final_path/.rbenv/bin/rbenv global 2.5.3
exec_as "$app" $final_path/.rbenv/versions/2.5.1/bin/ruby -v exec_as "$app" $final_path/.rbenv/versions/2.5.3/bin/ruby -v
) )
# Create symlink for ruby # Create symlink for ruby
rm /usr/bin/ruby || true rm /usr/bin/ruby || true
ln -s $final_path/.rbenv/versions/2.5.1/bin/ruby /usr/bin/ruby || true ln -s $final_path/.rbenv/versions/2.5.3/bin/ruby /usr/bin/ruby || true
# Yarn install on root # Yarn install on root
pushd $final_path/live pushd $final_path/live
@ -260,6 +260,11 @@ yunohost service add "$app-web"
yunohost service add "$app-sidekiq" yunohost service add "$app-sidekiq"
yunohost service add "$app-streaming" yunohost service add "$app-streaming"
# SETUP CRON JOB FOR REMOVING CACHE
ynh_replace_string "__FINAL_PATH__" "$final_path" ../conf/cron
ynh_replace_string "__USER__" "$app" ../conf/cron
sudo cp -f ../conf/cron /etc/cron.d/$app
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================

View file

@ -85,6 +85,8 @@ ynh_remove_nginx_config
# SPECIFIC REMOVE # SPECIFIC REMOVE
#================================================= #=================================================
# Remove a cron file
ynh_secure_remove "/etc/cron.d/$app"
#================================================= #=================================================
# REMOVE source.list # REMOVE source.list

View file

@ -146,6 +146,12 @@ yunohost service add $app-web
yunohost service add $app-sidekiq yunohost service add $app-sidekiq
yunohost service add $app-streaming yunohost service add $app-streaming
#=================================================
# RESTORE THE CRON FILE
#=================================================
ynh_restore_file "/etc/cron.d/$app"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -107,7 +107,11 @@ yunohost service stop "$app-sidekiq"
yunohost service stop "$app-streaming" yunohost service stop "$app-streaming"
# Download Mastodon # Download Mastodon
mv "$final_path/live" "$final_path/live_back"
ynh_setup_source "$final_path/live" "app-mastodon" ynh_setup_source "$final_path/live" "app-mastodon"
rsync -a "$final_path/live_back/public/system" "$final_path/live_back/public/."
rsync -a "$final_path/live_back/.env.production" "$final_path/live/."
rm -Rf "$final_path/live_back"
# Clean files which are not needed anymore # Clean files which are not needed anymore
ynh_secure_remove $final_path/live/config/initializers/timeout.rb ynh_secure_remove $final_path/live/config/initializers/timeout.rb
@ -154,7 +158,6 @@ MCOMMANDS
# Install package with yarn and restart postgresql # Install package with yarn and restart postgresql
pushd $final_path/live pushd $final_path/live
yarn install --pure-lockfile yarn install --pure-lockfile
npm install -D babel-loader @babel/core @babel/preset-env webpack
systemctl restart postgresql systemctl restart postgresql
popd popd
@ -197,6 +200,11 @@ yunohost service start "$app-streaming"
# Waiting start all services # Waiting start all services
sleep 30 sleep 30
# SETUP CRON JOB FOR REMOVING CACHE
ynh_replace_string "__FINAL_PATH__" "$final_path" ../conf/cron
ynh_replace_string "__USER__" "$app" ../conf/cron
sudo cp -f ../conf/cron /etc/cron.d/$app
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================