Enable GitLab to run in production without Node.js
As I understand it, Node.js is currently a dependency in GitLab's omnibus package for one sole purpose, and that is to allow sprockets to recompile the frontend assets if a user chooses to install GitLab into a subdirectory instead of /
. A few assets (CSS, some async-loading JS libraries, etc) have the absolute root URL hardcoded which prevents them from working correctly at any other URL.
However, I am convinced that the number of assets which need special attention is few, and we can do away with the need to include some unnecessary libraries and runtime environments in production if we can alter a couple of things in our build process.
We can:
- Make our CSS
url(/assets/foo);
resolutions into relative urls - Update the Ace editor async config to recognize the correct base url dynamically using
gon.relative_url_root
which is already exposed on the frontend. - Check for any other edge cases in our assets and fix them as well
After this we can remove the rake assets:precompile
command from gitlab-ctl reconfigure
and instead compile our assets in an earlier CI build step, injecting the output into the build images for each platform.
Benefits:
- Remove Node.js runtime from production (no longer need to make Node.js play nice with CentOS 6 for example)
- Use a more modern and consistent Node.js and NPM version in this pre-build step (useful when we start working with webpack or more recent version of babel)
- Remove
assets:precompile
steps for relative url configuration in the install docs
/cc @marin