vault server -dev
cd file-backend
vault server -config=vault-config.hcl
export VAULT_ADDR=http://localhost:8200
export VAULT_SKIP_VERIFY=true
vault operator init
vault operator unseal <shamir-key-1>
vault operator unseal <shamir-key-2>
vault operator unseal <shamir-key-3>
vault login <token>
vault status
This is an example of hosting vault in docker and store the secrets in consul, in the HA folder, you can add additional consul standbys to the cluster.
It will create contianers for vault and consul respectively using the official Hashicorp docker image. The version is set to 1.5.0 for Vault and 1.8.2 for Consul for compatibility purpose.
Since we are using the official image, please check the docker image built code and the docs at
- https://hub.docker.com/_/vault
- https://github.com/hashicorp/docker-vault
- https://hub.docker.com/_/consul
- https://github.com/hashicorp/docker-consul
Some of the logic is hidden inside the start up script in docker-entrypoint.sh, necessary ENV Vars are required to make it work properly.
cd consul-backend
docker-compose up -d
export VAULT_ADDR=http://localhost:8200
export VAULT_SKIP_VERIFY=true
vault operator init
vault operator unseal <shamir-key-1>
vault operator unseal <shamir-key-2>
vault operator unseal <shamir-key-3>
vault login <token>
vault status
...
...
docker-compose down
helm repo add hashicorp https://helm.releases.hashicorp.com
helm install consul hashicorp/consul --values helm-consul-values.yml
helm install vault hashicorp/vault --values helm-vault-values.yml