zammad-docker-compose/docker-entrypoint.sh

42 lines
994 B
Bash
Raw Normal View History

2016-12-17 11:10:51 +00:00
#!/bin/bash
2016-12-20 12:51:56 +00:00
if [ "$1" = 'zammad' ]; then
2016-12-17 11:10:51 +00:00
cd ${ZAMMAD_DIR}
rake db:migrate &> /dev/null
2016-12-19 20:26:04 +00:00
if [ $? != 0 ]; then
echo "creating db, assets, searchindex..."
2016-12-17 11:10:51 +00:00
rake db:create
rake db:migrate
rake db:seed
rails r "Setting.set('es_url', 'http://elasticsearch:9200')"
2016-12-21 02:31:31 +00:00
rake searchindex:rebuild
2016-12-17 11:10:51 +00:00
fi
# delete logs & pids
2016-12-17 11:10:51 +00:00
rm ${ZAMMAD_DIR}/log/*
rm ${ZAMMAD_DIR}/tmp/pids/*
# run zammad
echo "starting zammad..."
2016-12-17 12:23:29 +00:00
echo "zammad will be accessable on http://localhost in some seconds"
2016-12-19 20:26:04 +00:00
bundle exec script/websocket-server.rb -b 0.0.0.0 start &
bundle exec script/scheduler.rb start &
2016-12-19 20:39:15 +00:00
2016-12-19 20:26:04 +00:00
if [ "${RAILS_SERVER}" == "puma" ]; then
bundle exec puma -b tcp://0.0.0.0:3000 -e ${RAILS_ENV}
2016-12-19 20:26:04 +00:00
elif [ "${RAILS_SERVER}" == "unicorn" ]; then
bundle exec unicorn -p 3000 -c config/unicorn.rb -E ${RAILS_ENV}
2016-12-19 20:26:04 +00:00
fi
2016-12-17 11:10:51 +00:00
if [ "${ZAMMAD_DEBUG}" == "yes" ]; then
2016-12-17 11:10:51 +00:00
# keepalive if error
while true; do
echo "debugging..."
sleep 600
done
fi
fi