The objective of this small workshop is only to use Consul as key/value configration store
- Tools installation
- Start Agent node
- Add data from CLI
- Exercise 1: Using templates
- Exercise 2: CLI Program. Use Add / Change data from UI
- Exercise 3: Rest program. Using config file for templating and exec behavior
- Exercise 4: Rest program. Spring configuration, only reload beans afected by keys/config
- Exercise 5: Rest program. Multiple Spring configurations, format = yaml
- Security
Excute:
make install-tools
Or visit:
- consul v1.10
- consul-template v0.2x
- Optional jq v1.6
- Optional yq v4.x
Execute:
make run-local
Execute:
make open-ui
to open the consul agent UI
Execute:
make add-data
Template once. Create template and parse file from data
Execute:
make exercise1
Exec mode. Template once before start application and make changes for proccess control (kill and start)
Execute:
make exercise2
Config options with npm sample app. Use template, start application & restart with each changes
Execute:
cd reading/exercise3/api-server && npm i && cd ../../../
to install node dependencies
Execute:
make exercise3
Execute:
make open-exercise3
to open the rest endpoint
Load the application & change the greeting message prefix
Execute:
make exercise4
Execute:
make open-exercise4
to open the rest endpoint
Load the application & change the greeting message for application and common settings
We have 2 yaml config keys:
- my-team/common/data
- my-team/consul-demo2/data
These have a default prefix: my-team
with paths:
- common
- consul-demo2
Execute:
make exercise5
Execute:
make open-exercise5
to open the endpoints
- Security
- Cluster configurations
- https://learn.hashicorp.com/tutorials/consul/get-started?in=consul/getting-started
- https://www.consul.io/commands/kv/put
- https://github.com/hashicorp/consul-template#installation
- https://github.com/hashicorp/consul-template#environment
- https://github.com/hashicorp/consul-template/blob/master/docs/templating-language.md
- https://github.com/hashicorp/consul-template/blob/master/docs/modes.md#exec-mode
- https://github.com/hashicorp/consul-template/blob/master/docs/configuration.md#exec-mode
- SpringBoot: https://docs.spring.io/spring-cloud-consul/docs/current/reference/html/#spring-cloud-consul-config
- SpringBoot: https://docs.spring.io/spring-cloud-consul/docs/current/reference/html/appendix.html
- Quarkus: https://quarkus.io/guides/consul-config