Last active
October 17, 2022 00:45
-
-
Save ericreeves/66fe5028e6c434868ee55ed29b2ce112 to your computer and use it in GitHub Desktop.
astro-docker
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
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} |
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
#!/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