Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HA consul example for APIRS #1789

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 67 additions & 76 deletions examples/stacks/apirs/apirs.dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@
"steppedLine": false,
"targets": [
{
"expr": "mongodb_mongod_op_counters_total{instance=\"apirs_mongo\"}",
"expr": "rate(mongodb_mongod_op_counters_total{instance=\"apirs_mongo\"}[1m])",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "{{type}}",
Expand All @@ -258,7 +258,7 @@
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "MongoDB Operations",
"title": "MongoDB Operations (per sec)",
"tooltip": {
"shared": true,
"sort": 0,
Expand Down Expand Up @@ -296,7 +296,7 @@
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "Dashboard Row",
"title": "Mongo",
"titleSize": "h6"
},
{
Expand Down Expand Up @@ -391,91 +391,82 @@
"valueName": "current"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": true,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
"fill": 1,
"id": 14,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": false,
"min": true,
"rightSide": false,
"show": true,
"total": false,
"values": true
},
"id": 7,
"interval": null,
"lines": true,
"linewidth": 1,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "consul_health_node_status",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A",
"step": 20
"legendFormat": "{{node}}",
"refId": "A"
}
],
"thresholds": "0.1,0.9",
"title": "Consul Health Status",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
},
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "Health Node Status",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"op": "=",
"text": "UNHEALTHY",
"value": "0"
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"op": "=",
"text": "HEALTHY",
"value": "1"
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"valueName": "current"
]
},
{
"cacheTimeout": null,
Expand Down Expand Up @@ -636,7 +627,7 @@
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "Dashboard Row",
"title": "Consul",
"titleSize": "h6"
},
{
Expand Down Expand Up @@ -975,7 +966,7 @@
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "Dashboard Row",
"title": "Redis",
"titleSize": "h6"
}
],
Expand Down Expand Up @@ -1017,4 +1008,4 @@
"timezone": "",
"title": "Apirs dashboard",
"version": 2
}
}
116 changes: 109 additions & 7 deletions examples/stacks/apirs/apirs.stage1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,31 @@ volumes:
mongo-primary-db:
mongo-secondary-db:
mongo-arbiter-db:
consul-data:
consul-data-member-a:
driver: local
driver_opts:
type: nfs
device: :/appc/consul/a
o: addr=${NFS_SERVER},nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2
consul-data-member-b:
driver: local
driver_opts:
type: nfs
device: :/appc/consul/b
o: addr=${NFS_SERVER},nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2
consul-data-member-c:
driver: local
driver_opts:
type: nfs
device: :/appc/consul/c
o: addr=${NFS_SERVER},nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2
redis-data:
nfs_init:
driver: local
driver_opts:
type: nfs
device: :/
o: addr=${NFS_SERVER},nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2

services:
mongo-primary:
Expand Down Expand Up @@ -90,22 +113,83 @@ services:
io.amp.metrics.port: "9104"
io.amp.metrics.mode: "exporter"

consul:
image: consul:1.0.0
consul-member-a:
image: consul:1.0.1
networks:
- backend
- db
- public
backend:
aliases:
- consul
db:
aliases:
- consul
public:
aliases:
- consul
deploy:
replicas: 1
placement:
constraints:
- node.labels.amp.type.user == true
volumes:
- consul-data:/consul/data
- consul-data-member-a:/consul/data
environment:
SERVICE_PORTS: 8500
VIRTUAL_HOST: "https://consul.apirs.*,consul.apirs.*"
CONSUL_BIND_INTERFACE: "eth0"
CONSUL_CLIENT_INTERFACE: "eth0"
command: ["agent", "-server", "-client=0.0.0.0", "-ui", "-bootstrap-expect=3", "-retry-join=consul-member-b", "-retry-join=consul-member-c"]

consul-member-b:
image: consul:1.0.1
networks:
backend:
aliases:
- consul
db:
aliases:
- consul
public:
aliases:
- consul
deploy:
replicas: 1
placement:
constraints:
- node.labels.amp.type.user == true
volumes:
- consul-data-member-b:/consul/data
environment:
SERVICE_PORTS: 8500
VIRTUAL_HOST: "https://consul.apirs.*,consul.apirs.*"
CONSUL_BIND_INTERFACE: "eth0"
CONSUL_CLIENT_INTERFACE: "eth0"
command: ["agent", "-server", "-client=0.0.0.0", "-ui", "-bootstrap-expect=3", "-retry-join=consul-member-b", "-retry-join=consul-member-c"]

consul-member-c:
image: consul:1.0.1
networks:
backend:
aliases:
- consul
db:
aliases:
- consul
public:
aliases:
- consul
deploy:
replicas: 1
placement:
constraints:
- node.labels.amp.type.user == true
volumes:
- consul-data-member-c:/consul/data
environment:
SERVICE_PORTS: 8500
VIRTUAL_HOST: "https://consul.apirs.*,consul.apirs.*"
CONSUL_BIND_INTERFACE: "eth0"
CONSUL_CLIENT_INTERFACE: "eth0"
command: ["agent", "-server", "-client=0.0.0.0", "-ui", "-bootstrap-expect=3", "-retry-join=consul-member-b", "-retry-join=consul-member-c"]

consul_exporter:
image: prom/consul-exporter:v0.3.0
Expand Down Expand Up @@ -166,3 +250,21 @@ services:
# REGISTRY_STORAGE_MAINTENANCE_READONLY_ENABLED: "false"
SERVICE_PORTS: 5000
VIRTUAL_HOST: "registry.apirs.*,https://registry.apirs.*"

nfs-init:
image: alpine:3.7
networks:
- db
deploy:
replicas: 1
restart_policy:
condition: none
placement:
constraints:
- node.labels.amp.type.user == true
volumes:
- type: volume
source: nfs_init
target: /nfs
command: [ "mkdir", "-p", "/nfs/appc/consul/a", "/nfs/appc/consul/b", "/nfs/appc/consul/c", "/nfs/appc/arrowdb/photos", "/nfs/appc/arrowdb/files", "/nfs/appc/arrowdb/exports" ]

27 changes: 1 addition & 26 deletions examples/stacks/apirs/apirs.stage2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ services:
mode: 0554

consul-init:
image: consul:1.0.0
image: consul:1.0.1
networks:
- db
deploy:
Expand All @@ -56,28 +56,3 @@ services:
- source: consul_kv
target: /values.json
mode: 0554

nfs-init:
image: alpine:3.6
networks:
- db
deploy:
replicas: 1
restart_policy:
condition: none
placement:
constraints:
- node.labels.amp.type.user == true
volumes:
- type: volume
source: nfs_init
target: /nfs
command: [ "mkdir", "-p", "/nfs/appc/arrowdb/photos", "/nfs/appc/arrowdb/files", "/nfs/appc/arrowdb/exports" ]

volumes:
nfs_init:
driver: local
driver_opts:
type: nfs
device: :/
o: addr=${NFS_SERVER:-fs-0a000a00.efs.us-west-2.amazonaws.com},nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2