fixed shellcheck errors
This commit is contained in:
parent
cae9c74ff8
commit
c8666402c4
@ -30,22 +30,22 @@ function check_zammad_ready {
|
||||
# zammad init
|
||||
if [ "$1" = 'zammad-init' ]; then
|
||||
# install / update zammad
|
||||
test -f ${ZAMMAD_READY_FILE} && rm ${ZAMMAD_READY_FILE}
|
||||
rsync -a --delete --exclude 'public/assets/images/*' --exclude 'storage/fs/*' ${ZAMMAD_TMP_DIR}/ ${ZAMMAD_DIR}
|
||||
rsync -a ${ZAMMAD_TMP_DIR}/public/assets/images/ ${ZAMMAD_DIR}/public/assets/images
|
||||
test -f "${ZAMMAD_READY_FILE}" && rm "${ZAMMAD_READY_FILE}"
|
||||
rsync -a --delete --exclude 'public/assets/images/*' --exclude 'storage/fs/*' "${ZAMMAD_TMP_DIR}/ ${ZAMMAD_DIR}"
|
||||
rsync -a "${ZAMMAD_TMP_DIR}"/public/assets/images/ "${ZAMMAD_DIR}"/public/assets/images
|
||||
|
||||
until (echo > /dev/tcp/${POSTGRESQL_HOST}/${POSTGRESQL_PORT}) &> /dev/null; do
|
||||
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}
|
||||
cd "${ZAMMAD_DIR}"
|
||||
|
||||
# configure database
|
||||
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: ${POSTGRESQL_PASS}\n host: ${POSTGRESQL_HOST}\n#g" < contrib/packager.io/database.yml.pkgr > config/database.yml
|
||||
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: ${POSTGRESQL_PASS}\\n host: ${POSTGRESQL_HOST}\\n#g" < contrib/packager.io/database.yml.pkgr > config/database.yml
|
||||
|
||||
# configure memcache
|
||||
sed -i -e "s/.*config.cache_store.*file_store.*cache_file_store.*/ config.cache_store = :dalli_store, '${MEMCACHED_HOST}:${MEMCACHED_PORT}'\n config.session_store = :dalli_store, '${MEMCACHED_HOST}:${MEMCACHED_PORT}'/" config/application.rb
|
||||
sed -i -e "s/.*config.cache_store.*file_store.*cache_file_store.*/ config.cache_store = :dalli_store, '${MEMCACHED_HOST}:${MEMCACHED_PORT}'\\n config.session_store = :dalli_store, '${MEMCACHED_HOST}:${MEMCACHED_PORT}'/" config/application.rb
|
||||
|
||||
echo "initialising / updating database..."
|
||||
|
||||
@ -62,7 +62,7 @@ if [ "$1" = 'zammad-init' ]; then
|
||||
set -e
|
||||
|
||||
# create database if not exists
|
||||
if [ "${DB_MIGRATE}" != "0" -a "${POSTGRESQL_DB_CREATE}" == "true" ]; then
|
||||
if [ "${DB_MIGRATE}" != "0" ] && [ "${POSTGRESQL_DB_CREATE}" == "true" ]; then
|
||||
echo "creating database..."
|
||||
bundle exec rake db:create
|
||||
fi
|
||||
@ -91,17 +91,17 @@ if [ "$1" = 'zammad-init' ]; then
|
||||
sleep 5
|
||||
done
|
||||
|
||||
if [ -z "$(curl -s ${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}/_cat/indices | grep zammad)" ]; then
|
||||
if curl -s ${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}/_cat/indices | grep -q zammad; then
|
||||
curl -s ${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}/_cat/indices
|
||||
echo "rebuilding es searchindex..."
|
||||
bundle exec rake searchindex:rebuild
|
||||
fi
|
||||
|
||||
# chown everything to zammad user
|
||||
chown -R ${ZAMMAD_USER}:${ZAMMAD_USER} ${ZAMMAD_DIR}
|
||||
chown -R "${ZAMMAD_USER}":"${ZAMMAD_USER}" "${ZAMMAD_DIR}"
|
||||
|
||||
# create install ready file
|
||||
su -c "echo 'zammad-init' > ${ZAMMAD_READY_FILE}" ${ZAMMAD_USER}
|
||||
su -c "echo 'zammad-init' > ${ZAMMAD_READY_FILE}" "${ZAMMAD_USER}"
|
||||
fi
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@ if [ "$1" = 'zammad-nginx' ]; then
|
||||
check_zammad_ready
|
||||
|
||||
# configure nginx
|
||||
if [ -z "$(env|grep KUBERNETES)" ]; then
|
||||
if env | grep -q KUBERNETES; then
|
||||
sed -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
|
||||
fi
|
||||
|
||||
@ -126,11 +126,11 @@ if [ "$1" = 'zammad-railsserver' ]; then
|
||||
|
||||
check_zammad_ready
|
||||
|
||||
cd ${ZAMMAD_DIR}
|
||||
cd "${ZAMMAD_DIR}"
|
||||
|
||||
echo "starting railsserver..."
|
||||
|
||||
exec gosu ${ZAMMAD_USER}:${ZAMMAD_USER} bundle exec rails server puma -b [::] -p ${ZAMMAD_RAILSSERVER_PORT} -e ${RAILS_ENV}
|
||||
exec gosu "${ZAMMAD_USER}":"${ZAMMAD_USER}" bundle exec rails server puma -b [::] -p "${ZAMMAD_RAILSSERVER_PORT}" -e "${RAILS_ENV}"
|
||||
fi
|
||||
|
||||
|
||||
@ -138,11 +138,11 @@ fi
|
||||
if [ "$1" = 'zammad-scheduler' ]; then
|
||||
check_zammad_ready
|
||||
|
||||
cd ${ZAMMAD_DIR}
|
||||
cd "${ZAMMAD_DIR}"
|
||||
|
||||
echo "starting scheduler..."
|
||||
|
||||
exec gosu ${ZAMMAD_USER}:${ZAMMAD_USER} bundle exec script/scheduler.rb run
|
||||
exec gosu "${ZAMMAD_USER}":"${ZAMMAD_USER}" bundle exec script/scheduler.rb run
|
||||
fi
|
||||
|
||||
|
||||
@ -150,9 +150,9 @@ fi
|
||||
if [ "$1" = 'zammad-websocket' ]; then
|
||||
check_zammad_ready
|
||||
|
||||
cd ${ZAMMAD_DIR}
|
||||
cd "${ZAMMAD_DIR}"
|
||||
|
||||
echo "starting websocket server..."
|
||||
|
||||
exec gosu ${ZAMMAD_USER}:${ZAMMAD_USER} bundle exec script/websocket-server.rb -b 0.0.0.0 -p ${ZAMMAD_WEBSOCKET_PORT} start
|
||||
exec gosu "${ZAMMAD_USER}":"${ZAMMAD_USER}" bundle exec script/websocket-server.rb -b 0.0.0.0 -p "${ZAMMAD_WEBSOCKET_PORT}" start
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user