Cleanup role
This commit is contained in:
parent
8f72c4bd68
commit
62c1026254
15 changed files with 1 additions and 237 deletions
|
@ -1,44 +1,12 @@
|
|||
# this is a database config sample for zammad ready to use with a postgresql db
|
||||
# copy or symlink this file to config/database.yml to use it
|
||||
|
||||
default: &default
|
||||
# For details on connection pooling, see Rails configuration guide
|
||||
# http://guides.rubyonrails.org/configuring.html#database-pooling
|
||||
pool: 50
|
||||
timeout: 5000
|
||||
encoding: utf8
|
||||
|
||||
##### postgresql config #####
|
||||
|
||||
adapter: postgresql
|
||||
username: {{ zammad_database_user }}
|
||||
password: {{ zammad_database_password }}
|
||||
|
||||
# If the database server is not on localhost, you can set hostname and port:
|
||||
host: {{ database_host }}
|
||||
# port:
|
||||
|
||||
#### mysql config #####
|
||||
|
||||
# adapter: mysql2
|
||||
# username: zammad
|
||||
# password: <Password>
|
||||
|
||||
# If the database server is not on localhost, you can set hostname and port:
|
||||
# host:
|
||||
# port:
|
||||
|
||||
production:
|
||||
<<: *default
|
||||
database: {{ zammad_database_name }}
|
||||
|
||||
development:
|
||||
<<: *default
|
||||
database: zammad_development
|
||||
|
||||
# Warning: The database defined as "test" will be erased and
|
||||
# re-generated from your development database when you run "rake".
|
||||
# Do not set this db to the same as development or production.
|
||||
test:
|
||||
<<: *default
|
||||
database: zammad_test
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
server {
|
||||
listen 80;
|
||||
server_name {{ zammad_domain }};
|
||||
include snippets/letsencrypt.conf;
|
||||
location / { return 301 https://$http_host$request_uri; }
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
server_name {{ zammad_domain }};
|
||||
ssl_certificate /var/lib/dehydrated/certs/{{ zammad_domain }}/fullchain.pem;
|
||||
ssl_certificate_key /var/lib/dehydrated/certs/{{ zammad_domain }}/privkey.pem;
|
||||
include /etc/nginx/snippets/add_headers.conf;
|
||||
location /cable {
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_pass http://{{ inventory_hostname }}:80;
|
||||
}
|
||||
location /ws {
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_pass http://{{ inventory_hostname }}:80;
|
||||
}
|
||||
location / {
|
||||
proxy_pass http://{{ inventory_hostname }}:80;
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
# https://github.com/JBails/PurgeZammad
|
||||
# This script will delete all users that do not have an assigned ticket (open or closed), with no regards as to how long they haven't had a ticket
|
||||
# i.e. doesn't care if the last ticket was deleted 30 seconds or 30 days ago
|
||||
|
||||
ticketless_customers = User.with_permissions('ticket.customer'){% if zammad_preserve_customer_domains is defined %}{% for domain in zammad_preserve_customer_domains %}.where('email NOT LIKE ?', '%{{ domain }}%'){% endfor %}{% endif %}.where('id NOT IN (SELECT customer_id FROM tickets)')
|
||||
count = ticketless_customers.count
|
||||
|
||||
puts "#{count} customers without tickets found."
|
||||
puts
|
||||
|
||||
ticketless_customers.find_each.with_index do |user, i|
|
||||
next if user.permissions?(%w[admin ticket.agent])
|
||||
next if user.id == 1
|
||||
|
||||
display_name = user.fullname + (user.fullname == user.email ? '' : " (#{user.email})")
|
||||
|
||||
User.transaction do
|
||||
begin
|
||||
user.destroy!
|
||||
puts " #{display_name} deleted."
|
||||
rescue => e
|
||||
puts " #{display_name} could not be deleted: #{e.message}"
|
||||
raise ActiveRecord::Rollback
|
||||
next
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,46 +0,0 @@
|
|||
#!/bin/bash
|
||||
# {{ ansible_managed }}
|
||||
|
||||
set -eu
|
||||
|
||||
RUBY_VERSION=$(cat {{ zammad_home }}/.ruby-version)
|
||||
RUBY_INSTALLED_VERSIONS=$(rbenv version | grep $RUBY_VERSION | cut -d ' ' -f2)
|
||||
|
||||
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
|
||||
|
||||
if [ -n "$RUBY_INSTALLED_VERSIONS" ]; then
|
||||
echo "Aktualisiere Ruby-Version..."
|
||||
sudo -u {{ zammad_user }} rbenv install "$RUBY_VERSION"
|
||||
fi
|
||||
|
||||
echo "Aktualisiere bundler..."
|
||||
sudo -u {{ zammad_user }} RAILS_ENV=production rbenv exec gem install bundler
|
||||
|
||||
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 "Synchronisiere Translation-Dateien..."
|
||||
sudo -u {{ zammad_user }} RAILS_ENV=production rbenv exec rails r "Locale.sync"
|
||||
sudo -u {{ zammad_user }} RAILS_ENV=production rbenv exec rails r "Translation.sync"
|
||||
|
||||
echo "Starte Zammad..."
|
||||
systemctl start {{ zammad_service }}
|
||||
sleep 20
|
||||
|
||||
echo "Alles erledigt."
|
Loading…
Add table
Add a link
Reference in a new issue