A few questions about GitLab Runner and Docker

Hello,
In the GitLab Runner documentation it was written that it should be installed on a separate server from the GitLab server.

1- Can I install it alongside the Docker server or do I have to dedicate a separate server to it?

2- Is it better to install it as a container or an application?

Thank you.

Hi @hack3rcon :wave:

  1. While it is technically possible to run GitLab Runner on the same machine that runs GitLab, it’s best to run it on a separate server for security and performance reasons. Running both on the same machine often leads to competition for system resources (RAM, CPU, or disk I/O), potentially degrading the performance of both applications.
  2. I suggest installing GitLab Runner as a Docker container, as the Docker executor offers full support for all GitLab Runner features and functionality. See this compatibility chart for more details.
1 Like

To also add to what @gitlab-greg wrote, even if you have Gitlab installed using docker, that still means use a separate machine for your runner. Gitlab needs it’s own server, irrespective of whether you installed it using docker, or the omnibus package - mainly due to the hardware requirements in terms of CPU/RAM, and unnecessarily overloading your server running additional services on it.

1 Like

Hi,
Thank you so much for your reply.
About setting up GitLab Runner I have no experience. A website designed with Node.js wants to read the codes from the GitLab server and the changes made in the codes are applied to the website. Is it complicated? Does the GitLab documentation describe how to set up such a project?

Hello,
Thank you so much for your reply.
How many resources does GitLab Runner need in Docker?

It’s in the Gitlab documentation. You should be looking there before asking questions for things that can easily be found using tools like google: Installation system requirements | GitLab

And as I already said, it doesn’t matter if you install Gitlab or Gitlab runner natively under Linux or in docker. The amount of resources required are the same. And as per the docs say, they give a minimum spec. After that, depending on what you will be doing with your runner you will have to experiment and either give more CPU/RAM based on your requirements. We cannot tell you exactly how much you need, you have to figure it out yourself.

2 Likes

Hi,
Thanks again.
Should GitLab Runner be installed inside the Node.js container? Please take a look at this.

No, I suggest you read the Gitlab documentation because it tells you how to install the Gitlab runner.

1 Like

Hi,
Thanks again.
Sure. I will read this.
Consider a website where each part is a microservice. Does each microservice need its own GitLab Runner?

Hi,

No, projects can share runners. It’s all explained in the documentation :slight_smile:

I would suggest Linux or Docker installation, with docker executor. Docker executor is very easy to use and has many benefits. It basically means that every job will be running in a container created from docker image that you can specify for that job in the project’s .gitlab-ci.yml file.

P.S. Apart from the documentation, I can suggest Nana’s tutorial on YouTube: https://www.youtube.com/watch?v=qP8kir2GUgo :slight_smile:

1 Like

Hi,
Thank you so much for your reply.
So, do I just need a GitLab Runner container for all microservices?

I suggest you read documentation since you just reply without actually reading anything we suggest to you.

Gitlab Runner is for CI/CD processes, it’s not for running websites in it. That is something else entirely and nothing to do with Gitlab Runners.

2 Likes

Hi,
Thanks again.
I take a look at https://docs.gitlab.com/runner/install/docker.html, but I use docker compose. I found the compose file below, but it includes the GitLab server:

version: '4.5'
services:

  # GITLAB
  gitlab-web:
    image: 'gitlab/gitlab-ce:latest'
    restart: always
    container_name: gitlab-web
    hostname: '192.168.0.14'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'http://192.168.0.14'
        gitlab_rails['gitlab_shell_ssh_port'] = 2222
    ports:
      - "80:80"
      - "443:443"
      - "2222:22"
    volumes:
      - './gitlab/config:/etc/gitlab'
      - './gitlab/logs:/var/log/gitlab'
      - './gitlab/data:/var/opt/gitlab'
    networks:
      - gitlab-network

  # RUNNER
  gitlab-runner1:
    image: gitlab/gitlab-runner:alpine
    restart: always
    container_name: gitlab-runner1
    hostname: gitlab-runner1
    depends_on:
      - gitlab-web
    volumes:
     - ./config/gitlab-runner:/etc/gitlab-runner
     - /var/run/docker.sock:/var/run/docker.sock
    networks:
        - gitlab-network

networks:
  gitlab-network:
    name: gitlab-network

My GitLab server is installed elsewhere. I just need the following lines, but I don’t know how to connect this container to the GitLab server:

# RUNNER
  gitlab-runner1:
    image: gitlab/gitlab-runner:alpine
    restart: always
    container_name: gitlab-runner1
    hostname: gitlab-runner1
    depends_on:
      - gitlab-web
    volumes:
     - ./config/gitlab-runner:/etc/gitlab-runner
     - /var/run/docker.sock:/var/run/docker.sock

Is it better if I install GitLab Runner as a container?

Hello,
I want to use the tutorial How to auto deploy a Vue application using GitLab CI/CD on Ubuntu 18.04 - LogRocket Blog. Should I run and create the following commands and Dockerfile on the GitLab server or the server where GitLab runner and Docker are installed?

git init
git remote add origin git@gitlab.com:<your-gitlab-username>/vue-demo.git
git add .
git commit -m "Initial commit"
git push -u origin master

Thank you.

Dear @hack3rcon ,

Your enthusiasm is really appreciated. And I’m sorry to tell you this, but considering questions you are asking it is clear you are missing some base concepts in IT / software development. And that is absolutely fine, but you cannot expect that GitLab Community will give you private lessons on those while Internet is full of free resources, especially in software development.

My honest recommendation for you would be to go back to basics, and before you do anything else, PLEASE learn the following (in that order):

  • Lifecycle of software development and types of software applications
  • code versioning (git): I can recommend 3-video tutorial from SuperSimpleDev. Understand difference between git / GitLab / GitHub / Git Desktop / SourceTree etc. → this would teach you that commands you mentioned are executed on your laptop and that they are initializing a new git repository.
  • Basics of infrastructure: what is server, what is virtual machine. Linux distributions.
  • Basics of networking: protocols like http(s), ssh, tcp. What are ports? What is DNS and how does it work? What are certificates and SSL?
  • You’ve been asking about Node.js app. Learn how web application runs in production on a simple server (virtual machine). What do you need to setup that when you type it https://myapp.com in the browser, it opens your application? No docker, no complicated stuff, no automation. Just simple running app on one single simple server. Use simple cloud like Digital Ocean for learning.
  • What is docker and where can you use it? Crash course from Nana
  • What is DevOps?
  • GitLab infrastructure, GitLab Runners and how to do CI/CD with GitLab. Crash course from Nana

That would be all from me. Good luck! :slight_smile:

2 Likes

Hello,
Thanks again.
I take a look at that video, but it was not very suitable for me. I think it would be a better help if you answered my question.

I 100% agree with Paula, answering your question is pointless, because you have zero knowledge on what you are trying to achieve. There is a saying “Don’t run before you can walk”, and you are trying to run before you have any knowledge or understanding of anything you have asked so far in this topic or on this forum so far.

Paula gave you a ton of links for you to start learning. But it seems you cannot be bothered with this, and expect people here to give you answers and tell you what to do. I already came to that conclusion when I posted recently and mentioned that you reply without actually reading and learning from the information being given to you… That is not how it works. If you cannot be bothered to read or learn from information people provide you, then you will not go very far in life. That is just laziness.

I highly encourage you to do just what Paula said and work through that information to learn how to use Node, Docker, etc. And if you don’t like the video and it isn’t suitable for you - then I am sure you know how to use a search engine like google and I suggest you use google and search for it yourself and find information that is suitable for you if what Paula provided is too hard for you to understand. We are not here to search the internet for you, and we are not here to do things for you.

You have to help yourself and start to learn how to do things for yourself. And only at this point, should you be posting on here and asking for assistance when something isn’t working for you.

And if you do not wish to do that, then I suggest you give up or pay someone to do it for you if you do not wish to spend time learning how to do it yourself.

1 Like