zammad-docker-compose/docker-entrypoint.sh

42 lines
1.0 KiB
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
2017-01-07 16:03:38 +00:00
echo "creating db & searchindex..."
bundle exec rake db:create
bundle exec rake db:migrate
bundle exec rake db:seed
bundle exec rails r "Setting.set('es_url', 'http://elasticsearch:9200')"
bundle exec rake searchindex:rebuild
2016-12-17 11:10:51 +00:00
fi
# delete logs & pids
2017-01-07 16:03:38 +00:00
rm ${ZAMMAD_DIR}/log/*.log
rm ${ZAMMAD_DIR}/tmp/pids/*.pid
2016-12-17 11:10:51 +00:00
# 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