Skip to content

Commit

Permalink
Initiam Swarm Cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
maxyermayank committed Aug 15, 2018
1 parent ee90496 commit 6d04721
Show file tree
Hide file tree
Showing 8 changed files with 231 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*/temp*
*/*/temp*
temp?
*.md
!LICENSE.md
.git
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
VAULT_TAG=0.10.4
CONSUL_TAG=1.2.2
STACK_NAME=devops
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,27 @@
# vault-consul-swarm-cluster
vault-consul-swarm-cluster


## Deploy Stack
```
env $(cat .env | grep ^[A-Z] | xargs) docker stack deploy -c stack.yml devops
```

## Remove Stack
```
docker stack rm devops
```

## List Docker Services
```
docker service ls
```

## Access Vault UI
```
open http://localhost:8200
```

## Access Consul UI
```
open http://localhost:8500
```
32 changes: 32 additions & 0 deletions consul/agent/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"server": false,
"datacenter": "us-east-1",
"data_dir": "/consul/data",
"client_addr": "0.0.0.0",
"bind_addr": "{{ GetInterfaceIP \"eth0\" }}",
"advertise_addr" : "{{ GetInterfaceIP \"eth0\" }}",
"ui": false,
"leave_on_terminate" : true,
"skip_leave_on_interrupt" : false,
"disable_update_check": true,
"addresses" : {
"http" : "0.0.0.0"
},
"ports": {
"http": 8500
},
"log_level": "DEBUG",
"acl_enforce_version_8": false,
"acl_datacenter": "us-east-1",
"acl_master_token": "w94RIMKUtQH1a4VJGN+t+vn1Y0nErc/ch93E1F1ZcHU=",
"acl_default_policy": "allow",
"connect" : {
"enabled" : true
},
"dns_config": {
"allow_stale": false
},
"retry_join" : [
"tasks.consulserver"
]
}
37 changes: 37 additions & 0 deletions consul/server/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"bootstrap": true,
"server": true,
"datacenter": "us-east-1",
"data_dir": "/consul/data",
"client_addr": "0.0.0.0",
"bind_addr": "{{ GetInterfaceIP \"eth0\" }}",
"advertise_addr" : "{{ GetInterfaceIP \"eth0\" }}",
"bootstrap_expect": 1,
"ui": true,
"leave_on_terminate" : true,
"skip_leave_on_interrupt" : true,
"disable_update_check": true,
"addresses" : {
"http" : "0.0.0.0"
},
"ports": {
"http": 8500
},
"log_level": "DEBUG",
"acl_enforce_version_8": false,
"acl_datacenter": "us-east-1",
"acl_master_token": "w94RIMKUtQH1a4VJGN+t+vn1Y0nErc/ch93E1F1ZcHU=",
"acl_default_policy": "allow",
"connect" : {
"enabled" : true
},
"dns_config": {
"allow_stale": false
},
"autopilot": {
"cleanup_dead_servers": true
},
"retry_join" : [
"tasks.consulserver"
]
}
126 changes: 126 additions & 0 deletions stack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
version: "3.6"

services:
consulserver:
image: consul:${CONSUL_TAG:-latest}
restart: unless-stopped
volumes:
- ${PWD}/consul/server:/consul/config
- consul_files:/consul/data
ports:
- target: 8300
published: 8300
mode: host
- target: 8301
published: 8301
mode: host
- target: 8302
published: 8302
mode: host
- target: 8400
published: 8400
mode: host
- target: 8500
published: 8500
mode: host
- target: 8600
published: 8600
mode: host
command:
- agent
- -server
- -config-file=/consul/config/config.json
- -ui
networks:
- devops
deploy:
resources:
reservations:
cpus: '.25'
memory: 256M
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
update_config:
order: stop-first
consulagent:
image: consul:${CONSUL_TAG:-latest}
restart: unless-stopped
volumes:
- ${PWD}/consul/agent:/consul/config
- consul_agent_files:/consul/data
command:
- agent
- -config-file=/consul/config/config.json
networks:
- devops
deploy:
resources:
reservations:
cpus: '.25'
memory: 256M
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
update_config:
order: stop-first
vault:
image: vault:${VAULT_TAG:-latest}
restart: unless-stopped
environment:
VAULT_ADDR: http://127.0.0.1:8200
VAULT_LOCAL_CONFIG: >-
{
"ui": true,
"backend": {
"consul": {
"address" : "http://consulserver:8500",
"path" : "vault/"
}
},
"default_lease_ttl": "168h",
"max_lease_ttl": "720h",
"plugin_directory" : "/vault/plugins",
"listener": {
"tcp": {
"address": "0.0.0.0:8200",
"tls_disable": true
}
},
"disable_mlock": true
}
command:
- server
networks:
- devops
volumes:
- vault_logs:/vault/logs
- ${PWD}/vault/plugins:/vault/plugins
ports:
- target: 8200
published: 8200
mode: host
deploy:
resources:
reservations:
cpus: '.25'
memory: 256M
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
update_config:
order: stop-first

volumes:
consul_files:
consul_agent_files:
vault_logs:

networks:
devops:
Binary file added vault/plugins/vault-plugin-database-oracle
Binary file not shown.

0 comments on commit 6d04721

Please sign in to comment.