-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
182 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
# Do we have env vars for Triton discovery? | ||
# Copy creds from env vars to files on disk | ||
if [ -n ${!TRITON_CREDS_PATH} ] \ | ||
&& [ -n ${!TRITON_CA} ] \ | ||
&& [ -n ${!TRITON_CERT} ] \ | ||
&& [ -n ${!TRITON_KEY} ] | ||
then | ||
mkdir -p ${TRITON_CREDS_PATH} | ||
echo -e "${TRITON_CA}" | tr '#' '\n' > ${TRITON_CREDS_PATH}/ca.pem | ||
echo -e "${TRITON_CERT}" | tr '#' '\n' > ${TRITON_CREDS_PATH}/cert.pem | ||
echo -e "${TRITON_KEY}" | tr '#' '\n' > ${TRITON_CREDS_PATH}/key.pem | ||
fi | ||
|
||
# Are we on Triton? Do we _not_ have a user-defined DC? | ||
# Set the DC automatically from mdata | ||
if [ -n ${TRITON_DC} ] \ | ||
&& [ -f "/native/usr/sbin/mdata-get" ] | ||
then | ||
export TRITON_DC=$(/native/usr/sbin/mdata-get sdc:datacenter_name) | ||
fi | ||
|
||
# Create Prometheus config | ||
consul-template -once -consul-addr ${CONSUL}:8500 -template /etc/prometheus/prometheus.yml.ctmpl:/etc/prometheus/prometheus.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Autopilot Pattern Prometheus on local Docker | ||
|
||
To launch Prometheus locally (on Docker for Mac as an example): | ||
|
||
```bash | ||
$ docker-compose -p prometheus up -d | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Autopilot Pattern Prometheus on Triton | ||
|
||
1. [Get a Joyent account](https://my.joyent.com/landing/signup/) and [add your SSH key](https://docs.joyent.com/public-cloud/getting-started). | ||
2. Install [Docker](https://docs.docker.com/docker-for-mac/install/) on your laptop or other environment, as well as the [Joyent Triton CLI](https://www.joyent.com/blog/introducing-the-triton-command-line-tool). | ||
3. Install the [Triton Docker CLI helper](https://github.com/joyent/triton-docker-cli). | ||
|
||
Check that everything is configured correctly by running the `setup.sh` script. This will check that your environment is setup correctly and create an `_env` file that includes environment variables with reasonable defaults, if not, run `eval "$(triton env)"`. | ||
|
||
```bash | ||
$ setup.sh | ||
$ vim _env | ||
``` | ||
|
||
See the [README](../../README.md) for details on environment variables in `_env`. | ||
|
||
Start everything: | ||
|
||
```bash | ||
triton-docker up -d | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
version: '2.1' | ||
# Prometheus demonstration of the autopilot pattern | ||
|
||
services: | ||
prometheus: | ||
image: autopilotpattern/prometheus:${TAG:-latest} | ||
# Joyent recommends setting instances to always restart on Triton | ||
restart: always | ||
labels: | ||
# This label sets the CNS name, Triton's automatic DNS | ||
# Learn more at https://docs.joyent.com/public-cloud/network/cns | ||
- triton.cns.services=prometheus | ||
# This label selects the proper Joyent resource package | ||
# https://www.joyent.com/blog/optimizing-docker-on-triton#ram-cpu-and-disk-resources-for-your-containers | ||
- com.joyent.package=g4-highcpu-1G | ||
network_mode: bridge | ||
ports: | ||
# You may not want these port declarations for production. Without them, Prometheus will only | ||
# listen on the private network. This will also result in a public prometheus CNS record being created, | ||
# in the triton.zone domain. | ||
- 9090 | ||
env_file: _env | ||
environment: | ||
- CONSUL_AGENT=1 | ||
- CONSUL=pc.svc.${TRITON_CNS_SEARCH_DOMAIN_PRIVATE} | ||
|
||
|
||
# Consul is the service catalog | ||
consul: | ||
image: autopilotpattern/consul:0.7.2-r0.8 | ||
command: > | ||
/usr/local/bin/containerpilot | ||
/bin/consul agent -server | ||
-bootstrap-expect 1 | ||
-config-dir=/etc/consul | ||
-ui-dir /ui | ||
# Change "-bootstrap" to "-bootstrap-expect 3", then scale to 3 or more to | ||
# turn this into an HA Consul raft. | ||
restart: always | ||
mem_limit: 128m | ||
ports: | ||
# As above, this port delcaration should not be made for production. | ||
- 8500 | ||
labels: | ||
- triton.cns.services=pc | ||
network_mode: bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.