Skip to content

Deploy

Deploy #28

Workflow file for this run

name: Deploy
on:
workflow_dispatch: ~
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
jobs:
deploy-proxy:
name: Deploy proxy
runs-on: ubuntu-latest
environment: proxy-production
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Setup Fly
uses: superfly/flyctl-actions/setup-flyctl@master
- name: Deploy
run: |
flyctl deploy --config proxy.fly.toml --local-only
deploy-tiles:
name: Deploy tiles
runs-on: ubuntu-latest
environment: tiles-production
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Setup Fly
uses: superfly/flyctl-actions/setup-flyctl@master
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# - name: Install Osmium
# run: |
# sudo apt install osmium-tool
- name: Generate cache key
id: cache-key
run: |
echo "key=$(date +%Y-%W)" >> $GITHUB_OUTPUT
# - name: Cache downloaded OpenStreetMap data
# id: cache-data
# uses: actions/cache@v4
# with:
# key: 'data-europe-${{ steps.cache-key.outputs.key }}'
# path: data/filtered/europe.osm.pbf
#
# - name: Download data
# if: ${{ steps.cache-data.outputs.cache-hit != 'true' }}
# run: |
# curl --progress-bar http://ftp.snt.utwente.nl/pub/misc/openstreetmap/europe-latest.osm.pbf --output data/europe.osm.pbf
- name: Pull import database
run: |
docker compose pull db
docker compose up --no-build --pull never --detach db
# - name: Import data
- name: Ensure data is up to date
env:
# Available cores: 4
OSM2PGSQL_NUMPROC: 4
# Available memory: 16GB
OSM2PGSQL_CACHE: 14000
# OSM2PGSQL_DATAFILE: europe.osm.pbf
run: |
docker compose pull import
docker compose up --pull never --build import
docker compose push import
- name: Commit and push new database image
run: |
docker compose stop db
DB_CONTAINER_ID="$(docker compose ps --all --format json | jq -r 'select(.Service == "db") | .ID')"
DB_IMAGE="$(docker compose ps --all --format json | jq -r 'select(.Service == "db") | .Image')"
docker commit "$DB_CONTAINER_ID" "$DB_IMAGE"
docker image ls "$DB_IMAGE"
docker push "$DB_IMAGE"
- name: Generate tiles
run: |
docker compose up --no-build --pull never --detach db
docker compose up --build martin-cp
- name: Deploy
run: |
flyctl deploy --config martin-static.fly.toml --local-only