Skip to content

Instantly share code, notes, and snippets.

@ericreeves
Last active October 17, 2022 00:45
Show Gist options
  • Save ericreeves/66fe5028e6c434868ee55ed29b2ce112 to your computer and use it in GitHub Desktop.
Save ericreeves/66fe5028e6c434868ee55ed29b2ce112 to your computer and use it in GitHub Desktop.
astro-docker
version: '3.7'
x-base:
&base
restart: unless-stopped
networks:
- airflow_docker_net
logging:
driver: json-file
options:
max-size: '10m'
max-file: '3'
services:
statsd:
container_name: ${PROJNAME}-statsd
image: quay.io/astronomer/ap-statsd-exporter
<< : *base
ports:
- 9102:9102/tcp
- 9125:9125/tcp
- 9125:9125/udp
prometheus:
container_name: ${PROJNAME}-prometheus
image: prom/prometheus
<< : *base
ports:
- 9090:9090
volumes:
- ${PWD}/prometheus.yml:/etc/prometheus/prometheus.yml
grafana:
container_name: ${PROJNAME}-grafana
image: grafana/grafana-oss
<< : *base
ports:
- 3000:3000
networks:
airflow_docker_net:
external:
name: ${AIRFLOW_DOCKER_NET}
#!/bin/bash
PROJNAME=jacobm-astro-dev
cat > prometheus.yml <<EOF
scrape_configs:
- job_name: $PROJNAME
static_configs:
- targets: ['statsd:9102']
EOF
mkdir -p $PROJNAME
pushd $PROJNAME
astro dev init
cat >> .env <<EOF
AIRFLOW_METRICS_STATSD_ON=True
AIRFLOW_METRICS_STATSD_HOST=statsd
AIRFLOW_METRICS_STATSD_PORT=9125
AIRFLOW_METRICS_STATSD_PREFIX=airflow
EOF
astro dev start
popd
SCHEDULER_CONTAINER_ID=$(docker ps | grep scheduler | cut -f1 -d' ')
NETWORK=$(docker inspect ${SCHEDULER_CONTAINER_ID} | jq -r '.[0].NetworkSettings.Networks | keys[0]')
cat >> .env <<EOF
AIRFLOW_DOCKER_NET=${NETWORK}
EOF
docker-compose up --detach --remove-orphans
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment