zammad-docker-compose/containers/zammad-railsserver/docker-entrypoint.sh

31 lines
810 B
Bash
Raw Normal View History

2016-12-17 11:10:51 +00:00
#!/bin/bash
if [ "$1" = 'zammad-railsserver' ]; then
2016-12-17 11:10:51 +00:00
cd ${ZAMMAD_DIR}
2017-01-09 17:51:09 +00:00
bundle exec 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
2017-01-10 00:42:58 +00:00
find ${ZAMMAD_DIR}/log -iname *.log -exec rm {} \;
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: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
fi