Setting up a `relative_url_root` with the GDK?
Trying to setup a relative_url_root
on my local dev instance, https://docs.gitlab.com/ce/install/relative_url.html
I've had to modify a few more areas for the newish webpack-dev-server
webpack.config.js
, Add under IS_DEV_SERVER
:
const relativeRoot = '/gitlab';
config.output.publicPath = '//localhost:' + DEV_SERVER_PORT + relativeRoot + config.output.publicPath;
application.rb
, Update
config.webpack.public_path = "gitlab/assets/webpack"
Also instead of step 6 in the guide(update gitlab_workhorse_options
in the init.d
/etc/default/gitlab
), I found gitlab-workhorse
in the gdk/Procfile
and added -authBackend http://127.0.0.1:8080/gitlab
(also tried port 3000) and restarted app but no change to the following issue.
I can't get past this CSRF warning when serving the webpack assets. What's interesting is the path in the heading of the warning page is /assets/webpack/application.js
while I am actually visiting http://localhost:3000/gitlab/assets/webpack/application.js
where I expect it to serve and script tags are pointed at. I assume I am missing one more piece of config to get these aligned.
422 Unprocessable Entity
ActionController::InvalidCrossOriginRequest at /assets/webpack/application.js
Security warning: an embedded
<script>
tag on another site requested protected JavaScript. If you know what you're doing, go ahead and disable forgery protection on this action to permit cross-origin JavaScript embedding.
Perhaps something to do with webpack_proxy.rb
?
If you compile the assets and disable webpack, things work. Which deduces things going awry in webpack-dev-server
or webpack_proxy
(rack proxy).
bundle exec rake gitlab:assets:compile
- Comment out
webpack
related things inconfig/gitlab.yml
- Restart app
If recompiling the assets manually every time you make a change is becoming a pain, you can [purge the compiled assets(see below) and] run webpack manually with
NODE_ENV=production node_modules/.bin/webpack --config config/webpack.config.js --watch
and it will operate more or less like it does in dev-server mode
When you want to go back and delete all of the compiled assets, bundle exec rake gitlab:assets:purge
Thanks @mikegreiling for walking me down this path
https://gitlab.slack.com/archives/development/p1487927726007676