Skip to content
Snippets Groups Projects
Commit 0a159c09 authored by Jan Pokorný's avatar Jan Pokorný :lifter_tone2:
Browse files

Merge branch 'pipeline-deployment' into 'M2'

Pipeline testing per module + deployment

See merge request !21
parents 0df5fa1b 3c058ebd
No related branches found
No related tags found
3 merge requests!31M2,!27Draft: M2 user,!21Pipeline testing per module + deployment
Pipeline #
......@@ -11,14 +11,37 @@
- Martin Gargalovič *@xgargal*
- Jan Pokorný *@xpokorn8*
- Ester Vilímková - _Project Leader_ *@xvilimk*
- **Assigment**:
- Create a system for language school lecture management. Each lecture can occur on a given day and time and is related to some course. The course is defined by its (unique) name, language and proficiency level. However, each lecture will be independent. That means that each lecture can have a different topic. Different lecturers can give it, and an arbitrary number of students can enrol. Each lecturer will have a name, surname, and record of taught languages. In addition, the lecturer will indicate that they are a native speaker. Exercises can be prepared for each course to allow the students to learn the language. Each student can pick the exercises depending on the levels of difficulty.
- **Running the modules**:
- ```cd ./application```
- ```mvn clean install```
- ```cd ./module-*```
- ```mvn spring-boot:run```
- **Running the modules using docker-compose**:
```console
cd ./application
mvn clean install
docker-compose build --parallel
docker-compose up
```
- **Running the modules using podman-compose**:
~~~console
cd ./application
mvn clean install
podman-compose build --parallel
podman-compose up
~~~
- **Running the modules using docker**:
~~~console
sudo docker run -d -p 5001:5001 xpokorn8/sprachschulsystem:certificate &&
sudo docker run -d -p 5002:5002 xpokorn8/sprachschulsystem:exercise &&
sudo docker run -d -p 5000:5000 xpokorn8/sprachschulsystem:language-school &&
sudo docker run -d -p 5003:5003 xpokorn8/sprachschulsystem:mail
~~~
# Project Description
......
version: '3'
services:
certificate:
build: ./module-certificate
container_name: certificate
image: xpokorn8/sprachschulsystem:certificate
ports:
- "5001:5001"
exercise:
build: ./module-exercise
container_name: exercise
image: xpokorn8/sprachschulsystem:exercise
ports:
- "5002:5002"
language-school:
build: ./module-language-school
container_name: language-school
image: xpokorn8/sprachschulsystem:language-school
ports:
- "5000:5000"
mail:
build: ./module-mail
container_name: mail
image: xpokorn8/sprachschulsystem:mail
ports:
- "5003:5003"
\ No newline at end of file
FROM docker.io/library/eclipse-temurin:17-jre-focal
COPY ./target/module-certificate-0.0.1-SNAPSHOT.jar /app.jar
ENTRYPOINT ["java", "-jar", "/app.jar"]
FROM docker.io/library/eclipse-temurin:17-jre-focal
COPY ./target/module-exercise-0.0.1-SNAPSHOT.jar /app.jar
ENTRYPOINT ["java", "-jar", "/app.jar"]
FROM docker.io/library/eclipse-temurin:17-jre-focal
COPY ./target/module-language-school-0.0.1-SNAPSHOT.jar /app.jar
ENTRYPOINT ["java", "-jar", "/app.jar"]
FROM docker.io/library/eclipse-temurin:17-jre-focal
COPY ./target/module-mail-0.0.1-SNAPSHOT.jar /app.jar
ENTRYPOINT ["java", "-jar", "/app.jar"]
# This file specifies GitLab CI/CD pipeline, see https://docs.gitlab.com/ee/ci/
stages:
- build
- test
- deploy
variables:
# variable read by Maven for JVM options, see https://maven.apache.org/configure.html#maven_opts-environment-variable
......@@ -9,19 +11,64 @@ variables:
# our own variable for repeated options
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version "
test:
# name of Docker image in which the script commands are executed
image: maven:latest
cache:
paths:
- .m2/repository
build:
stage: build
tags:
- shared-fi
image: maven:latest
script:
- 'cd "$CI_PROJECT_DIR/application"'
- 'mvn $MAVEN_CLI_OPTS clean install -DskipTests'
test-certificate:
stage: test
tags:
- shared-fi
# name of Docker image in which the script commands are executed
image: maven:latest
# script is a list of linux shell commands
script:
# run maven build
- 'cd "$CI_PROJECT_DIR/application"'
- 'mvn $MAVEN_CLI_OPTS clean install'
cache:
# caches maven repo between runs
paths:
- .m2/repository
- 'mvn $MAVEN_CLI_OPTS -am -pl module-certificate test'
test-exercise:
stage: test
tags:
- shared-fi
image: maven:latest
script:
- 'cd "$CI_PROJECT_DIR/application"'
- 'mvn $MAVEN_CLI_OPTS -am -pl module-exercise test'
test-language-school:
stage: test
tags:
- shared-fi
image: maven:latest
script:
- 'cd "$CI_PROJECT_DIR/application"'
- 'mvn $MAVEN_CLI_OPTS -am -pl module-language-school test'
test-mail:
stage: test
tags:
- shared-fi
image: maven:latest
script:
- 'cd "$CI_PROJECT_DIR/application"'
- 'mvn $MAVEN_CLI_OPTS -am -pl module-mail test'
deploy:
when: manual
stage: deploy
script:
- 'cd "$CI_PROJECT_DIR/application"'
- 'mvn $MAVEN_CLI_OPTS install -DskipTests'
- 'docker-compose build --parallel'
- 'docker login -u $DOCKER_PRIVATE_LOGIN -p $DOCKER_PRIVATE_PASSWORD'
- 'docker-compose push'
version: '3'
services:
certificate:
build: ./module-certificate
container_name: certificate
image: xpokorn8/sprachschulsystem:certificate
ports:
- "5001:5001"
exercise:
build: ./module-exercise
container_name: exercise
image: xpokorn8/sprachschulsystem:exercise
ports:
- "5002:5002"
language-school:
build: ./module-language-school
container_name: language-school
image: xpokorn8/sprachschulsystem:language-school
ports:
- "5000:5000"
mail:
build: ./module-mail
container_name: mail
image: xpokorn8/sprachschulsystem:mail
ports:
- "5003:5003"
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment