. /usr/local/lib/arvbox/common.sh
+if test "$1" != "--only-deps" ; then
+ while [ ! -f $ARVADOS_CONTAINER_PATH/api.ready ]; do
+ sleep 1
+ done
+fi
+
cd /usr/src/arvados/apps/workbench
-if test -s /var/lib/arvados/workbench_rails_env ; then
- export RAILS_ENV=$(cat /var/lib/arvados/workbench_rails_env)
+if test -s $ARVADOS_CONTAINER_PATH/workbench_rails_env ; then
+ export RAILS_ENV=$(cat $ARVADOS_CONTAINER_PATH/workbench_rails_env)
else
export RAILS_ENV=development
fi
-run_bundler --without=development
-bundle exec passenger start --runtime-check-only --runtime-dir=/var/lib/passenger
+run_bundler --without=development --binstubs
+flock $GEM_HOME/gems.lock bin/passenger-config build-native-support
+flock $GEM_HOME/gems.lock bin/passenger-config install-standalone-runtime
mkdir -p /usr/src/arvados/apps/workbench/tmp
-RAILS_GROUPS=assets bundle exec rake npm:install
if test "$1" = "--only-deps" ; then
- exit
-fi
-
-set -u
-
-if ! test -s /var/lib/arvados/workbench_secret_token ; then
- ruby -e 'puts rand(2**400).to_s(36)' > /var/lib/arvados/workbench_secret_token
-fi
-secret_token=$(cat /var/lib/arvados/workbench_secret_token)
-
-if ! test -s self-signed.key ; then
- openssl req -new -x509 -nodes -out self-signed.pem -keyout self-signed.key -days 365 -subj '/CN=localhost'
-fi
-
+ # Workaround for validation that asserts there's a download URL
+ # configured, which breaks rake if it is missing.
cat >config/application.yml <<EOF
$RAILS_ENV:
- secret_token: $secret_token
- arvados_login_base: https://$localip:${services[api]}/login
- arvados_v1_base: https://$localip:${services[api]}/arvados/v1
- arvados_insecure_https: true
- keep_web_download_url: http://$localip:${services[keep-web]}/c=%{uuid_or_pdh}
- keep_web_url: http://$localip:${services[keep-web]}/c=%{uuid_or_pdh}
- arvados_docsite: http://$localip:${services[doc]}/
- force_ssl: false
+ keep_web_url: https://example.com/c=%{uuid_or_pdh}
EOF
+ RAILS_GROUPS=assets flock $GEM_HOME/gems.lock bin/rake npm:install
+ rm config/application.yml
+ exit
+fi
+
+set -u
-bundle exec rake assets:precompile
+secret_token=$(cat $ARVADOS_CONTAINER_PATH/workbench_secret_token)
-(cd config && /usr/local/lib/arvbox/application_yml_override.py)
+RAILS_GROUPS=assets flock $GEM_HOME/gems.lock bin/rake npm:install
+flock $GEM_HOME/gems.lock bin/rake assets:precompile