Trying to deploy docker image to sub URL
Added by Steve Cleveland almost 4 years ago
Running 4.1.1 (redmine:4 in docker)
It runs fine using port mapping to a local port 3000.
My next step is to put it behind apache using reverse proxy. I have an entry like this:
<Location "/redmine"> ProxyPass http://localhost:3000 ProxyPassReverse http://localhost:3000 </Location>
That by itself results in broken links to css, js, etc. So I mapped a volume to environment.rb. The end of that file looks like this:
ActionController::Base.relative_url_root = "/redmine" # Initialize the Rails application Rails.application.initialize! Redmine::Utils::relative_url_root = "/redmine"
That actually loads the home page correctly. It's getting css and javascript at /redmine. But all of the links are still relative to the root of the site. For instance, the link to "Sign in" is /login instead of /redmine/login. If I manually go to /redmine/login, it renders fine, but the POST goes to /login again.
The documentation for using a sub directory is really hard to follow (https://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_in_a_sub-URI). And I think I've done all I can do. I don't know what else I could be missing.
I don't think this is docker specific. I just think I'm missing something in Redmine.
Any help is appreciated.
Environment: Redmine version 4.1.1.stable Ruby version 2.6.6-p146 (2020-03-31) [x86_64-linux] Rails version 5.2.4.2 Environment production Database adapter SQLite Mailer queue ActiveJob::QueueAdapters::AsyncAdapter Mailer delivery smtp SCM: Subversion 1.10.4 Mercurial 4.8.2 Bazaar 2.8.0 Git 2.20.1 Filesystem Redmine plugins: no plugin installed
Replies (3)
RE: Trying to deploy docker image to sub URL - Added by Andrei Ryjov almost 4 years ago
Does your (shell?) environment has RAILS_RELATIVE_URL_ROOT variable?
Something like in Bash:
export RAILS_RELATIVE_URL_ROOT=/redmine
or you can specify the env variable setting in container run/start command
spent few days cracking that too ))
RE: Trying to deploy docker image to sub URL - Added by Steve Cleveland almost 4 years ago
I saw a reference to something Redmine specific in a ticket, but by the end it appeared to not have been implemented. This appears to be a rails thing. I will try it.
RE: Trying to deploy docker image to sub URL - Added by Steve Cleveland almost 4 years ago
I added it as an environment variable to the docker run command. I see it in 'set' output from inside the container. But it doesn't appear to do anything. Opening port 3000 directly or through the proxy, the links are still relative to / instead of /redmine. That was with and without the changes to environment.rb.