Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6a0e4ba
feat(logging): make elastic stack optional
viv-4 Jul 18, 2021
9d6d60e
feat(logging): add argument to `placeos start` to enable elastic stac…
viv-4 Aug 16, 2021
eb363c6
fix(volumes): use ${pwd} instead of .
viv-4 Aug 16, 2021
fc0487e
wip(profiles): add docker-compose profiles kibana & metricbeat
viv-4 Aug 27, 2021
1c4b2a7
fix(placeos): run docker-compose from run_or_abort
viv-4 Aug 27, 2021
0a47550
chore(placeos): adjust output
viv-4 Aug 27, 2021
c5f271c
chore(env): rename ENABLE_ELASTIC_STACK to ENABLE_KIBANA
viv-4 Aug 27, 2021
221ba8d
chore: remove redundant scripts
caspiano Aug 28, 2021
baf421e
refactor(placeos): add kibana profiles in one place
caspiano Aug 28, 2021
67b6167
fix(docker-compose.yml): remove duplicate `restart` key
caspiano Aug 28, 2021
e6d523a
build(docker-compose): use alpine logstash
caspiano Aug 28, 2021
20b92bf
build(docker-compose): use open distro for elasticsearch
caspiano Aug 28, 2021
088b651
build(docker-compose): set tag on logspout-gelf
caspiano Aug 28, 2021
37748d7
refactor(docker-compose): use dockerhub hosted where possible
caspiano Aug 28, 2021
d8c3ceb
build(docker-compose): dep between logstash validator and logstash
caspiano Aug 28, 2021
6d12df9
fix(docker-compose): correct influx tag
caspiano Aug 28, 2021
4b05230
fix(.env): typo for opendistro elastic version
caspiano Aug 28, 2021
b6c0f30
refactor(placeos): DRY argument handling
caspiano Aug 28, 2021
9cc2d66
style: update chars
caspiano Aug 28, 2021
67e1768
build: remove MONITOR_HOSTNAME
caspiano Sep 2, 2021
ef8b416
placeos-1.2109.0 (#72)
kimburgess Sep 7, 2021
18f6928
fix: prevent compat overlays from applying to nightly
kimburgess Sep 10, 2021
eaf6ffd
fix: remove unintended .env change
kimburgess Sep 10, 2021
0921586
build: update to 1.2109.1
caspiano Sep 10, 2021
fbf6d7f
ci: add 1.2109.1
caspiano Sep 10, 2021
6b96708
ci: reorder values in test name
caspiano Sep 10, 2021
5952cee
ci: render empty version
caspiano Sep 10, 2021
547a377
refactor: remove sentry
caspiano Sep 13, 2021
82dedcf
build(docker-compose): update logging env yaml anchor
caspiano Sep 13, 2021
5053515
Merge branch 'master' into feat/logging
caspiano Mar 9, 2022
b1fef11
feat(analytics): optional analytics stack
caspiano Mar 15, 2022
38a31e4
Merge branch 'feat/optional-analytics' into feat/logging
caspiano Mar 15, 2022
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
23 changes: 14 additions & 9 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,23 @@ PLACE_METRICS_ROUTE=monitor

ELASTIC_HOST=elastic
ELASTIC_PORT=9200
ELASTIC_VERSION=7.16.2
ELASTIC_OD_VERSION=1.13.2
ELASTIC_VERSION=7.10.2

ETCD_HOST=etcd
ETCD_PORT=2379
ETCD_VERSION=3.5.1

REDIS_URL=redis://redis:6379

RETHINKDB_DB=place_development
RETHINKDB_HOST=rethink
RETHINKDB_PORT=28015
RETHINKDB_VERSION=2.4

# Analytics variables
ENABLE_ANALYTICS=true

# INFLUX_USER=placeos
# INFLUX_PASSWORD=development

Expand All @@ -52,20 +63,14 @@ INFLUX_HOST=http://influxdb:8086
INFLUX_ORG=PlaceOS
INFLUX_RETENTION=4w

REDIS_URL=redis://redis:6379

RETHINKDB_DB=place_development
RETHINKDB_HOST=rethink
RETHINKDB_PORT=28015
RETHINKDB_VERSION=2.4

# Staff API variables

POSTGRES_USER=placeos
POSTGRES_PASSWORD=development

# Monitor Node variables
# Logging variables

ENABLE_KIBANA=true
LOGSTASH_HOST=logstash
LOGSTASH_PORT=12201
KIBANA_PORT=443
Expand Down
20 changes: 0 additions & 20 deletions compose-files/metricbeat.yml

This file was deleted.

147 changes: 132 additions & 15 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3.7"
version: "3.9"

networks:
placeos:
Expand Down Expand Up @@ -34,6 +34,8 @@ x-jwt-public-key-env: &jwt-public-key-env .env.public_key
x-secret-key-env: &secret-key-env .env.secret_key

x-elastic-client-env: &elastic-client-env
ELASTIC_HOST: ${ELASTIC_HOST:-elastic}
ELASTIC_PORT: ${ELASTIC_PORT:-9200}
ES_HOST: ${ELASTIC_HOST:-elastic}
ES_PORT: ${ELASTIC_PORT:-9200}

Expand Down Expand Up @@ -191,9 +193,12 @@ services:
PLACE_LOADER_WWW: www

source:
image: docker.io/placeos/source:${PLACE_SOURCE_TAG:-nightly}
image: placeos/source:${PLACE_SOURCE_TAG:-nightly}
profiles:
- analytics
restart: always
container_name: source
hostname: source
<<: *std-network
<<: *std-logging
depends_on:
Expand Down Expand Up @@ -235,6 +240,7 @@ services:
postgres: # Database used by Staff API
image: postgres:${POSTGRES_VERSION:-13-alpine}
container_name: postgres
hostname: postgres
restart: unless-stopped
<<: *std-network
<<: *std-logging
Expand All @@ -248,6 +254,7 @@ services:
staff: # Staff API
image: placeos/staff-api:${PLACE_STAFF_API_TAG:-nightly}
container_name: staff
hostname: staff
restart: unless-stopped
<<: *std-network
<<: *std-logging
Expand Down Expand Up @@ -315,20 +322,23 @@ services:
restart: always
container_name: dispatch
hostname: dispatch
env_file:
- *secret-key-env
<<: *std-network
<<: *std-logging
environment:
SERVER_SECRET: ${PLACE_SERVER_SECRET:-development}
env_file:
- *secret-key-env

# Resources

elastic:
image: blacktop/elasticsearch:${ELASTIC_VERSION:-7.9.1}
image: amazon/opendistro-for-elasticsearch:${ELASTIC_OD_VERSION:-1.13.2}
restart: always
container_name: elastic
hostname: elastic
healthcheck:
test: wget -q --no-verbose --tries=1 --spider http://localhost:9200/_cat/health
start_period: 1m
<<: *std-network
<<: *std-logging
volumes:
Expand All @@ -346,33 +356,38 @@ services:
restart: always
container_name: etcd
hostname: etcd
healthcheck:
test: etcdctl endpoint health
<<: *std-network
<<: *std-logging
healthcheck:
test: etcdctl endpoint health
environment:
ALLOW_NONE_AUTHENTICATION: "yes"
TZ: $TZ

influxdb:
image: influxdb:${INFLUXDB_IMAGE_TAG:-2.0.8-alpine}
container_name: influx
profiles:
- analytics
restart: always
container_name: influx
hostname: influx
<<: *std-network
<<: *std-logging
hostname: influx
healthcheck:
test: influx bucket list
volumes:
- type: volume
source: influx-data
target: /root/.influxdbv2
command: "--reporting-disabled"

chronograf:
image: chronograf:${CHRONOGRAF_IMAGE_TAG:-1.9}
container_name: chronograf
profiles:
- analytics
restart: always
container_name: chronograf
hostname: chronograf
<<: *std-network
<<: *std-logging
env_file:
Expand All @@ -394,6 +409,8 @@ services:

mosquitto:
image: iegomez/mosquitto-go-auth:${MOSQUITTO_IMAGE_TAG:-latest}
profiles:
- analytics
restart: always
container_name: mosquitto
hostname: mosquitto
Expand Down Expand Up @@ -439,10 +456,10 @@ services:
restart: always
container_name: redis
hostname: redis
healthcheck:
test: redis-cli ping
<<: *std-network
<<: *std-logging
healthcheck:
test: redis-cli ping
volumes:
- type: volume
source: redis-data
Expand All @@ -455,14 +472,114 @@ services:
restart: always
container_name: rethink
hostname: rethink
<<: *std-network
<<: *std-logging
healthcheck:
# Check if the DB's port is open
test: "bash -c ': &>/dev/null </dev/tcp/127.0.0.1/28015'"
<<: *std-network
<<: *std-logging
volumes:
- type: volume
source: rethink-data
target: /data/rethinkdb_data
environment:
TZ: $TZ

# Aggregates logs and forwards them to Elasticsearch.
logstash:
image: blacktop/logstash:${ELASTIC_VERSION:-7.6}
profiles:
- kibana
restart: always
container_name: logstash
hostname: logstash
<< : *std-network
<< : *std-logging
depends_on:
- validate-logstash-config
volumes:
- ${PWD}/config/logstash/config:/config
- ${PWD}/config/logstash/patterns:/opt/logstash/extra_patterns
command: logstash -f /config

# Run 'docker-compose run --rm validate-logstash-config' to quickly check the logstash config.
validate-logstash-config:
image: blacktop/logstash:${ELASTIC_VERSION:-7.6}
profiles:
- kibana
restart: "no"
container_name: validate-logstash
<< : *std-network
<< : *std-logging
volumes:
- ${PWD}/config/logstash/config:/config
command: logstash -t -f /config

# Sends all container json-file logs to logstash
logspout:
image: vincit/logspout-gelf:3.2.6-alpine
profiles:
- kibana
restart: unless-stopped
container_name: logspout
hostname: logspout
<< : *std-network
<< : *std-logging
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: gelf://${LOGSTASH_HOST}:${LOGSTASH_PORT}

kibana:
image: amazon/opendistro-for-elasticsearch-kibana:${ELASTIC_OD_VERSION:-1.13.2}
profiles:
- kibana
restart: always
container_name: kibana
hostname: kibana
<< : *std-network
<< : *std-logging
environment:
<<: *elastic-client-env
NODE_OPTIONS: "--max-old-space-size=200" # fixes memory leak (https://github.com/elastic/kibana/issues/5170)
HTTPS_METHOD: "nohttp"
ELASTICSEARCH_HOSTS: "http://${ELASTIC_HOST}:${ELASTIC_PORT}"
SERVER_BASEPATH: "/${PLACE_METRICS_ROUTE}"
SERVER_REWRITEBASEPATH: "true"
SERVER_PUBLICBASEURL: "https://${PLACE_DOMAIN}/${PLACE_METRICS_ROUTE}"

# Takes care of piling up Elasticsearch indices/logs. Can do many other things as well.
# Set up a cron job that runs "docker-compose run --rm curator --config /config.yml /action-file.yml" every once in a while.
curator:
image: bobrik/curator:5.7.6
profiles:
- kibana
container_name: curator
hostname: curator
<< : *std-network
<< : *std-logging
volumes:
- ${PWD}/config/curator/action-file.yml:/action-file.yml
- ${PWD}/config/curator/config.yml:/config.yml

# Gets metrics from host machine and send to elastic
metricbeat:
image: elastic/metricbeat:${ELASTIC_VERSION:-7.6}
profiles:
- metricbeat
restart: unless-stopped
container_name: metricbeat
hostname: metricbeat
user: root
<< : *std-network
<< : *std-logging
environment:
<<: *elastic-client-env
volumes:
- /proc:/hostfs/proc:ro
- /sys/fs/cgroup:/hostfs/sys/fs/cgroup:ro
- /:/hostfs:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- ${PWD}/config/metricbeat.yml:/usr/share/metricbeat/metricbeat.yml
cap_add:
- SYS_PTRACE
- DAC_READ_SEARCH
command: ["metricbeat", "-e", "--strict.perms=false", "-system.hostfs=/hostfs", "-E", "output.elasticsearch.hosts=[$ELASTIC_HOST:$ELASTIC_PORT]"]
Loading