1
votes

Is this possible to set up a config, which would include:

  1. GitLab project #1 java-container
  2. GitLab project #2 java-container
  3. Nginx container
  4. Redis container
  5. Cassandra container
  6. Nginx exporter (Prometheus)
  7. Redis exporter (Prometheus)
  8. JMX exporter (Prometheus) x2

It's important to have all this in one multi-container pod on kubernetes (GKE) and communicating via shared volume and localhost.

I've already done all this in kubernetes with initial containers (to pull the code and compile it), and now I'm looking for the way to make this work with CI/CD.

So, if this could be done with GitLab CI, could you, please, point me to the right documentation or manual pages, as I'm a newbie in GitLab CI and stuff, and have already lost myself in dozens of articles from the internet.

Thanks in advance.

1
Were you able to configure this. If yes, please share the helpful documentation/notes.Sharan
@Sharan I'm working on it right now. I'll answer next to my question, and would add the updates while I'm moving through this.cardinal-gray
Appreciate the help. I find the documents you shared helpful.Sharan

1 Answers

1
votes

The first thing is to join all projects, that should be built with maven and(or) docker into the one common project at GitLab.

Next is to add dockerfiles and all files, needed for docker build, into the sub-projects folders.

Next in the root of the common project we should we should place .gitlab-ci.yml and deployment.yml file.

deployment.yml should be common or all the sub-project.

.gitlab-ci.yml should contain all the stages to build every sub-project. As we don't need to build all the stuff every time we make changes in sime files, we should use tags in git to make GitLab CI understand, in which case it should run one or another stage. This could be implemented by only parameter:

docker-build-akka:
  stage: package
  only:
    - /^akka-.*$/
  script:
  - export DOCKER_HOST="tcp://localhost:2375"
...

And so on in every stage. So, if you make changes to needed Dockerfile or java code, you should commit and push to gitlab with a tag like akka-0.1.4, and GitLab CI runner will run only the appropriate stages.

Also, if you make changes to README.md file or any other changes, that don't need to build the project - it wouldn't.

Lots of useful stuff you can find here and here.

Also, look at the problem, that I faced running docker build stage in kubernetes. It might me helpful.