Skip to main content

Hosting Your Own GitLab Page on the CoCo Instance

GitLab makes it quick and easy to host your own static website. Here’s how to do it:

  1. Create a GitLab Repository

  2. Clone your new repository

  3. Open the cloned repository in a code editor of your choice

  4. Create a ".gitlab-ci.yml" file

    • Place this file directly in the cloned folder.
    • Ensure the name starts with a dot.
    stages:
    - deploy

    pages:
    stage: deploy
    script:
    - echo "Deploying..."
    - mkdir -p public
    - cp index.html public/
    artifacts:
    paths:
    - public
    only:
    - main

  5. Create an index.html file

    • This file will be displayed on your webpage.
         <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>Some title</title>
    </head>
    <body>
    <div>
    Hello, World!
    </div>
    </body>
    </html>
  6. Commit and push everything -> You're online!

  7. Find the link Screenshot pages link

Possible Issues

  1. The "Pages" menu item shows you the setup page instead of a URL

    • Make sure the job in your gitlab-ci.yml is named "pages" and not "deploy".
    pages: # this must be 'pages', not 'deploy'
    stage: deploy
    • Open the "Build" > "Pipelines" menu item to verify the correction.
      • Before: Screenshot pipeline but no link
      • After: Screenshot pipeline with link
  2. The URL shown doesn't work

    • Before: Screenshot pipeline broken link Screenshot pipeline broken link opened
    • Uncheck "Use unique domain" under the menu item: "Deploy" > "Pages". Screenshot of pipeline fixed link Screenshot final page
warning

Please note that you may need to consider legal requirements when making content available on the internet.