Configuring GitLab Runner with Node.js

My scenario is as follows:

GitLab Server ---> GitLab Runner ---> Docker Containers (Nginx, Node.js, Redis, etc.)

I want to run a GitLab Runner alongside the containers that will automatically apply changes made to the code on the GitLab server to the website. I found the following articles:

But none of them have explained how Nginx and Node.js containers can access the code that is in the GitLab server!
Do containers need to be run on the GitLab server?

I would be grateful if someone could guide me in this example.

Thank you.

A GitLab runner deploys Software to a system where it actually runs. A Gitlab runner is not where you run your software.

So you can run it on AWS, GCP, Azure, etc.

The regular procedure is that when code is to pushed to gitlab, the gitlab runner gets a signal, builds the new software and then pushes it to wherever it runs. During the build a docker container is build that contains the code from the Github repository.

So the system doesn’t need to pull anything from Gitlab, the Gitlab runner will create a docker container and push that to the system.

1 Like

Thank you so much for your reply.
For example, the codes are in Node.js form and these codes should be executed by Nginx and Node.js containers. Are these containers built by GitLab Runner? No containers are created on the GitLab server?
Can you recommend a setup tutorial for beginners?

Before we start with any of the building and hosting steps, can you please explain a bit about your application?

  1. How are you running the application locally?
  2. Can you please show the Dockerfile(s) you are using for your application?
  3. Does your application need some kind of file storage or a database?
  4. How familiar are you with different hosting companies? Eg AWS, GCP, Azure, etc
  5. How familiar are you with deploying applications? Eg have you ever deployed something to a VM, or Docker container? Do you know tools like Terraform, Ansible, Capistrano, etc?
1 Like

Just to clearify….

Installing a nodejs application with microservices in a docker and use GitLab with GitRunner as Auto-Deploy-Environment (Continuos Integration) is kings class and nothing you can do with a simple tutorial.

1 Like

Thanks again.
1- As I said, I have two servers. One is the GitLab server and the other is for containers and GitLab Runner.

2- The Dockerfile(s) are:

FROM nginx:latest

WORKDIR /usr/share/nginx/html

COPY ./default.conf /etc/nginx/conf.d/default.conf
COPY ../www/ /usr/share/nginx/html


FROM node:latest

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

COPY ./www/package.json /usr/src/app/package.json
RUN npm install
RUN npm update

COPY ./www /usr/src/app


FROM redis:latest

COPY redis.conf /usr/local/etc/redis/redis.conf
CMD [ "redis-server", "/usr/local/etc/redis/redis.conf" ]

3- Yes. Applications use MongoDB.

4- I’m not familiar with them.

5- Yes. I know something about Docker and virtualization.

I found the article I don’t know if I should run and place the following commands, Dockerfile and .gitlab-ci.yml on the GitLab server or on the server where the containers and GitLab Runner are located:

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

Wait, so you run Github and the Github runner yourself, you’re not using

No, I’m using GitLab.

Okay, but you do realise you can’t run anything on the gitlab servers, right?

Tbh I’m pretty confused by your current setup and your wishes.

On the GitLab server, they are other projects too:

So now there is a GitLab server and not just I give up :person_shrugging: