Zammad-Rolle

This commit is contained in:
phil 2021-07-28 18:28:22 +02:00
commit a6b16394ed
27 changed files with 552 additions and 0 deletions

44
templates/database.yml.j2 Normal file
View file

@ -0,0 +1,44 @@
# 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

9
templates/logrotate.j2 Normal file
View file

@ -0,0 +1,9 @@
{{ zammad_log_path }}/*.log {
daily
missingok
rotate 2
compress
delaycompress
notifempty
copytruncate
}

23
templates/monit.j2 Normal file
View file

@ -0,0 +1,23 @@
check process zammad-rails with pidfile {{ zammad_home }}/tmp/pids/server.pid
start program = "/usr/sbin/service zammad-rails start"
stop program = "/usr/sbin/service zammad-rails stop"
if 2 restarts within 3 cycles then timeout
if cpu usage > 95% for 3 cycles then restart
if failed host 127.0.0.1 port 3000 for 3 cycles then restart
if 5 restarts within 5 cycles then timeout
check process zammad-websocket
matching "script/websocket-server.rb -b 127.0.0.1 -p 6042 start"
start program = "/usr/sbin/service zammad-websocket start"
stop program = "/usr/sbin/service zammad-websocket stop"
if 2 restarts within 3 cycles then timeout
if cpu usage > 95% for 3 cycles then restart
if failed host 127.0.0.1 port 6042 for 3 cycles then restart
if 5 restarts within 5 cycles then timeout
check process zammad-scheduler with pidfile {{ zammad_home }}/tmp/pids/scheduler.pid
start program = "/usr/sbin/service zammad-scheduler start"
stop program = "/usr/sbin/service zammad-scheduler stop"
if 2 restarts within 3 cycles then timeout
if cpu usage > 95% for 3 cycles then restart
if 5 restarts within 5 cycles then timeout

View file

@ -0,0 +1,21 @@
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 /ws {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_pass http://{{ zammad_host }}:80;
}
location / { proxy_pass http://{{ zammad_host }}:80; }
}

35
templates/nginx-site.j2 Normal file
View file

@ -0,0 +1,35 @@
server {
listen 80;
server_name {{ zammad_domain }};
root {{ zammad_home }}/public;
error_log /var/log/nginx/{{ zammad_domain }}.error.log;
client_max_body_size 50M;
location ~ ^/(assets/|robots.txt|humans.txt|favicon.ico|apple-touch-icon.png) {
expires max;
}
location /ws {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header CLIENT_IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 86400;
proxy_pass http://127.0.0.1:6042;
}
location / {
proxy_set_header Host $http_host;
proxy_set_header CLIENT_IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
# Change this line in an SSO setup
proxy_set_header X-Forwarded-User "";
proxy_read_timeout 300;
proxy_pass http://127.0.0.1:3000;
}
}

1
templates/syslog.j2 Normal file
View file

@ -0,0 +1 @@
if $programname == '{{ zammad_log_name }}' then { action(type="omfile" file="{{ zammad_log_path }}/{{ zammad_log_file }}") stop }

View file

@ -0,0 +1,19 @@
[Unit]
Description=Zammad rails server
After=syslog.target
After=network.target
After=zammad.service
Requires=zammad.service
[Service]
EnvironmentFile=/etc/zammad/zammad.env
User=zammad
Group=zammad
Restart=always
WorkingDirectory={{ zammad_home }}
ExecStart=/bin/bash -l -c "${BUNDLE_BINARY} exec script/rails server -b ${ZAMMAD_BIND_IP} -p ${ZAMMAD_RAILS_PORT}"
[Install]
WantedBy=zammad.service

View file

@ -0,0 +1,20 @@
[Unit]
Description=Zammad scheduler
After=syslog.target
After=network.target
After=zammad.service
Requires=zammad.service
[Service]
Type=forking
EnvironmentFile=/etc/zammad/zammad.env
User=zammad
Group=zammad
Restart=always
WorkingDirectory={{ zammad_home }}
ExecStart=/bin/bash -l -c "${BUNDLE_BINARY} exec script/scheduler.rb start"
[Install]
WantedBy=zammad.service

View file

@ -0,0 +1,19 @@
[Unit]
Description=Zammad websocket
After=syslog.target
After=network.target
After=zammad.service
Requires=zammad.service
[Service]
EnvironmentFile=/etc/zammad/zammad.env
User=zammad
Group=zammad
Restart=always
WorkingDirectory={{ zammad_home }}
ExecStart=/bin/bash -l -c "${BUNDLE_BINARY} exec script/websocket-server.rb -b ${ZAMMAD_BIND_IP} -p ${ZAMMAD_WEBSOCKET_PORT} start"
[Install]
WantedBy=zammad.service