Browse Source

inital systemd file

Roy Kaldung 9 years ago
parent
commit
51250e786d
2 changed files with 41 additions and 0 deletions
  1. 19 0
      contrib/systemd/zammad.service
  2. 22 0
      extras/zammad_nginx.conf

+ 19 - 0
contrib/systemd/zammad.service

@@ -0,0 +1,19 @@
+[Unit]
+Description=Zammad
+After=syslog.target
+After=network.target
+
+[Service]
+Type=simple
+User=<zammad
+Group=zammad
+
+ExecStart=bash -l -c "RAILS_ENV=production bundle exec script/websocket-server.rb start -d -i tmp/pids/websocket.pid -p 6042 -b 127.0.0.1"
+
+ExecStop=bash -l -c "RAILS_ENV=production bundle exec script/websocket-server.rb stop -d -i tmp/pids/websocket.pid -p 6042 -b 127.0.0.1"
+
+# Give a reasonable amount of time for the server to start up/shut down
+TimeoutSec=300
+
+[Install]
+WantedBy=multi-user.target

+ 22 - 0
extras/zammad_nginx.conf

@@ -0,0 +1,22 @@
+server {
+    listen 80;
+    server_name SERVER_NAME;
+    root /opt/zammad/zammad/public;
+
+    location ~ ^/(assets/|robots.txt|humans.txt|favicon.ico) {
+	expires max;
+    }
+
+    location /ws {
+        proxy_http_version 1.1;
+        proxy_set_header Upgrade $http_upgrade;
+        proxy_set_header Connection "Upgrade";
+        proxy_pass http://localhost:6042;
+    }
+
+    location / {
+        proxy_set_header Host $host;
+        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+	proxy_pass http://localhost:3000;
+    }
+}