If you need to be more familiar with Spring REST API and Spring Kafka, go here:
The following docker tips might be handy in this course. Please note that this course is NOT focusing on docker, so this is just a supplementary, basic tips.
Download the docker scripts (docker-compose-xxx.yml
) from lecture Resource & References.
Open terminal / command prompt, then go to directory where docker-compose.yml
located
IMPORTANT: Before start docker-compose command, make sure docker-compose.yml is in current directory.
Alternatively, you can point the file to use, by adding -f
parameter,for example like this :
docker-compose -f /path/to/my/file.yml ...
Click to expand the reference
docker-compose up -d
Create all containers and start them.
docker-compose up --no-start
Create all containers, without start them.
docker-compose start
Start all containers.
docker-compose stop
Stop all running containers.
docker-compose down
Stop all containers and remove them.
docker-compose ps
List all running containers.
docker-compose ps -a
List all containers.
docker-compose logs --tail 200 -f
See logs from all containers.
docker-compose logs --tail 200 -f [container name]
See logs from specific container.
docker-compose [command] --help
Display additional information for [command]
Run this commands from terminal / console. For Linux, make sure you have root or sudo access.
Click to expand the reference
docker ps
List running containers.
docker ps -a
List all containers (running and stop).
docker container create
Create a container, not running it. See official docker documentation for further reference.
docker container start [container-name or container-id]
Start an existing container. See official docker documentation for further reference.
docker container stop [container-name or container-id]
Stop a running container.
docker container rm [container-name or container-id]
Remove container.
docker pull [image-name]
Pull a docker image from repository with default tag (latest)
docker image ls
List docker images in your machine.
docker image rm [image-id]
Remove docker image in your machine. Docker image can take quite amount of hard-drive, so you might want to cleanup unused images. Image to be removed must not be used in any container, even if the container is stopped.
docker [command] --help
Display additional information for [command]
- Install Vault - Development
- Install Vault - Production
- Vault Configuration - Storage
- Vault API for Database
- Elasticsearch
- Logstash
- Kibana
- Spring Boot with Micrometer
- Sentry
- Prometheus (additional resource, not covered in course)
- Grafana (additional resource, not covered in course)
- Sample Grafana Dashboard for Spring Boot
Spring Google Cloud official documentation
First, you must create and authenticate to google cloud.
Follow steps on google documentation.
The, build and upload your image. Follow the following steps:
- Build docker image. Open terminal, go to
google-cloud
java project home, and run
#> ./gradlew bootBuildImage --imageName=ms-pattern/spring-google-cloud:latest
- Tag the docker image. Change the [parameter] according to your environment.
#> docker tag [docker-image-name]:[docker-image-tag] \
[google-cloud-region]-docker.pkg.dev/[google-project-name]/[artifact-registry-name]/[docker-image-name]:[docker-image-tag]
Example:
#> docker tag ms-pattern/spring-google-cloud:latest \
asia-southeast2-docker.pkg.dev/timpamungkas-google/docker-artifact-registry/spring-google-cloud:latest
- Push the tagged docker image. Change the [parameter] according to your environment.
#> docker push [google-cloud-region]-docker.pkg.dev/[google-project-name]/[artifact-registry-name]/[docker-image-name]:[docker-image-tag]
Example
#> docker push asia-southeast2-docker.pkg.dev/timpamungkas-google/docker-artifact-registry/spring-google-cloud:latest
Further reference on google cloud documentation
Example
#> ./asmcli install \
--project_id timpamungkas-google \
--cluster_name cluster-course-with-mesh \
--cluster_location asia-southeast2-a \
--enable_all \
--output_dir ./asmcli-output \
--custom_overlay anthos-trace.yml