Skip to content

Commit

Permalink
update from prebuilt DB image (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddewie authored May 5, 2024
1 parent 4d76578 commit 3936478
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
14 changes: 7 additions & 7 deletions .circleci/nightly-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@ jobs:
- checkout
- run: wget -qO- 'https://getfly.fly.dev/linux-x86-64/flyctl.tgz' | tar xz
- run: echo "$GITHUB_TOKEN" | docker login ghcr.io -u "$GITHUB_USERNAME" --password-stdin
- run: docker compose build db
- run: docker compose pull db
- run: docker image ls ghcr.io/hiddewie/openrailwaymap-import-db:latest
- run: docker compose up --no-build --pull never --wait db
- run: docker compose build import
- run: docker compose build martin-cp
- run: docker compose up --wait db
- run: curl --location --progress-bar https://download.geofabrik.de/europe-latest.osm.pbf --output data/data.osm.pbf
- run:
no_output_timeout: 1h
environment:
OSM2PGSQL_DATAFILE: data.osm.pbf
OSM2PGSQL_CACHE: '7000'
OSM2PGSQL_NUMPROC: '2'
command: docker compose up import
command: docker compose run import update
- run: docker compose push import
- 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')"
# Persist and squash data in new image
docker cp "$DB_CONTAINER_ID:/var/lib/postgresql/postgres-data" db/postgres-data
echo 'COPY postgres-data /var/lib/postgresql/postgres-data' >> db/Dockerfile
echo '!db/postgres-data' >> .dockerignore
docker compose build db
docker compose push db
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.swp
data/
db/postgres-data
standard.xml
maxspeed.xml
signals.xml
Expand All @@ -11,4 +12,4 @@ tmp
.kosmtik-config.yml
.env
*.osm.pbf
.idea
.idea
3 changes: 2 additions & 1 deletion SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ docker compose run --build import import

Build the tiles:
```shell
export BBOX='-11.3818,35.8891,25.0488,57.3976'
for tile in low-med standard speed signals electrification gauge do
docker compose up --build martin-cp
env "TILES=$tiles" docker compose up martin-cp
done
```

Expand Down
1 change: 1 addition & 0 deletions import/docker-startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ update)

echo "Updating data (osm2psql cache ${OSM2PGSQL_CACHE:-256}MB, ${OSM2PGSQL_NUMPROC:-4} processes)"
osm2pgsql-replication update \
--once \
--database gis \
-- \
--slim \
Expand Down

0 comments on commit 3936478

Please sign in to comment.