+Update-Skript

This commit is contained in:
phil 2021-10-30 01:35:25 +02:00
parent a05c1735a7
commit 2645696275
2 changed files with 46 additions and 0 deletions

View file

@ -34,6 +34,12 @@
src: zammad-delete-customers.rb.j2
dest: "{{ local_scripts_dir }}/zammad-delete-customers.rb"
- name: "zammad: Kopiere Updater"
template:
src: zammad-update.j2
dest: "{{ local_scripts_dir }}/zammad-updater"
mode: 0755
- name: "zammad: Richte cron ein"
cron:
cron_file: "{{ cron_file }}"

View file

@ -0,0 +1,40 @@
#!/bin/bash
set -eu
echo "Stoppe Monit-Monitoring..."
monit unmonitor zammad-websocket
monit unmonitor zammad-rails
monit unmonitor zammad-scheduler
echo "Wechsle Verzeichnis..."
cd {{ zammad_home }}
echo "Leere Rails Cache..."
sudo -u {{ zammad_user }} RAILS_ENV=production rbenv exec rails r "Cache.clear"
echo "Aktualisiere Git-Repository..."
git pull
echo "Aktualisiere Ruby-Pakete..."
sudo -u {{ zammad_user }} RAILS_ENV=production rbenv exec bundle install --without test development mysql
echo "Stoppe Zammad..."
systemctl stop zammad.service
echo "Migriere Datenbank..."
sudo -u {{ zammad_user }} RAILS_ENV=production rbenv exec bundle exec rake db:migrate
echo "Assets vorkompilieren..."
sudo -u {{ zammad_user }} RAILS_ENV=production rbenv exec bundle exec rake assets:precompile
echo "Starte Zammad..."
systemctl start zammad.service
sleep 20
echo "Starte Monit-Monitoring..."
monit monitor zammad-websocket
monit monitor zammad-rails
monit monitor zammad-scheduler
echo "Alles erledigt."