Compare commits
1 Commits
master
...
release-dr
Author | SHA1 | Date | |
---|---|---|---|
|
db3b8c0cc4 |
11
.github/docker-image-build.sh
vendored
11
.github/docker-image-build.sh
vendored
@ -1,11 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# build zammads docker & docker-compose images
|
||||
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
|
||||
DOCKER_IMAGE="zammad"
|
||||
|
||||
echo "Build Zammad Docker image ${DOCKER_IMAGE} for local or ci tests"
|
||||
docker build --pull --no-cache --build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" -t "${DOCKER_IMAGE}-local" -f "containers/${DOCKER_IMAGE}/Dockerfile" .
|
35
.github/release-drafter.yml
vendored
Normal file
35
.github/release-drafter.yml
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
name-template: "$RESOLVED_VERSION"
|
||||
tag-template: "$RESOLVED_VERSION"
|
||||
categories:
|
||||
- title: "🚀 Features"
|
||||
labels:
|
||||
- "feature"
|
||||
- "enhancement"
|
||||
- title: "🐛 Bug Fixes"
|
||||
labels:
|
||||
- "fix"
|
||||
- "bugfix"
|
||||
- "bug"
|
||||
- title: "🧹 Maintenance"
|
||||
labels:
|
||||
- "chore"
|
||||
- "dependencies"
|
||||
version-resolver:
|
||||
major:
|
||||
labels:
|
||||
- "feature"
|
||||
minor:
|
||||
labels:
|
||||
- "enhancement"
|
||||
patch:
|
||||
labels:
|
||||
- "fix"
|
||||
- "bugfix"
|
||||
- "bug"
|
||||
- "chore"
|
||||
- "dependencies"
|
||||
default: patch
|
||||
template: |
|
||||
## Changes
|
||||
|
||||
$CHANGES
|
2
.github/workflows/ci-remote-image.yaml
vendored
2
.github/workflows/ci-remote-image.yaml
vendored
@ -3,8 +3,6 @@ name: ci-remote-image
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '.env'
|
||||
|
||||
jobs:
|
||||
run-remote-image-docker-compose:
|
||||
|
22
.github/workflows/ci.yaml
vendored
22
.github/workflows/ci.yaml
vendored
@ -30,25 +30,3 @@ jobs:
|
||||
LINTER_RULES_PATH: .github/linters
|
||||
VALIDATE_ALL_CODEBASE: false
|
||||
VALIDATE_JSCPD: false
|
||||
|
||||
build-and-run-docker-compose:
|
||||
needs:
|
||||
- lint-docker-compose-file
|
||||
- super-linter
|
||||
timeout-minutes: 20
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: build docker containers
|
||||
run: .github/docker-image-build.sh
|
||||
|
||||
- name: run docker-compose up
|
||||
run: docker-compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.override-local.yml up --detach
|
||||
|
||||
- name: add autowizard file
|
||||
run: docker cp .github/auto_wizard.json zammad-docker-compose_zammad-railsserver_1:/opt/zammad
|
||||
|
||||
- name: run tests
|
||||
run: .github/tests.sh
|
||||
|
22
.github/workflows/release-drafter.yaml
vendored
Normal file
22
.github/workflows/release-drafter.yaml
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
name: Release Drafter
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
types: [opened, reopened, synchronize]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
update_release_draft:
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: release-drafter/release-drafter@v5
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
@ -1,65 +0,0 @@
|
||||
# note: zammad is currently incompatible to alpine because of:
|
||||
# https://github.com/docker-library/ruby/issues/113
|
||||
FROM ruby:3.0.4-slim AS builder
|
||||
|
||||
ARG BUILD_DATE
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
ENV GIT_BRANCH stable
|
||||
ENV GIT_URL ${PROJECT_URL}.git
|
||||
ENV PROJECT_URL https://github.com/zammad/zammad
|
||||
ENV RAILS_ENV production
|
||||
ENV RAILS_LOG_TO_STDOUT true
|
||||
ENV TAR_GZ_URL ${PROJECT_URL}/archive/${GIT_BRANCH}.tar.gz
|
||||
ENV ZAMMAD_DIR /opt/zammad
|
||||
ENV ZAMMAD_READY_FILE ${ZAMMAD_DIR}/tmp/zammad.ready
|
||||
ENV ZAMMAD_TMP_DIR /tmp/zammad-${GIT_BRANCH}
|
||||
ENV ZAMMAD_USER zammad
|
||||
|
||||
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]
|
||||
|
||||
# install zammad
|
||||
COPY containers/zammad/setup.sh /tmp
|
||||
RUN chmod +x /tmp/setup.sh; \
|
||||
/tmp/setup.sh builder
|
||||
|
||||
|
||||
FROM ruby:3.0.4-slim
|
||||
|
||||
ARG BUILD_DATE
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
LABEL org.label-schema.build-date="$BUILD_DATE" \
|
||||
org.label-schema.name="Zammad" \
|
||||
org.label-schema.license="AGPL-3.0" \
|
||||
org.label-schema.description="Docker container for Zammad - Data Container" \
|
||||
org.label-schema.url="https://zammad.org" \
|
||||
org.label-schema.vcs-url="https://github.com/zammad/zammad" \
|
||||
org.label-schema.vcs-type="Git" \
|
||||
org.label-schema.vendor="Zammad" \
|
||||
org.label-schema.schema-version="5.2.3" \
|
||||
org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up"
|
||||
|
||||
ENV GIT_BRANCH stable
|
||||
ENV RAILS_ENV production
|
||||
ENV RAILS_LOG_TO_STDOUT true
|
||||
ENV ZAMMAD_DIR /opt/zammad
|
||||
ENV ZAMMAD_READY_FILE ${ZAMMAD_DIR}/tmp/zammad.ready
|
||||
ENV ZAMMAD_TMP_DIR /tmp/zammad-${GIT_BRANCH}
|
||||
ENV ZAMMAD_USER zammad
|
||||
|
||||
COPY containers/zammad/setup.sh /tmp
|
||||
RUN chmod +x /tmp/setup.sh; \
|
||||
/tmp/setup.sh runner
|
||||
|
||||
COPY --from=builder ${ZAMMAD_TMP_DIR} ${ZAMMAD_TMP_DIR}
|
||||
COPY --from=builder /usr/local/bundle /usr/local/bundle
|
||||
|
||||
# docker init
|
||||
COPY containers/zammad/docker-entrypoint.sh /
|
||||
RUN chmod +x /docker-entrypoint.sh
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
|
||||
USER zammad
|
||||
|
||||
WORKDIR ${ZAMMAD_DIR}
|
@ -1,173 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
: "${AUTOWIZARD_JSON:=''}"
|
||||
: "${ELASTICSEARCH_ENABLED:=true}"
|
||||
: "${ELASTICSEARCH_HOST:=zammad-elasticsearch}"
|
||||
: "${ELASTICSEARCH_PORT:=9200}"
|
||||
: "${ELASTICSEARCH_SCHEMA:=http}"
|
||||
: "${ELASTICSEARCH_NAMESPACE:=zammad}"
|
||||
: "${ELASTICSEARCH_REINDEX:=true}"
|
||||
: "${ELASTICSEARCH_SSL_VERIFY:=true}"
|
||||
: "${NGINX_PORT:=8080}"
|
||||
: "${NGINX_SERVER_NAME:=_}"
|
||||
: "${NGINX_SERVER_SCHEME:=\$scheme}"
|
||||
: "${POSTGRESQL_HOST:=zammad-postgresql}"
|
||||
: "${POSTGRESQL_PORT:=5432}"
|
||||
: "${POSTGRESQL_USER:=zammad}"
|
||||
: "${POSTGRESQL_PASS:=zammad}"
|
||||
: "${POSTGRESQL_DB:=zammad_production}"
|
||||
: "${POSTGRESQL_DB_CREATE:=true}"
|
||||
: "${RAILS_TRUSTED_PROXIES:=['127.0.0.1', '::1']}"
|
||||
: "${RSYNC_ADDITIONAL_PARAMS:=--no-perms --no-owner}"
|
||||
: "${ZAMMAD_RAILSSERVER_HOST:=zammad-railsserver}"
|
||||
: "${ZAMMAD_RAILSSERVER_PORT:=3000}"
|
||||
: "${ZAMMAD_WEBSOCKET_HOST:=zammad-websocket}"
|
||||
: "${ZAMMAD_WEBSOCKET_PORT:=6042}"
|
||||
: "${ZAMMAD_WEB_CONCURRENCY:=0}"
|
||||
|
||||
function check_zammad_ready {
|
||||
sleep 15
|
||||
until [ -f "${ZAMMAD_READY_FILE}" ]; do
|
||||
echo "waiting for init container to finish install or update..."
|
||||
sleep 10
|
||||
done
|
||||
}
|
||||
|
||||
# zammad init
|
||||
if [ "$1" = 'zammad-init' ]; then
|
||||
# install / update zammad
|
||||
test -f "${ZAMMAD_READY_FILE}" && rm "${ZAMMAD_READY_FILE}"
|
||||
# shellcheck disable=SC2086
|
||||
rsync -a ${RSYNC_ADDITIONAL_PARAMS} --delete --exclude 'public/assets/images/*' --exclude 'storage/fs/*' "${ZAMMAD_TMP_DIR}/" "${ZAMMAD_DIR}"
|
||||
# shellcheck disable=SC2086
|
||||
rsync -a ${RSYNC_ADDITIONAL_PARAMS} "${ZAMMAD_TMP_DIR}"/public/assets/images/ "${ZAMMAD_DIR}"/public/assets/images
|
||||
|
||||
until (echo > /dev/tcp/"${POSTGRESQL_HOST}"/"${POSTGRESQL_PORT}") &> /dev/null; do
|
||||
echo "zammad railsserver waiting for postgresql server to be ready..."
|
||||
sleep 5
|
||||
done
|
||||
|
||||
cd "${ZAMMAD_DIR}"
|
||||
|
||||
# configure database
|
||||
# https://stackoverflow.com/questions/407523/escape-a-string-for-a-sed-replace-pattern
|
||||
ESCAPED_POSTGRESQL_PASS=$(echo "$POSTGRESQL_PASS" | sed -e 's/[\/&]/\\&/g')
|
||||
sed -e "s#.*adapter:.*# adapter: postgresql#g" -e "s#.*database:.*# database: ${POSTGRESQL_DB}#g" -e "s#.*username:.*# username: ${POSTGRESQL_USER}#g" -e "s#.*password:.*# password: ${ESCAPED_POSTGRESQL_PASS}\\n host: ${POSTGRESQL_HOST}\\n port: ${POSTGRESQL_PORT}#g" < contrib/packager.io/database.yml.pkgr > config/database.yml
|
||||
|
||||
# configure trusted proxies
|
||||
sed -i -e "s#config.action_dispatch.trusted_proxies =.*#config.action_dispatch.trusted_proxies = ${RAILS_TRUSTED_PROXIES}#" config/environments/production.rb
|
||||
|
||||
# check if database exists / update to new version
|
||||
echo "initialising / updating database..."
|
||||
if ! (bundle exec rails r 'puts User.any?' 2> /dev/null | grep -q true); then
|
||||
if [ "${POSTGRESQL_DB_CREATE}" == "true" ]; then
|
||||
bundle exec rake db:create
|
||||
fi
|
||||
bundle exec rake db:migrate
|
||||
bundle exec rake db:seed
|
||||
|
||||
# create autowizard.json on first install
|
||||
if base64 -d <<< ${AUTOWIZARD_JSON} &>> /dev/null; then
|
||||
echo "Saving autowizard json payload..."
|
||||
base64 -d <<< "${AUTOWIZARD_JSON}" > auto_wizard.json
|
||||
fi
|
||||
else
|
||||
bundle exec rails r "Cache.clear"
|
||||
bundle exec rake db:migrate
|
||||
fi
|
||||
|
||||
# es config
|
||||
echo "changing settings..."
|
||||
if [ "${ELASTICSEARCH_ENABLED}" == "false" ]; then
|
||||
bundle exec rails r "Setting.set('es_url', '')"
|
||||
else
|
||||
bundle exec rails r "Setting.set('es_url', '${ELASTICSEARCH_SCHEMA}://${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}')"
|
||||
|
||||
bundle exec rails r "Setting.set('es_index', '${ELASTICSEARCH_NAMESPACE}')"
|
||||
|
||||
if [ -n "${ELASTICSEARCH_USER}" ] && [ -n "${ELASTICSEARCH_PASS}" ]; then
|
||||
bundle exec rails r "Setting.set('es_user', \"${ELASTICSEARCH_USER}\")"
|
||||
bundle exec rails r "Setting.set('es_password', \"${ELASTICSEARCH_PASS}\")"
|
||||
fi
|
||||
|
||||
until (echo > /dev/tcp/${ELASTICSEARCH_HOST}/${ELASTICSEARCH_PORT}) &> /dev/null; do
|
||||
echo "zammad railsserver waiting for elasticsearch server to be ready..."
|
||||
sleep 5
|
||||
done
|
||||
|
||||
if [ "${ELASTICSEARCH_SSL_VERIFY}" == "false" ]; then
|
||||
SSL_SKIP_VERIFY="-k"
|
||||
else
|
||||
SSL_SKIP_VERIFY=""
|
||||
fi
|
||||
|
||||
if [ "${ELASTICSEARCH_REINDEX}" == "true" ]; then
|
||||
if ! curl -s "${SSL_SKIP_VERIFY}" "${ELASTICSEARCH_SCHEMA}://${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}/_cat/indices" | grep -q zammad; then
|
||||
echo "rebuilding es searchindex..."
|
||||
bundle exec rake zammad:searchindex:rebuild
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# create install ready file
|
||||
echo 'zammad-init' > "${ZAMMAD_READY_FILE}"
|
||||
fi
|
||||
|
||||
|
||||
# zammad nginx
|
||||
if [ "$1" = 'zammad-nginx' ]; then
|
||||
check_zammad_ready
|
||||
|
||||
# configure nginx
|
||||
sed -e "s#\(listen\)\(.*\)80#\1\2${NGINX_PORT}#g" \
|
||||
-e "s#proxy_set_header X-Forwarded-Proto .*;#proxy_set_header X-Forwarded-Proto ${NGINX_SERVER_SCHEME};#g" \
|
||||
-e "s#server .*:3000#server ${ZAMMAD_RAILSSERVER_HOST}:${ZAMMAD_RAILSSERVER_PORT}#g" \
|
||||
-e "s#server .*:6042#server ${ZAMMAD_WEBSOCKET_HOST}:${ZAMMAD_WEBSOCKET_PORT}#g" \
|
||||
-e "s#server_name .*#server_name ${NGINX_SERVER_NAME};#g" \
|
||||
-e 's#/var/log/nginx/zammad.\(access\|error\).log#/dev/stdout#g' < contrib/nginx/zammad.conf > /etc/nginx/sites-enabled/default
|
||||
|
||||
echo "starting nginx..."
|
||||
|
||||
exec /usr/sbin/nginx -g 'daemon off;'
|
||||
fi
|
||||
|
||||
|
||||
# zammad-railsserver
|
||||
if [ "$1" = 'zammad-railsserver' ]; then
|
||||
test -f /opt/zammad/tmp/pids/server.pid && rm /opt/zammad/tmp/pids/server.pid
|
||||
|
||||
check_zammad_ready
|
||||
|
||||
cd "${ZAMMAD_DIR}"
|
||||
|
||||
echo "starting railsserver... with WEB_CONCURRENCY=${ZAMMAD_WEB_CONCURRENCY}"
|
||||
|
||||
#shellcheck disable=SC2101
|
||||
exec bundle exec puma -b tcp://[::]:"${ZAMMAD_RAILSSERVER_PORT}" -w "${ZAMMAD_WEB_CONCURRENCY}" -e "${RAILS_ENV}"
|
||||
fi
|
||||
|
||||
|
||||
# zammad-scheduler
|
||||
if [ "$1" = 'zammad-scheduler' ]; then
|
||||
check_zammad_ready
|
||||
|
||||
cd "${ZAMMAD_DIR}"
|
||||
|
||||
echo "starting background services..."
|
||||
|
||||
exec bundle exec script/background-worker.rb start
|
||||
fi
|
||||
|
||||
|
||||
# zammad-websocket
|
||||
if [ "$1" = 'zammad-websocket' ]; then
|
||||
check_zammad_ready
|
||||
|
||||
cd "${ZAMMAD_DIR}"
|
||||
|
||||
echo "starting websocket server..."
|
||||
|
||||
exec bundle exec script/websocket-server.rb -b 0.0.0.0 -p "${ZAMMAD_WEBSOCKET_PORT}" start
|
||||
fi
|
@ -1,59 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# install dependencies
|
||||
if [ "$1" = 'builder' ]; then
|
||||
PACKAGES="build-essential curl git libimlib2-dev libpq-dev shared-mime-info"
|
||||
elif [ "$1" = 'runner' ]; then
|
||||
PACKAGES="curl libimlib2 libpq5 nginx rsync"
|
||||
fi
|
||||
|
||||
apt-get update
|
||||
apt-get upgrade -y
|
||||
# shellcheck disable=SC2086
|
||||
apt-get install -y --no-install-recommends ${PACKAGES}
|
||||
|
||||
if [ "$1" = 'builder' ]; then
|
||||
# Install Node.js 16 repository from Nodesource
|
||||
apt-get --no-install-recommends -y install gnupg
|
||||
KEYRING=/usr/share/keyrings/nodesource.gpg
|
||||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | tee "$KEYRING" >/dev/null
|
||||
cat - > /etc/apt/sources.list.d/nodesource.list <<NODESOURCE_LIST
|
||||
deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x buster main
|
||||
NODESOURCE_LIST
|
||||
|
||||
apt-get update
|
||||
apt-get --no-install-recommends -y install nodejs
|
||||
npm -g install yarn
|
||||
fi
|
||||
|
||||
# Clean-up
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# install zammad
|
||||
groupadd -g 1000 "${ZAMMAD_USER}"
|
||||
useradd -M -d "${ZAMMAD_DIR}" -s /bin/bash -u 1000 -g 1000 "${ZAMMAD_USER}"
|
||||
|
||||
if [ "$1" = 'builder' ]; then
|
||||
cd "$(dirname "${ZAMMAD_TMP_DIR}")"
|
||||
curl -s -J -L -O "${TAR_GZ_URL}"
|
||||
tar -xzf zammad-"${GIT_BRANCH}".tar.gz
|
||||
rm zammad-"${GIT_BRANCH}".tar.gz
|
||||
cd "${ZAMMAD_TMP_DIR}"
|
||||
bundle config set without 'test development mysql'
|
||||
bundle install
|
||||
sed -e 's#.*adapter: postgresql# adapter: nulldb#g' -e 's#.*username:.*# username: postgres#g' -e 's#.*password:.*# password: \n host: zammad-postgresql\n#g' < contrib/packager.io/database.yml.pkgr > config/database.yml
|
||||
sed -i "/require 'rails\/all'/a require\ 'nulldb'" config/application.rb
|
||||
touch db/schema.rb
|
||||
bundle exec rake assets:precompile
|
||||
rm -r tmp/cache
|
||||
script/build/cleanup.sh
|
||||
chown -R "${ZAMMAD_USER}":"${ZAMMAD_USER}" "${ZAMMAD_TMP_DIR}"
|
||||
fi
|
||||
|
||||
# set nginx file permissions and settings
|
||||
if [ "$1" = 'runner' ]; then
|
||||
sed -i -e "s#user www-data;##g" -e 's#/var/log/nginx/\(access\|error\).log#/dev/stdout#g' -e 's#pid /run/nginx.pid;#pid /tmp/nginx.pid;#g' /etc/nginx/nginx.conf
|
||||
mkdir -p "${ZAMMAD_DIR}" /var/log/nginx
|
||||
chown -R "${ZAMMAD_USER}":"${ZAMMAD_USER}" /etc/nginx "${ZAMMAD_DIR}" /var/lib/nginx /var/log/nginx
|
||||
fi
|
Loading…
Reference in New Issue
Block a user