@aeppic/install-build-server

2.44.0 • Public • Published

Install

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=XYZ to 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

Purpose

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 @microsoft/rush

Security

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 !

Git clone. The server can only git clone projects the service account can clone via HTTP.

For now this means using git config --global credential.helper store and clone a project once manually at least.

Server prepare

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

API

Launch example server

  • PORT=8080
  • GITLAB_SECRETS=/opt/tokens.json

/opt/tokens.json contains ["MY_SECRET_TOKEN"]

node server.js

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

See builds

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

Notes

When running on Windows paths can be too long. Run git config --system core.longpaths true to ensure they work.

Readme

Keywords

none

Package Sidebar

Install

npm i @aeppic/install-build-server

Weekly Downloads

115

Version

2.44.0

License

MIT

Unpacked Size

210 kB

Total Files

53

Last publish

Collaborators

  • matthiasg