[WIP] GitLab pages (EE only)
Fixes gitlab-org/gitlab-ce#3085
This is pretty naive approach for having static pages build on artifacts support:
- When job named
pages
is defined in.gitlab-ci.yml
the artifacts from this build will be used for serving static pages. - Build job needs to put all served files in
public/
and upload artifacts to GitLab. - GitLab detects and fires sidekiq job to unpack artifacts and put them into
shared/pages/group/project
folder. - We then have nginx config with dynamic virtual host support serving files from
shared/pages
- On every pages deploy we try to do atomic update using move filesystem operation
- If no
pages
is defined in.gitlab-ci.yml
we inject predefined job that is executed forgl-pages
branch.
Example .gitlab-ci.yml
:
pages:
image: jekyll/jekyll:builder
script:
- jekyll build --destination=public
artifacts:
- public/
only:
- master
Pros:
- By using CI and docker images we can build static webpage with any tools, we are not limited to stripped down Jekyll server as it is on GitHub Pages.
- By having Shared Runners it will work out of box on GitLab.com.
- By using Docker by default it will work out of box on most installations.
Cons:
- We need to build static page on CI and upload it to GitLab and unpack it later - this is time consuming
- We serve only static files, no dynamic content allowed
This is proof of concept and misses:
- Custom domain names (CNAME? file)
- Custom directory with static files, currently
public/
is hardcoded - Backup support
- Tests support
- Documentation how to use it
- Disable symlink following for Nginx
- Ability to define domain on which the sites will be served.
- Think how we should handle custom domains (if we want to have support for them)
The code is not yet nice, I'll make it better if we choose that this is a way how we want to do it.
@sytses @jacobvosmaer @marin @dzaporozhets What do you think?
It's based on build artifacts MR.