GitHub Pages, for GitLab.
Glavin Wiechert (Glavin001) - Twitter @GlavinW - LinkedIn
It requires Jekyll to be installed. GitLab Pages will build Jekyll sites or simply copy content from non-jekyll sites to publicPagesDir
.
Create a SSH key pair for GitLab to use as deploy keys.
ssh-keygen -t rsa -C "example@email.com" -f "$(pwd)/keys/id_rsa"
They should be in path keys/id_rsa
and keys/id_rsa.pub
.
Clone this repo and install it's necessary dependencies:
# Already cloned repo
npm install
bower install
Copy default config to custom config file.
cp default_config.js _config.js
Edit your new _config.js file for your setup.
And start the server!
npm start
Login using your GitLab User Token at http://localhost:1337.
- User logs into Web UI, which authenticates against GitLab with node-gitlab and retrieves a private key for subsequent requests.
- Select the Project to enable GitLab Pages support for it. Available Projects list is pulled from GitLab with node-gitlab.
- The selected project will setup a Deploy Key and Webhook for GitLab Pages.
- When the user pushes to GitLab, a webhook event is sent to GitLab Pages server.
- The Webhook is handled by gitlab-webhook and the project is pulled (or cloned) with nodegit to the GitLab Pages configured clones install directory.
- The
gl-pages
branch is checked out with nodegit. (This can optionally be configured to begh-pages
branch to work on both GitHub and GitLab). - The public content, a GitLab Page, is served using Expressjs. Each project will be served from a different subdirectory in the form of
server.publicUrl
/pages/:username/:projectName/. It is recommended that thepublicPagesDir
be served using Nginx or Apache.
A docker wrapping https://github.com/csakoda/GitLab-Pages to work with gitlab.imshealth.com
docker build -t gitlab-pages .
docker run -d -e EXT_URL=<external pages url> -p 3000:3000 gitlab-pages
- Install crane
go get github.com/michaelsauter/crane && go install github.com/michaelsauter/crane
(Optional) Copy your id_rsa and id_rsa.pub keys into keys/
cp .env.template .env
# edit .env to contain your external pages url
crane lift
Only update the pages container, preserving the existing HTML data
crane lift -r pages