Make sure to run docker-compose stop
or docker-compose down
or docker-compose down -v
or docker-compose rm
to clear your working environment.
docker-compose down --remove
docker-compose -f databases-docker-compose.yaml down
When something is not working for example database ;)
Important flags & commands:
docker-compose -f databases-docker-compose.yaml up --build --remove-orphans
- --remove-orphans : Removes all containers left by docker-compose
docker-compose -f databases-docker-compose.yaml down --v
- --v or -volumes : Removes all volumes left by containers
docker-compose -f docker-compose.yaml up --build users-service -d
- users-service -d : Rebuilds only one service from compose (and all that will be depending)
Most important is the config-server
and order of startup for different applications.
Supporting services (Config and Discovery Server) must be started before any other application (Admin, Users, Formality, API, etc).
Main access point is API Gateway on - http://localhost:8080
All services have configured Swagger UI on http://service:port/swagger-ui/index.html
Import whole project by choosing main .pom
.
Make sure you cloned [Configuration repository].
git clone https://github.com/EmailsEmotions/EmailsEmotionsConfiguration
Setup path to this repository in config-server/src/main/resources/bootstrap.yml
.
searchLocations: file:///ABSOLUTE_PATH_TO_CONFIG_REPOSITORY
Next you have to run databases
docker-compose -f databases-docker-compose.yaml up --build --remove-orphans
optionally ELK stack
docker-compose -f elk-docker-compose.yaml up --build --remove-orphans
You have to build all .jars
with mvn package
then you can execute
$ docker-compose -f docker-compose --build -d
To speed up build process when not using jars
use Docker BuildKit
https://docs.docker.com/develop/develop-images/build_enhancements/
Stack overflow: Maven docker cache dependencies
Windows
> setx DOCKER_BUILDKIT 1
> setx COMPOSE_DOCKER_CLI_BUILD 1
> docker-compose -f docker-compose-with-maven.yaml up --build -d
> docker-compose -f docker-compose.yaml up --build -d
> docker-compose -f docker-compose.yaml up -f docker-compose-ai.yaml --build -d
Linux
$ export DOCKER_BUILDKIT=1 # or configure in daemon.json
$ export COMPOSE_DOCKER_CLI_BUILD=1
$ docker-compose -f docker-compose-with-maven.yaml up --build -d
$ docker-compose -f docker-compose.yaml up --build -d
$ docker-compose -f docker-compose.yaml up -f docker-compose-ai.yaml --build -d
git flow init [Enter]x5
More informations here https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow
To use AI module you have to clone https://github.com/EmailsEmotions/EE_AI.git
And build image with tag ai-docker
docker build -t ai-docker .
Components | Resources |
---|---|
Config Server Setup | Config server properties and [Configuration repository] |
Service Discovery | Eureka server and Service discovery client |
API Gateway | Spring Cloud Gateway starter and Routing configuration |
Docker Compose | Spring Boot with Docker guide and docker-compose file |
ELK stack | ELK stack and ELK docker-compose |
Databases stack | DB docker-compose |
Jmeter | JMeter startup |
Creating microservice | Docs on creating microservice |
Swagger Config | Docs on adding Swagger to service |
[Configuration repository]: https://github.com/EmailsEmotions/EmailsEmotionsConfiguration |