Skip to content

fuez96/game2048

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

2048 Web Application

GitLab

Install GitLab runner locally in a Docker container:

  1. Create a Docker network for all containers:
docker network create gitlab-runner-net
  1. Create a Docker volume to store runner config:
docker volume create gitlab-runner-vol
  1. Register runner with docker executor:
docker run --rm -it -v gitlab-runner-vol:/etc/gitlab-runner gitlab/gitlab-runner:v13.12.0 register
  • default image for docker executor: maven:3.8.1-jdk-11
  1. Register runner with shell executor:
docker run --rm -it -v gitlab-runner-vol:/etc/gitlab-runner gitlab/gitlab-runner:v13.12.0 register
  1. Tweak runner config:
docker run --rm -it -v gitlab-runner-vol:/etc/gitlab-runner debian:buster-slim

apt update
apt install nano
nano /etc/gitlab-runner/config.toml
  • add pull_policy = "if-not-present" and network_mode = "gitlab-runner-net" to runner config, i.e.:
[[runners]]
  ...
  executor = "docker"
  ...
  [runners.docker]
    ...
    pull_policy = "if-not-present"       # pull docker images on demand and not always
    network_mode = "gitlab-runner-net"   # run containers in custom network
  1. Create and run container (using a WSL2 Linux shell):
docker run -d --name gitlab-runner --restart always --network gitlab-runner-net \
           -v gitlab-runner-vol:/etc/gitlab-runner \
           -v /var/run/docker.sock:/var/run/docker.sock \
           -v /usr/bin/docker:/usr/bin/docker \
           -v /usr/bin/com.docker.cli:/usr/bin/com.docker.cli \
           gitlab/gitlab-runner:v13.12.0
  • /var/run/docker.sock must be read-/writeable for all, so sudo chmod 666 /var/run/docker.sock on the host if necessary
  • only works this way, if Docker uses WSL2 back-end
  • otherwise, GitLab Runner should be installed locally and not in a container
  1. If the runner is not needed anymore, stop and remove the container and volume:
docker stop gitlab-runner
docker rm gitlab-runner
docker volume rm gitlab-runner-vol
docker network rm gitlab-runner-net

GitHub

Setup local CI/CD environment for deployment job in GitHub Actions:

  1. Create and run a container for hosting the servlet using Tomcat:
docker run -d --name github-runner --network gitlab-runner-net -p 8081:8080 tomcat:9.0.46-jdk11
  1. Open a shell in the container:
docker exec -it github-runner /bin/bash
  1. Install Maven in the container:
apt update
apt install maven
  1. Change permissions on /usr/local/tomcat/webapps to world read-/writeable:
chmod 777 /usr/local/tomcat/webapps
  1. Create a new user for running the GitHub self-hosted runner and switch to that user:
adduser github-runner
su -l github-runner
  1. Install and run self-hosted runner for Linux X64 as explained in the settings of your repository (Settings → Actions → Runners)

  2. To stop the runner, press Ctrl + C.

  3. If the runner is not needed anymore, exit the container shell and then stop and remove the container:

docker stop github-runner
docker rm github-runner

SonarQube

Integrate SonarQube for static code quality analysis:

  1. Create and run a SonarQube container:
docker run -d --name sonarqube --restart always \
           --network gitlab-runner-net -p 9000:9000 \
           -e SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true \
           sonarqube:8.9.1-community
  1. Log into SonarQube, create a new project and adapt CI/CD config accordingly

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published