made docker container work with subdirectory (RAILS_RELATIVE_URL_ROOT)

pull/7998/head
Markus Kahl 5 years ago
parent 22d5f77d8e
commit 7bb59dde9e
  1. 9
      config.ru
  2. 2
      docker/precompile-assets.sh
  3. 11
      docker/supervisord

@ -48,14 +48,7 @@ if defined?(Unicorn) && Rails.env.production?
use Unicorn::WorkerKiller::MaxRequests, min_req, max_req
end
##
# Returns true if the application should be run under a subdirectory.
def map_subdir?
# Don't map subdir when using Passenger as passenger takes care of that.
!defined?(::PhusionPassenger)
end
subdir = map_subdir? && OpenProject::Configuration.rails_relative_url_root.presence
subdir = OpenProject::Configuration.rails_relative_url_root.presence
map (subdir || '/') do
use Rack::Protection::JsonCsrf

@ -3,6 +3,8 @@ set -e
pushd "${APP_PATH}/frontend"
export NG_CLI_ANALYTICS=ci # so angular cli doesn't block waiting for user input
# Installing frontend dependencies
RAILS_ENV=production npm install

@ -68,9 +68,8 @@ migrate() {
wait_for_postgres
pushd $APP_PATH >/dev/null
/etc/init.d/memcached start
bundle exec rake db:migrate db:seed db:structure:dump
bundle exec rake db:migrate db:seed
/etc/init.d/memcached stop
chown "$APP_USER.$APP_USER" db/structure.sql
popd >/dev/null
}
@ -111,5 +110,13 @@ fi
echo "-----> Database setup finished."
echo " On first installation, the default admin credentials are login: admin, password: admin"
if [ -n "$OPENPROJECT_RAILS__RELATIVE__URL__ROOT" ]; then
echo
echo "-----> Precompiling assets since RAILS_RELATIVE_URL_ROOT is set. This may take a minute."
RAILS_RELATIVE_URL_ROOT=$OPENPROJECT_RAILS__RELATIVE__URL__ROOT bash /app/docker/precompile-assets.sh
echo "-----> Asset precompilation finished."
echo
fi
echo "-----> Launching supervisord..."
exec /usr/bin/supervisord -c $APP_PATH/docker/supervisord.conf -e ${SUPERVISORD_LOG_LEVEL}

Loading…
Cancel
Save