Skip to content

A GitLab page server. Similar to the built-in page server, but with some additional features.

License

Notifications You must be signed in to change notification settings

pauldotknopf/gitlab-page-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gitlab-page-server

A GitLab page server. Similar to the built-in page server, but with some additional features.

Build Status

Details

Installation

  1. Run the server. Example docker-compose.yml file here. Configurable options here.
    • At a bare minimum, you should have the following configured for things to work properly.
    {
      "Pages": {
        "ServerUrl": "http://192.168.0.6",
        "AuthToken": "AdNAuSLZxGvU1cHycNxU"
      }
    }
    
    This configuration should go in a config.json file in the working directory of the running server.
  2. On GitLab under Project > Settings > Integrations, add a web hook that points to https://your-page-server-instance.com/hook and tick the following:
    • Job events
    • Pipeline events

That's it. Visit your-domain.com/group/project to serve your static pages.

Endpoints

  • 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 is pages by default.

More options

Logging

Defaults:

{
  "Logging": {
    "MinimumLevel": "Information"
  }
}

Pages

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 to gitlab.com or 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 url your-domain.com/group/project will 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 visiting your-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.

About

A GitLab page server. Similar to the built-in page server, but with some additional features.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published