Skip to content

g1raffi/microservices-lab

 
 

Repository files navigation

Microservices Lab

Microservices Lab Description

Build LABs using Docker

To build and run for example the monolith lab use the following steps.

Build monolith application image:

cd code/monolith
docker build -f monolith-application/src/main/docker/Dockerfile.multistage.jvm -t microservices-lab-monolith-application:latest monolith-application

Run monolith lab locally:

cd code/monolith/docker
docker-compose down --remove-orphans
docker-compose up -d

Running the solution of the monolith lab:

cd code/monolith/docker
docker-compose down --remove-orphans
docker-compose -f docker-compose.solution.yaml up -d

Using the lab website container

Content Sections

The training content resides within the content directory.

The main part are the labs, which can be found at content/en/docs.

Hugo

This site is built using the static page generator Hugo.

The page uses the docsy theme which is included as a Git Submodule. Docsy is being enhanced using docsy-plus as well as docsy-acend and docsy-puzzle for brand specific settings.

The default configuration uses the puzzle setup from config/_default. Further, specialized environments can be added in the config directory.

Docsy theme usage

Update submodules for theme updates

Run the following command to update all submodules with their newest upstream version:

git submodule update --remote

Build hugo website container using Docker

Build the image:

docker build -t puzzle/microservices-lab:latest .

Run it locally:

docker run -i -p 8080:8080 puzzle/microservices-lab

Using Buildah and Podman

Build the image:

buildah build-using-dockerfile -t puzzle/microservices-lab:latest .

Run it locally with the following command. Beware that --rmi automatically removes the built image when the container stops, so you either have to rebuild it or remove the parameter from the command.

podman run --rm --rmi --interactive --publish 8080:8080 localhost/puzzle/microservices-lab

How to develop locally

To develop locally we don't want to rebuild the entire container image every time something changed, and it is also important to use the same hugo versions like in production. We simply mount the working directory into a running container, where hugo is started in the server mode.

export HUGO_VERSION=$(grep "FROM klakegg/hugo" Dockerfile | sed 's/FROM klakegg\/hugo://g' | sed 's/ AS builder//g')
docker run \
  --rm --interactive \
  --publish 8080:8080 \
  -v $(pwd):/src \
  klakegg/hugo:${HUGO_VERSION} \
  server -p 8080 --bind 0.0.0.0

Linting of Markdown content

Markdown files are linted with markdownlint. Custom rules are in markdownlint.json. There's a GitHub Action github/workflows/markdownlint.yaml for CI. For local checks, you can either use Visual Studio Code with the corresponding extension, or the command line like this:

npm install
node_modules/.bin/markdownlint content

Github Actions

Build

The build action is fired on Pull Requests does the following

  • builds all PR Versions (Linting and Docker build)
  • deploys the built container images to the container registry
  • Deploys a PR environment in a k8s test namespace with helm
  • Triggers a redeployment
  • Comments in the PR where the PR Environments can be found

PR Cleanup

The pr-cleanup action is fired when Pull Requests are closed and does the following

  • Uninstalls PR Helm Release

Push Main

The push main action is fired when a commit is pushed to the main branch (eg. a PR is merged) and does the following, it's very similar to the Build Action

  • builds main Versions (Linting and Docker build)
  • deploys the built container images to the container registry
  • Deploys the main Version on k8s using helm
  • Triggers a redeployment

Helm

Manually deploy the training Release using the following command:

helm install --repo https://acend.github.io/helm-charts/  <release> acend-training-chart --values helm-chart/values.yaml -n <namespace>

For debugging purposes use the --dry-run parameter

helm install --dry-run --repo https://acend.github.io/helm-charts/  <release> acend-training-chart --values helm-chart/values.yaml -n <namespace>

Contributions

If you find errors, bugs or missing information, please help us improve and have a look at the Contribution Guide.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 82.3%
  • HTML 13.9%
  • Dockerfile 1.5%
  • JavaScript 1.3%
  • Other 1.0%