#!/bin/bash set -e up () { pushd meshtastic-map &>/dev/null docker build -t meshtastic-map:latest . popd &>/dev/null docker run \ --detach \ --name meshmap-db \ --restart unless-stopped \ --env MARIADB_DATABASE=meshtastic-map_db \ --env MARIADB_ROOT_PASSWORD=meshtastic-map_pw \ --volume /mammoth/meshmap/db/mariadb:/bitnami/mariadb:rw \ --network pew-net \ bitnami/mariadb echo 'Waiting 10 seconds for mariadb to start up...' sleep 10 docker run \ --detach \ --name meshmap-mqtt \ --env-file $HOME/scripts-private/lech/meshmap.env \ --restart unless-stopped \ --label com.centurylinklabs.watchtower.enable=false \ --env DATABASE_URL="mysql://root:meshtastic-map_pw@meshmap-db:3306/meshtastic-map_db?connection_limit=100" \ --network pew-net \ meshtastic-map:latest /app/docker/mqtt.sh # 8080 on pew-net docker run \ --detach \ --name meshmap-map \ --restart unless-stopped \ --label com.centurylinklabs.watchtower.enable=false \ --env DATABASE_URL="mysql://root:meshtastic-map_pw@meshmap-db:3306/meshtastic-map_db?connection_limit=100" \ --network pew-net \ meshtastic-map:latest /app/docker/map.sh } down () { docker stop meshmap-db || true docker rm meshmap-db || true docker stop meshmap-mqtt || true docker rm meshmap-mqtt || true docker stop meshmap-map || true docker rm meshmap-map || true } $@