A GitLab page server. Similar to the built-in page server, but with some additional features.
- Run the server. Example
docker-compose.ymlfile here. Configurable options here.- At a bare minimum, you should have the following configured for things to work properly.
This configuration should go in a{ "Pages": { "ServerUrl": "http://192.168.0.6", "AuthToken": "AdNAuSLZxGvU1cHycNxU" } }config.jsonfile in the working directory of the running server. - On GitLab under
Project > Settings > Integrations, add a web hook that points tohttps://your-page-server-instance.com/hookand tick the following:- Job events
- Pipeline events
That's it. Visit your-domain.com/group/project to serve your static pages.
your-domain.com/- Serves content from your configured"RootProject".your-domain.com/project/group/- Serve content from default branch/job for the repository.your-domain.com/project/group/-/pipeline/1/- Serve content from a specific pipeline. This is great for generating previews for merge requests.your-domain.com/project/group/-/job/1/- Serve content from a single job, typically your"BuildJobName", which ispagesby default.
Defaults:
{
"Logging": {
"MinimumLevel": "Information"
}
}
Defaults:
{
"Pages": {
"ServerUrl": null,
"AuthToken": null,
"HookToken": null,
"AdditionalParentGroups": 0,
"ArtifactsCacheDirectory": "artifacts",
"JobArtifactsBasePath": "public",
"RepositoryBranch": "master",
"BuildJobName": "pages",
"RootProject": null,
"CacheProjectType": "Sliding",
"CacheProjectSeconds": 60,
"CachePipelineType": "Sliding",
"CachePipelineSeconds": 60,
"CacheJobType": "Sliding",
"CacheJobSeconds": 60
}
}
Details:
"ServerUrl": You can point this togitlab.comor your own hosted GitLab instance."AuthToken": Generate this from your account settings."HookToken": The secret token, configured in GitLab, for the web hook. This ensures that only GitLab can post to your hook."AdditionalParentGroups": By default, all requests will attempt to match one parent group. Add more using this property. This allows you to have deep pages (your-domain.com/parent-group/sub-group/another-sub-group/project)."ArtifactsCacheDirectory": The location where the artifacts will be cached on disk. This path is relative to the working directory."JobArtifactsBasePath": The directory within the download artifacts that content will be served from."RepositoryBranch": The branch that the urlyour-domain.com/group/projectwill serve from."BuildJobName": The name of the job that artifacts will be downloaded from, within a pipeline."RootProject": The project that will be served when visitingyour-domain.com/. This is great for giving your domain a landing page at the root."Cache*": Various knobs for tuning caching. You likely won't need to change this. The web hooks will invalidate the cache when new artifacts are available.