How to publish to GitLab Pages using Renkulab

How to publish to GitLab Pages using Renkulab

Problem: the GitLab instance behind Renkulab does not currently have a GitLab Pages publishing functionality set up.

We will use repository mirroring to get around this. The idea is to push renkulab to the usual gitlab instance and have pages served from there.

(It is also possible through pulling, however, since it is not reliably available for free: see link, we have altered this tutorial.)

Steps:

  1. create a renku project
  2. alter the .gitlab-ci.yml file slightly
  3. create an empty gitlab.com project
  4. set the renkulab project to push to the gitlab.com project

This example is based off GitLab Pages examples / plain-html · GitLab, which has the corresponding Pages site at Plain HTML site using GitLab Pages.

  1. Prototype repository: Create a plain renku project, such as Gavin Lee / my-pages · GitLab

  2. The .gitlab-ci.yml file has been altered: see .gitlab-ci.yml · master · Gavin Lee / my-pages · GitLab

In particular, there are two stages, ‘build’ and ‘deploy’, with variables which are tagged as exceptions. The interpretation is as such: the CI will build the image_build stage except when the $CI_PROJECT_URL points to the gitlab.com instance. That is, only on renkulab. Conversely, the deploy stage will only run when the project is the one from gitlab.com.

The ‘pages:’ section is taken from the GitLab Pages examples / plain-html · GitLab example.

  1. Prototype repository: gavin-k-lee / my-book · GitLab. When first setting this up, you should create an EMPTY repository. I have named the renkulab project ‘my-pages’ and the gitlab.com project ‘my-book’ to distinguish the two. You can name them the same thing, but this is slightly confusing sometimes because the renku gitlab and native gitlab instances have the same user interfact in the browser!

  2. Set up PUSH mirroring in renkulab.

Enter the gitlab Git URL. Make sure to include the namespace as @gitlab.com.

The default direction should be PUSH. The password needs to be generated as a Personal Access Token.

Navigate to https://gitlab.com/-/profile/personal_access_tokens to set up a token. Give at least read and write access. Generate the token and copy it to your clipboard. Enter it as the password in renkulab.

The mirroring should begin to push the renkulab contents into the empty repository. If it doesn’t start, click the “Update now” button to force start.

You should then view the GitLab Pages result!

Credits: @cchoirat

3 Likes

(Hi Again Gavin - I said you’d be seeing more of me :wink: )

Are there any plans for the renkulab.io instance to enable gitlab pages for projects?
If not: Is this for any technical reason that makes it difficult, which would also be a problem for someone running their own instance?

I ask because the ability simply to create pages using Rmarkdown/bookdown that can be immediately and easily shared as a static site would be very convenient.

Hi @RichardJActon,

we have not enabled GitLab pages on our instance for technical reasons, but we could in principle investigate whether it makes sense to do this. Right now we are actually transitioning to not using our home-made GitLab chart anymore, so in terms of GitLab that is our first priority. I’d say we can revisit the pages topic once that is done, hopefully in the next month or so.

Thanks @rrrrrok good to know.

I’m planning on (eventually) making some project templates for serving various Rmarkdown based outputs that are popular for accompanying repos in order to document or communicate their content as static sites using github/gitlab pages. The mirroring to gitlab.com thing should work fine for this if you decide to keep pages off just adds a couple of steps to the setup.

Starting with basic html pages from rmarkdown/knitr but hopefully extending to:

{rticles} articles

{bookdown} books

and {xaringan} presentations