-
Notifications
You must be signed in to change notification settings - Fork 14
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
Support triton metrics #21
Merged
+182
−57
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to update this one (https://github.com/autopilotpattern/consul/releases), but we can do that later: #22