From a797add550aacbd27429efd04f8bf3983e1a7eb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Mon, 31 Oct 2016 13:00:59 +0100 Subject: [PATCH] packager additions --- .codeclimate.yml | 48 +++++++++++++++++++ .pkgr.yml | 15 +++--- .../postinstall.sh} | 14 ++++-- contrib/packager.io/preinstall.sh | 12 +++++ 4 files changed, 78 insertions(+), 11 deletions(-) create mode 100644 .codeclimate.yml rename contrib/{pkgr-postinstall.sh => packager.io/postinstall.sh} (88%) create mode 100755 contrib/packager.io/preinstall.sh diff --git a/.codeclimate.yml b/.codeclimate.yml new file mode 100644 index 000000000..54e14b269 --- /dev/null +++ b/.codeclimate.yml @@ -0,0 +1,48 @@ +--- +engines: + brakeman: + enabled: true + bundler-audit: + enabled: true + csslint: + enabled: true + coffeelint: + enabled: true + duplication: + enabled: true + config: + languages: + - ruby + - javascript + - python + - php + eslint: + enabled: true + fixme: + enabled: true + phpmd: + enabled: true + rubocop: + enabled: true +ratings: + paths: + - Gemfile.lock + - "**.erb" + - "**.haml" + - "**.rb" + - "**.rhtml" + - "**.slim" + - "**.css" + - "**.coffee" + - "**.inc" + - "**.js" + - "**.jsx" + - "**.module" + - "**.php" + - "**.py" +exclude_paths: +- config/ +- db/ +- script/ +- test/ +- vendor/ diff --git a/.pkgr.yml b/.pkgr.yml index 1a1429b9e..68e6b8d78 100644 --- a/.pkgr.yml +++ b/.pkgr.yml @@ -2,24 +2,23 @@ notifications: false targets: centos-6: dependencies: - - httpd - - postgresql + - nginx - postgresql-server - - postgresql-devel centos-7: dependencies: - - httpd - - postgresql + - nginx - postgresql-server - - postgresql-devel debian-8: dependencies: + - nginx - postgresql ubuntu-16.04: dependencies: + - nginx - postgresql sles-12: dependencies: + - nginx - postgresql before: - uname -a @@ -31,7 +30,7 @@ before: env: - RAILS_ENV=production - PORT=3000 - - RAILS_SERVE_STATIC_FILES=true services: - postgres -after_install: contrib/pkgr-postinstall.sh +before_install: contrib/packager.io/preinstall.sh +after_install: contrib/packager.io/postinstall.sh diff --git a/contrib/pkgr-postinstall.sh b/contrib/packager.io/postinstall.sh similarity index 88% rename from contrib/pkgr-postinstall.sh rename to contrib/packager.io/postinstall.sh index 80ee532d8..86561ac5c 100755 --- a/contrib/pkgr-postinstall.sh +++ b/contrib/packager.io/postinstall.sh @@ -10,9 +10,9 @@ DB="zammad_production" DB_USER="zammad" # check which init system is used -if [ -n $(which initctl) ]; then +if [ -n "$(which initctl)" ]; then INIT_CMD="initctl" -elif [ -n $(which systemctl) ]; then +elif [ -n "$(which systemctl)" ]; then INIT_CMD="systemctl" else function sysvinit () { @@ -36,6 +36,14 @@ else # create new password DB_PASS="$(tr -dc A-Za-z0-9 < /dev/urandom | head -c10)" + if [ -n "$(which postgresql-setup)" ]; then + echo "preparing postgresql server" + postgresql-setup initdb + + echo "restarting postgresql server" + ${INIT_CMD} restart postgresql + fi + # create database echo "# database.yml not found. Creating new db..." su - postgres -c "createdb -E UTF8 ${DB}" @@ -58,7 +66,7 @@ echo "# Starting Zammad" ${INIT_CMD} start zammad # nginx config -if [ -n $(which nginx) ]; then +if [ -n "$(which nginx)" ]; then # copy nginx config # debian / ubuntu if [ -d /etc/nginx/sites-enabled ]; then diff --git a/contrib/packager.io/preinstall.sh b/contrib/packager.io/preinstall.sh new file mode 100755 index 000000000..1bc7e735f --- /dev/null +++ b/contrib/packager.io/preinstall.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# +# packager.io preinstall script +# + +PATH=/opt/zammad/bin:/opt/zammad/vendor/bundle/bin:/sbin:/bin:/usr/sbin:/usr/bin: + +# install epel-release on centos (needed for nginx) +if [ -n "$(which yum)" ]; then + yum install -y epel-release +fi +