YuMS / gitlab-ce-pages

Unofficial GitLab Pages for GitLab CE
MIT License
64 stars 11 forks source link

GitLab CE Pages Build Status [GitHub tag]() [Docker Pulls]()

the Largest Milestone w/o Feature Update - the GRAVESTONE

Finally, they guys from GitLab brought Pages feature to CE!(link) :smile::joy::no_mouth::smile::joy::no_mouth::smile::joy::no_mouth:

So there's no meaning to continue with this project(What? You want me to fight with them??)

Thank you all for your cutting edge sights that made you require this feature that eventually lead you to support this project. Special thanks to you guys who reported back to this one and some who even helped building it.

As I said, this project is almost compatible with Pages in EE. So for supporters of GCP, I guess what you need to do after updated to Pages-feature-included version of GitLab are:

R.I.P to GCP with :)

Background

This is an unofficial GitLab Pages implementation for GitLab CE (GitLab Community Edition), denoted as GCP.

Official GitLab Pages is only for GiLab EE, as discussed here and here.

Actually, there's already a project aiming at the same goal as this one. Luckily, I found it after my finishing the initial version of this project. The philosophy behind these two projects are different: mine provides a close imitation of official GitLab Pages while the other embeds Jekyll which makes it more like GitHub Pages.

What can this project do?

This project is almost compatible with official GitLab Pages, which means you can directly use these GitLab Pages examples and summon GCP to handle the rest (if configured correctly of course). If one day, you switched to GitLab EE or GitLab.com, or Pages is included into GitLab CE, the immigration would be seamless.

Currently, following features are supported:

Usage

The only supported encouraged way to run GCP is with Docker.

Prerequisite

Further deploying steps

Enable for project (I expect you, the reader, to retell the following bullet points to your GitLab users, in your own way):

CNAME configuration

CNAME is supported since GCP 1.1.0.

Official GitLab Pages service provides a way for users to host their static websites on gitlab.io, also you can point your domain to your *.gitlab.io using CNAME DNS record. For GCP, things are different: GCP, along with your sites, are hosted on your own server. What GCP needs is actually an A record to your server IP in domain DNS records. But since the final purposes of two are similar, both to customize domains. So the name CNAME is used.

With customized domains, you can directly access your projects’ Pages directly under your own domains, without complicated workspace and project name in url. This makes GCP essentially a static site deployer. In fact, you can use GCP to deploy your static site even without owning a running GitLab instance!

Unlike official Pages, we can’t easily set CNAMEs on web UI. GCP uses a configuration file to enable this.

Following are steps to set CNAME:

Wildcard CNAME configuration

Wildcard CNAME is supported since GCP 1.3.0.

Wildcard CNAME is the follow-up to CNAME configuration, which enables GCP to automatically apply some patterns for page routing.

Here's some recipe cnames.txts to use wildcard CNAME:

You can find your best fit by combination of these.

Note that you need to set A record to GCP server IP for all domains/subdomains you want to use. Here's an example from GoDaddy about how to set wildcard DNS record.

Upgrading

You can easily upgrade your GCP in following steps:

Environment variables

Sample docker-compose.yml

This is a sample docker-compose.yml file for you if you want to use docker-compose. It behaves similarly to the command line version.

gitlab-ce-pages:
  restart: always
  image: yums/gitlab-ce-pages:1.3.4
  environment:
    - PAGE_PRIVATE_TOKEN=private_token_of_peeking_account
    - GITLAB_URL=http://gitlab.example.com/
    - PROJECT_ROOT=public
  volumes:
    - ./public:/home/pages/public
    - ./cname:/home/pages/cname
  ports:
    - "80:80"