# How to publish to GitLab Pages using Renkulab

**URL:** <https://renku.discourse.group/t/how-to-publish-to-gitlab-pages-using-renkulab/302>\
**Category:** RenkuLab\
**Created:** [30 March 2021 18:48 UTC](https://renku.discourse.group/t/how-to-publish-to-gitlab-pages-using-renkulab/302 "2021-03-30T18:48:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gavin-k-lee](https://yyz2.discourse-cdn.com/free1/user_avatar/renku.discourse.group/gavin-k-lee/32/233_2.png) [@gavin-k-lee](https://renku.discourse.group/u/gavin-k-lee)\
**Post date:** [30 March 2021 18:48 UTC](https://renku.discourse.group/t/how-to-publish-to-gitlab-pages-using-renkulab/302/1 "2021-03-30T18:48:27Z")

</div>

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](https://docs.gitlab.com/ee/user/project/repository/repository_mirroring.html#pulling-from-a-remote-repository), 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](http://gitlab.com) project
4. set the renkulab project to push to the [gitlab.com](http://gitlab.com) project

This example is based off [GitLab Pages examples / plain-html · GitLab](https://gitlab.com/pages/plain-html), which has the corresponding Pages site at [Plain HTML site using GitLab Pages](https://pages.gitlab.io/plain-html/).

1. Prototype repository: Create a plain renku project, such as [Gavin Lee / my-pages · GitLab](https://renkulab.io/gitlab/lee.gavin.k/my-pages)

2. The .gitlab-ci.yml file has been altered: see [.gitlab-ci.yml · master · Gavin Lee / my-pages · GitLab](https://renkulab.io/gitlab/lee.gavin.k/my-pages/-/blob/master/.gitlab-ci.yml)

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](http://gitlab.com) instance. That is, only on renkulab. Conversely, the deploy stage will only run when the project is the one from [gitlab.com](http://gitlab.com).

The ‘pages:’ section is taken from the [GitLab Pages examples / plain-html · GitLab](https://gitlab.com/pages/plain-html) example.

1. Prototype repository: [gavin-k-lee / my-book · GitLab](https://gitlab.com/gavin-k-lee/my-book). When first setting this up, you should create an EMPTY repository. I have named the renkulab project ‘my-pages’ and the [gitlab.com](http://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.

 ![image](https://global.discourse-cdn.com/free1/uploads/renku/original/1X/1d59d47a31d1fc6d2aeca9ba7e6999d60992bed0.png)

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](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.

 ![image](https://global.discourse-cdn.com/free1/uploads/renku/original/1X/3b73a38a1e70404ba72dc64ce5ee90a0d857030b.png)

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.

 ![image](https://global.discourse-cdn.com/free1/uploads/renku/original/1X/f64aa9fc5af64cc87ac6e89a44f6dc871b064635.png)

You should then view the GitLab Pages result!

 ![image](https://global.discourse-cdn.com/free1/uploads/renku/original/1X/648d219b5038eb4a3b2051cf37c4b7369ea8d0c1.png)

Credits: @cchoirat

---

<div class="post-metadata">

**Author:** ![RichardJActon](https://yyz2.discourse-cdn.com/free1/user_avatar/renku.discourse.group/richardjacton/32/514_2.png) [@RichardJActon](https://renku.discourse.group/u/RichardJActon)\
**Post date:** [1 September 2022 08:32 UTC](https://renku.discourse.group/t/how-to-publish-to-gitlab-pages-using-renkulab/302/3 "2022-09-01T08:32:55Z")

</div>

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

Are there any plans for the [renkulab.io](http://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.

---

<div class="post-metadata">

**Author:** ![rrrrrok](https://yyz2.discourse-cdn.com/free1/user_avatar/renku.discourse.group/rrrrrok/32/117_2.png) [@rrrrrok](https://renku.discourse.group/u/rrrrrok)\
**Post date:** [7 September 2022 13:17 UTC](https://renku.discourse.group/t/how-to-publish-to-gitlab-pages-using-renkulab/302/4 "2022-09-07T13:17:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![RichardJActon](https://yyz2.discourse-cdn.com/free1/user_avatar/renku.discourse.group/richardjacton/32/514_2.png) [@RichardJActon](https://renku.discourse.group/u/RichardJActon)\
**Post date:** [7 September 2022 13:52 UTC](https://renku.discourse.group/t/how-to-publish-to-gitlab-pages-using-renkulab/302/5 "2022-09-07T13:52:30Z")

</div>

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](http://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

> **[Article Formats for R Markdown](https://pkgs.rstudio.com/rticles/)**
>
> A suite of custom R Markdown formats and templates for
> authoring journal articles and conference submissions.

{bookdown} books

> **[GitHub - rstudio/bookdown: Authoring Books and Technical Documents with R...](https://github.com/rstudio/bookdown)**
>
> Authoring Books and Technical Documents with R Markdown - GitHub - rstudio/bookdown: Authoring Books and Technical Documents with R Markdown

and {xaringan} presentations

> **[GitHub - yihui/xaringan: Presentation Ninja 幻灯忍者 · 写轮眼](https://github.com/yihui/xaringan)**
>
> Presentation Ninja 幻灯忍者 · 写轮眼. Contribute to yihui/xaringan development by creating an account on GitHub.
