travis-api/script/server
2015-10-09 09:19:07 +02:00

27 lines
742 B
Bash
Executable File

#!/usr/bin/env bash
cd "$(dirname "$0")/.."
. config/ruby_config.sh
[ $PORT ] || export PORT=3000
[ $RACK_ENV ] || export RACK_ENV=development
[ $WEB_CONCURRENCY ] || export WEB_CONCURRENCY=$(script/web_concurrency)
[ $NGINX_WORKERS ] || export NGINX_WORKERS=$(script/web_concurrency --nginx)
echo "port=$PORT rack_env=$RACK_ENV web_concurrency=$WEB_CONCURRENCY nginx_workers=$NGINX_WORKERS" >&2
ruby="ruby -I lib -S"
bexc="$ruby bundle exec"
if [[ $RACK_ENV == "production" ]]; then
export tmp_dir=/tmp
else
mkdir -p tmp
export tmp_dir=./tmp
fi
cmd="unicorn config.ru -E $RACK_ENV -c config/unicorn.rb"
[[ $RACK_ENV == "development" ]] && cmd="rerun -b -- $cmd"
cmd="bin/start-nginx $bexec je $cmd"
exec $cmd