npx @aeppic/install-build-server installs or updates the a build server to version, build, and package builds.
If a secret is wanted and this is the first time running the install script you can use the parameter
--gitlab-secrets-initial=XYZto set the initial secrets that will be configured. The parameter will also overwrite any existing configuration if provided.
It automatically registers (installs) the service as a SystemD service under
/etc/systemd/system but does not enable or start it yet.
The builds can be triggered via a webhook or a simple post call
Allow gitlab pipelines to trigger executing scripts on a build server which can clone a project similar to Gitlab CI but also easily commit and push back more complicated configurations such as with
Triggering can be secured with a
X-Gitlab-Token which can be set in the trigger pipeline of Gitlab.
Note; The build website is publicly accessible and unsecured. Make sure there are no secrets in the build log !
The server needs to be configured with appropriate npm and git settings to read, commit and publish if the scripts to that.
Note: When run as
root. Do not forget to
npm config set unsafe-perm true Article
Note: Ensure these settings are reachable from the user executing the service in a NON-interactive shell. E.g. .bashrc will not be loaded when a service executes
Launch example server
/opt/tokens.json contains ["MY_SECRET_TOKEN"]
Trigger a build
Using a gitlab token as should be configured in the GitLab webhooks
curl -XPOST -H "Content-Type: application/json" -H "X-Gitlab-Token: MY_SECRET_TOKEN" --data @examples/pipeline-event.json http://localhost:8080/gitlab
curl http://localhost:8080/log to get a json array of recent jobs
curl http://localhost:8080/retry/:id to re-run a build based on the id
http://localhost:8080 to see the UI
curl http://localhost:8080/log/:id to get the build log as html
curl http://localhost:8080/log/:id?wrapped to get the build log with some html wrapper
When running on Windows paths can be too long. Run
git config --system core.longpaths true to ensure they work.