From 578657ecc7c1b744f40499788ba3372740559d3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Tue, 25 Oct 2016 10:29:13 +0200 Subject: [PATCH 01/21] add debian 7 to .pkgr.yml --- .pkgr.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.pkgr.yml b/.pkgr.yml index 7597bbea8..b4a42e77d 100644 --- a/.pkgr.yml +++ b/.pkgr.yml @@ -11,9 +11,13 @@ targets: - postgresql - postgresql-server - postgresql-devel + debian-7: + dependencies: + - nginx + - postgresql ubuntu-16.04: dependencies: - - httpd + - nginx - postgresql before: - uname -a From 9e3443365f4ea52e1b1978b39f714359b6167737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Tue, 25 Oct 2016 10:30:45 +0200 Subject: [PATCH 02/21] remove useless contrib/nginx/nginx.conf --- contrib/nginx/nginx.conf | 128 --------------------------------------- 1 file changed, 128 deletions(-) delete mode 100644 contrib/nginx/nginx.conf diff --git a/contrib/nginx/nginx.conf b/contrib/nginx/nginx.conf deleted file mode 100644 index d9bd10f65..000000000 --- a/contrib/nginx/nginx.conf +++ /dev/null @@ -1,128 +0,0 @@ - -#user nobody; -worker_processes 1; - -#error_log logs/error.log; -#error_log logs/error.log notice; -error_log /var/log/nginx/error.log info; - -#pid logs/nginx.pid; - - -events { - worker_connections 256; -} - - -http { - include mime.types; - default_type application/octet-stream; - include sites-enabled/*.conf; - #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' - # '$status $body_bytes_sent "$http_referer" ' - # '"$http_user_agent" "$http_x_forwarded_for"'; - - #access_log logs/access.log main; - - - sendfile on; - #tcp_nopush on; - - client_max_body_size 50M; - - #keepalive_timeout 0; - keepalive_timeout 65; - proxy_cache_path /tmp/nginx/cache/ levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m; - proxy_temp_path /tmp/nginx/proxy/; - gzip on; - gzip_comp_level 6; - gzip_vary on; - gzip_min_length 1000; - gzip_proxied any; - gzip_types text/plain text/html text/css text/xml application/json application/x-javascript application/xml application/xml+rss text/javascript; - gzip_buffers 16 8k; - - server { - listen 8080; - server_name localhost; - - #charset koi8-r; - - #access_log logs/host.access.log main; - - location / { - root html; - index index.html index.htm; - } - - #error_page 404 /404.html; - - # redirect server error pages to the static page /50x.html - # - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root html; - } - - # proxy the PHP scripts to Apache listening on 127.0.0.1:80 - # - #location ~ \.php$ { - # proxy_pass http://127.0.0.1; - #} - - # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 - # - #location ~ \.php$ { - # root html; - # fastcgi_pass 127.0.0.1:9000; - # fastcgi_index index.php; - # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; - # include fastcgi_params; - #} - - # deny access to .htaccess files, if Apache's document root - # concurs with nginx's one - # - #location ~ /\.ht { - # deny all; - #} - } - - - # another virtual host using mix of IP-, name-, and port-based configuration - # - #server { - # listen 8000; - # listen somename:8080; - # server_name somename alias another.alias; - - # location / { - # root html; - # index index.html index.htm; - # } - #} - - - # HTTPS server - # - #server { - # listen 443; - # server_name localhost; - - # ssl on; - # ssl_certificate cert.pem; - # ssl_certificate_key cert.key; - - # ssl_session_timeout 5m; - - # ssl_protocols SSLv2 SSLv3 TLSv1; - # ssl_ciphers HIGH:!aNULL:!MD5; - # ssl_prefer_server_ciphers on; - - # location / { - # root html; - # index index.html index.htm; - # } - #} - -} From 5884ea45500fed5b6c410f021b3c62bd9034be8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Tue, 25 Oct 2016 10:46:47 +0200 Subject: [PATCH 03/21] pkgr - create init scripts afer install --- .pkgr.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.pkgr.yml b/.pkgr.yml index b4a42e77d..53dd1d5b0 100644 --- a/.pkgr.yml +++ b/.pkgr.yml @@ -36,4 +36,7 @@ env: services: - postgres +after_install: + - zammad scale web=1 websocket=1 worker=1 + notifications: false From 798b46f770f011c3af2e4047edc772506f0ac4a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Tue, 25 Oct 2016 11:14:01 +0200 Subject: [PATCH 04/21] pkgr - implement nginx in ubuntu --- .pkgr.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.pkgr.yml b/.pkgr.yml index 53dd1d5b0..13f8fd924 100644 --- a/.pkgr.yml +++ b/.pkgr.yml @@ -19,6 +19,11 @@ targets: dependencies: - nginx - postgresql + after_install: + - zammad scale web=1 websocket=1 worker=1 + - /opt/zammad/contrib/nginx/sites-available/zammad.conf /etc/nginx/sites-available/zammad.conf + - ln -s /etc/nginx/sites-available/zammad.conf /etc/nginx/sites-enabled/zammad.conf + - sytemctl nginx restart before: - uname -a - ruby -v @@ -36,7 +41,4 @@ env: services: - postgres -after_install: - - zammad scale web=1 websocket=1 worker=1 - notifications: false From 2cb8f73e7165ef909f159244a2a238d8799bde92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Tue, 25 Oct 2016 11:15:27 +0200 Subject: [PATCH 05/21] pkgr - implement nginx in ubuntu --- .pkgr.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.pkgr.yml b/.pkgr.yml index 13f8fd924..84eaa3972 100644 --- a/.pkgr.yml +++ b/.pkgr.yml @@ -21,9 +21,10 @@ targets: - postgresql after_install: - zammad scale web=1 websocket=1 worker=1 + - systemctl restart zammad - /opt/zammad/contrib/nginx/sites-available/zammad.conf /etc/nginx/sites-available/zammad.conf - ln -s /etc/nginx/sites-available/zammad.conf /etc/nginx/sites-enabled/zammad.conf - - sytemctl nginx restart + - sytemctl restart nginx before: - uname -a - ruby -v From d8ef3abb7c62ed6854d3686db6640b762ca1a849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Tue, 25 Oct 2016 12:38:25 +0200 Subject: [PATCH 06/21] pkgr changes --- .pkgr.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.pkgr.yml b/.pkgr.yml index 84eaa3972..3601e9778 100644 --- a/.pkgr.yml +++ b/.pkgr.yml @@ -1,3 +1,5 @@ +notifications: false + targets: centos-6: dependencies: @@ -19,12 +21,6 @@ targets: dependencies: - nginx - postgresql - after_install: - - zammad scale web=1 websocket=1 worker=1 - - systemctl restart zammad - - /opt/zammad/contrib/nginx/sites-available/zammad.conf /etc/nginx/sites-available/zammad.conf - - ln -s /etc/nginx/sites-available/zammad.conf /etc/nginx/sites-enabled/zammad.conf - - sytemctl restart nginx before: - uname -a - ruby -v @@ -42,4 +38,5 @@ env: services: - postgres -notifications: false +after_install: + - zammad scale web=1 websocket=1 worker=1 From f99d8b10eefd94ba080cf95f937edf17ab450446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Tue, 25 Oct 2016 12:43:21 +0200 Subject: [PATCH 07/21] pkgr changes --- .pkgr.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.pkgr.yml b/.pkgr.yml index 3601e9778..9f5c49e93 100644 --- a/.pkgr.yml +++ b/.pkgr.yml @@ -37,6 +37,3 @@ env: services: - postgres - -after_install: - - zammad scale web=1 websocket=1 worker=1 From f273634cb3563acdcebe38ad86cc26492af9f339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Tue, 25 Oct 2016 12:56:52 +0200 Subject: [PATCH 08/21] pkgr changes --- .pkgr.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.pkgr.yml b/.pkgr.yml index 9f5c49e93..f5be62529 100644 --- a/.pkgr.yml +++ b/.pkgr.yml @@ -13,7 +13,7 @@ targets: - postgresql - postgresql-server - postgresql-devel - debian-7: + debian-8: dependencies: - nginx - postgresql @@ -21,6 +21,7 @@ targets: dependencies: - nginx - postgresql + before: - uname -a - ruby -v @@ -37,3 +38,7 @@ env: services: - postgres + +after: + - zammad scale web=1 websocket=1 worker=1 + From 26d513f7ad2de0cace31f49d9f1ffd03e8ca8d49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Tue, 25 Oct 2016 12:57:47 +0200 Subject: [PATCH 09/21] pkgr changes --- .pkgr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pkgr.yml b/.pkgr.yml index f5be62529..6ffa5cafc 100644 --- a/.pkgr.yml +++ b/.pkgr.yml @@ -39,6 +39,6 @@ env: services: - postgres -after: - - zammad scale web=1 websocket=1 worker=1 +after_install: + - "zammad scale web=1 websocket=1 worker=1" From d62c2bd034cba2651c8bf2ff0fe0b99b67cea39d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Tue, 25 Oct 2016 13:02:01 +0200 Subject: [PATCH 10/21] pkgr changes --- .pkgr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pkgr.yml b/.pkgr.yml index 6ffa5cafc..0d7281337 100644 --- a/.pkgr.yml +++ b/.pkgr.yml @@ -40,5 +40,5 @@ services: - postgres after_install: - - "zammad scale web=1 websocket=1 worker=1" + - "/usr/bin/zammad scale web=1 websocket=1 worker=1" From a1599cf21e20845ca92f96ea94700f22c2bfd5fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Tue, 25 Oct 2016 13:51:46 +0200 Subject: [PATCH 11/21] pkgr changes --- .pkgr.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pkgr.yml b/.pkgr.yml index 0d7281337..12af8e9f2 100644 --- a/.pkgr.yml +++ b/.pkgr.yml @@ -41,4 +41,3 @@ services: after_install: - "/usr/bin/zammad scale web=1 websocket=1 worker=1" - From af5882b42102867d81e2a5bbe0bbad39705e3c33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Tue, 25 Oct 2016 13:54:00 +0200 Subject: [PATCH 12/21] pkgr changes --- .pkgr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pkgr.yml b/.pkgr.yml index 12af8e9f2..0d7281337 100644 --- a/.pkgr.yml +++ b/.pkgr.yml @@ -41,3 +41,4 @@ services: after_install: - "/usr/bin/zammad scale web=1 websocket=1 worker=1" + From 86df83ed33621dbb190455723b4b544c187043cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Tue, 25 Oct 2016 15:14:58 +0200 Subject: [PATCH 13/21] pkgr changes --- .pkgr.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.pkgr.yml b/.pkgr.yml index 0d7281337..ec9e89273 100644 --- a/.pkgr.yml +++ b/.pkgr.yml @@ -1,5 +1,4 @@ notifications: false - targets: centos-6: dependencies: @@ -21,7 +20,6 @@ targets: dependencies: - nginx - postgresql - before: - uname -a - ruby -v @@ -30,15 +28,11 @@ before: - echo "gem 'mysql2'" >> Gemfile.local - "cat Gemfile.lock" - contrib/cleanup.sh - env: - RAILS_ENV=production - PORT=3000 - RAILS_SERVE_STATIC_FILES=true - services: - postgres - after_install: - "/usr/bin/zammad scale web=1 websocket=1 worker=1" - From 6d89cf1661cef48958c01812cc245e7bbcfb37bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Tue, 25 Oct 2016 15:16:52 +0200 Subject: [PATCH 14/21] pkgr changes --- .pkgr.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.pkgr.yml b/.pkgr.yml index ec9e89273..d215c7b1f 100644 --- a/.pkgr.yml +++ b/.pkgr.yml @@ -34,5 +34,3 @@ env: - RAILS_SERVE_STATIC_FILES=true services: - postgres -after_install: - - "/usr/bin/zammad scale web=1 websocket=1 worker=1" From 3610ed3bccdc3f6dcd7435e708efc8d0061096b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Tue, 25 Oct 2016 15:29:10 +0200 Subject: [PATCH 15/21] moved cleanup.sh to contrip/packager.io / added contrib/packager.io/postinstall.sh --- .pkgr.yml | 3 ++- contrib/{ => packager.io}/cleanup.sh | 0 contrib/packager.io/postinstall.sh | 13 +++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) rename contrib/{ => packager.io}/cleanup.sh (100%) create mode 100755 contrib/packager.io/postinstall.sh diff --git a/.pkgr.yml b/.pkgr.yml index d215c7b1f..64791fb2e 100644 --- a/.pkgr.yml +++ b/.pkgr.yml @@ -27,10 +27,11 @@ before: - cp config/database.yml.pkgr config/database.yml - echo "gem 'mysql2'" >> Gemfile.local - "cat Gemfile.lock" - - contrib/cleanup.sh + - contrib/packager.io/cleanup.sh env: - RAILS_ENV=production - PORT=3000 - RAILS_SERVE_STATIC_FILES=true services: - postgres +after_install: contrib/packager.io/postinstall.sh diff --git a/contrib/cleanup.sh b/contrib/packager.io/cleanup.sh similarity index 100% rename from contrib/cleanup.sh rename to contrib/packager.io/cleanup.sh diff --git a/contrib/packager.io/postinstall.sh b/contrib/packager.io/postinstall.sh new file mode 100755 index 000000000..c2fc364f2 --- /dev/null +++ b/contrib/packager.io/postinstall.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -ex + +# create init scripts +/usr/bin/zammad scale web=1 websocket=1 worker=1 + +# start zammad +systemctl start zammad + +# start nginx +systemctl start nginx + From 3ec2ba3a43c2c9a83bccd566f8cf4124f6e2ada6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Tue, 25 Oct 2016 15:51:46 +0200 Subject: [PATCH 16/21] pkgr changes --- .pkgr.yml | 2 -- contrib/packager.io/postinstall.sh | 17 ++++++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.pkgr.yml b/.pkgr.yml index 64791fb2e..4984a9990 100644 --- a/.pkgr.yml +++ b/.pkgr.yml @@ -14,11 +14,9 @@ targets: - postgresql-devel debian-8: dependencies: - - nginx - postgresql ubuntu-16.04: dependencies: - - nginx - postgresql before: - uname -a diff --git a/contrib/packager.io/postinstall.sh b/contrib/packager.io/postinstall.sh index c2fc364f2..a725a6be9 100755 --- a/contrib/packager.io/postinstall.sh +++ b/contrib/packager.io/postinstall.sh @@ -1,13 +1,20 @@ #!/bin/bash - +# +# packager.io postinstall script +# set -ex # create init scripts /usr/bin/zammad scale web=1 websocket=1 worker=1 +# stop zammad +systemctl stop zammad + +# db migration +if /usr/bin/zammad config:get DATABASE_URL ; then + /usr/bin/zammad run rake db:migrate +fi + # start zammad -systemctl start zammad - -# start nginx -systemctl start nginx +systemctl restart zammad From bafcd91a92696a7a2ecbe2edc76f1fdc48874296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Tue, 25 Oct 2016 17:59:31 +0200 Subject: [PATCH 17/21] postinstall.sh db creation --- contrib/packager.io/postinstall.sh | 44 +++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/contrib/packager.io/postinstall.sh b/contrib/packager.io/postinstall.sh index a725a6be9..acd06e1b0 100755 --- a/contrib/packager.io/postinstall.sh +++ b/contrib/packager.io/postinstall.sh @@ -2,19 +2,49 @@ # # packager.io postinstall script # -set -ex + +PATH=/opt/zammad/bin:/opt/zammad/vendor/bundle/bin:/sbin:/bin:/usr/sbin:/usr/bin: + +DB="zammad_production" +DB_USER="zammad" + +# get existing db pass +DB_PASS="$(grep "password:" < /opt/zammad/config/database.yml | sed 's/.*password://')" + +# check if db pass exists +if [ -z "${DB_PASS}" ]; then + # create new db pass + DB_PASS="$(tr -dc A-Za-z0-9 < /dev/urandom | head -c10)" + + # create database + cd /tmp + su - postgres -c "createdb -E UTF8 ${DB}" + + # create postgres user + echo "CREATE USER \"${DB_USER}\" WITH PASSWORD '${DB_PASS}';" | su - postgres -c psql + + # grant privileges + echo "GRANT ALL PRIVILEGES ON DATABASE \"${DB}\" TO \"${DB_USER}\";" | su - postgres -c psql + + # update configfile + sed -e "s/ password:/ password: ${DB_PASS}/" < /opt/zammad/config/database.yml.pkgr > /opt/zammad/config/database.yml + + # zammad config set + zammad config:set DATABASE_URL=postgres://${DB_USER}:${DB_PASS}@127.0.0.1/${DB} + + # fill database + zammad run rake db:migrate + zammad run rake db:seed +fi # create init scripts -/usr/bin/zammad scale web=1 websocket=1 worker=1 +zammad scale web=1 websocket=1 worker=1 # stop zammad systemctl stop zammad # db migration -if /usr/bin/zammad config:get DATABASE_URL ; then - /usr/bin/zammad run rake db:migrate -fi +zammad run rake db:migrate # start zammad -systemctl restart zammad - +systemctl start zammad From 1f30f416c4de816d39779346f6d750cc27e7d4d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Tue, 25 Oct 2016 18:07:10 +0200 Subject: [PATCH 18/21] postinstall.sh - add nginx config --- contrib/packager.io/postinstall.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/contrib/packager.io/postinstall.sh b/contrib/packager.io/postinstall.sh index acd06e1b0..b33973911 100755 --- a/contrib/packager.io/postinstall.sh +++ b/contrib/packager.io/postinstall.sh @@ -5,11 +5,12 @@ PATH=/opt/zammad/bin:/opt/zammad/vendor/bundle/bin:/sbin:/bin:/usr/sbin:/usr/bin: +ZAMMAD_DIR="/opt/zammad" DB="zammad_production" DB_USER="zammad" # get existing db pass -DB_PASS="$(grep "password:" < /opt/zammad/config/database.yml | sed 's/.*password://')" +DB_PASS="$(grep "password:" < ${ZAMMAD_DIR}/config/database.yml | sed 's/.*password://')" # check if db pass exists if [ -z "${DB_PASS}" ]; then @@ -27,7 +28,7 @@ if [ -z "${DB_PASS}" ]; then echo "GRANT ALL PRIVILEGES ON DATABASE \"${DB}\" TO \"${DB_USER}\";" | su - postgres -c psql # update configfile - sed -e "s/ password:/ password: ${DB_PASS}/" < /opt/zammad/config/database.yml.pkgr > /opt/zammad/config/database.yml + sed -e "s/ password:/ password: ${DB_PASS}/" < ${ZAMMAD_DIR}/config/database.yml.pkgr > ${ZAMMAD_DIR}/config/database.yml # zammad config set zammad config:set DATABASE_URL=postgres://${DB_USER}:${DB_PASS}@127.0.0.1/${DB} @@ -48,3 +49,13 @@ zammad run rake db:migrate # start zammad systemctl start zammad + +# nginx config +if [ -d /etc/nginx/sites-enabled ]; then + # copy nginx config + cp ${ZAMMAD_DIR}/contrib/nginx/sites-available/zammad.conf /etc/nginx/sites-available/zammad.conf + # creating symlink + ln -s /etc/nginx/sites-available/zammad.conf /etc/nginx/sites-enabled/zammad.conf + # restart nginx + systemctl restart nginx +fi From 1ee250fc5b6f568439e58e39785cadde5feb8ee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Tue, 25 Oct 2016 18:27:30 +0200 Subject: [PATCH 19/21] postinstall.sh check if symlink already exists --- contrib/packager.io/postinstall.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/packager.io/postinstall.sh b/contrib/packager.io/postinstall.sh index b33973911..8797ee335 100755 --- a/contrib/packager.io/postinstall.sh +++ b/contrib/packager.io/postinstall.sh @@ -55,7 +55,7 @@ if [ -d /etc/nginx/sites-enabled ]; then # copy nginx config cp ${ZAMMAD_DIR}/contrib/nginx/sites-available/zammad.conf /etc/nginx/sites-available/zammad.conf # creating symlink - ln -s /etc/nginx/sites-available/zammad.conf /etc/nginx/sites-enabled/zammad.conf + test -h /etc/nginx/sites-available/zammad.conf || ln -s /etc/nginx/sites-available/zammad.conf /etc/nginx/sites-enabled/zammad.conf # restart nginx systemctl restart nginx fi From 5cb038a95eaf80baca5de366fa1cb41d966b1384 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Tue, 25 Oct 2016 18:55:02 +0200 Subject: [PATCH 20/21] postinstall.sh - check if nginx.conf already exists --- contrib/packager.io/postinstall.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/packager.io/postinstall.sh b/contrib/packager.io/postinstall.sh index 8797ee335..62cf72821 100755 --- a/contrib/packager.io/postinstall.sh +++ b/contrib/packager.io/postinstall.sh @@ -53,7 +53,7 @@ systemctl start zammad # nginx config if [ -d /etc/nginx/sites-enabled ]; then # copy nginx config - cp ${ZAMMAD_DIR}/contrib/nginx/sites-available/zammad.conf /etc/nginx/sites-available/zammad.conf + test -f /etc/nginx/sites-available/zammad.conf || cp ${ZAMMAD_DIR}/contrib/nginx/sites-available/zammad.conf /etc/nginx/sites-available/zammad.conf # creating symlink test -h /etc/nginx/sites-available/zammad.conf || ln -s /etc/nginx/sites-available/zammad.conf /etc/nginx/sites-enabled/zammad.conf # restart nginx From 163f37e925e523cea617ad8af8d50d57801f6340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Tue, 25 Oct 2016 19:23:46 +0200 Subject: [PATCH 21/21] postinstall.sh fixes --- contrib/packager.io/postinstall.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/contrib/packager.io/postinstall.sh b/contrib/packager.io/postinstall.sh index 62cf72821..d696e555f 100755 --- a/contrib/packager.io/postinstall.sh +++ b/contrib/packager.io/postinstall.sh @@ -9,8 +9,11 @@ ZAMMAD_DIR="/opt/zammad" DB="zammad_production" DB_USER="zammad" -# get existing db pass -DB_PASS="$(grep "password:" < ${ZAMMAD_DIR}/config/database.yml | sed 's/.*password://')" +# check if database.yml exists +if [ -f ${ZAMMAD_DIR}/config/database.yml ]; then + # get existing db pass + DB_PASS="$(grep "password:" < ${ZAMMAD_DIR}/config/database.yml | sed 's/.*password://')" +fi # check if db pass exists if [ -z "${DB_PASS}" ]; then @@ -55,7 +58,7 @@ if [ -d /etc/nginx/sites-enabled ]; then # copy nginx config test -f /etc/nginx/sites-available/zammad.conf || cp ${ZAMMAD_DIR}/contrib/nginx/sites-available/zammad.conf /etc/nginx/sites-available/zammad.conf # creating symlink - test -h /etc/nginx/sites-available/zammad.conf || ln -s /etc/nginx/sites-available/zammad.conf /etc/nginx/sites-enabled/zammad.conf + test -f /etc/nginx/sites-available/zammad.conf || ln -s /etc/nginx/sites-available/zammad.conf /etc/nginx/sites-enabled/zammad.conf # restart nginx systemctl restart nginx fi