-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: merge conflict in pdm lock file
- Loading branch information
Showing
24 changed files
with
1,005 additions
and
681 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: 📖 Publish Docs | ||
|
||
on: | ||
push: | ||
paths: | ||
- docs/** | ||
- src/** | ||
- mkdocs.yml | ||
branches: [main] | ||
# Allow manual trigger (workflow_dispatch) | ||
workflow_dispatch: | ||
|
||
jobs: | ||
# build_openapi_json: | ||
# uses: hotosm/gh-workflows/.github/workflows/[email protected] | ||
# with: | ||
# image: ghcr.io/${{ github.repository }}/backend:ci-${{ github.ref_name }} | ||
# example_env_file_path: ".env.sample" | ||
# output_path: docs/openapi.json | ||
|
||
publish_docs: | ||
uses: hotosm/gh-workflows/.github/workflows/[email protected] | ||
# needs: | ||
# - build_openapi_json | ||
# with: | ||
# openapi: true |
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM tianon/postgres-upgrade:14-to-16 | ||
|
||
RUN set -ex \ | ||
&& apt-get update \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install \ | ||
-y --no-install-recommends \ | ||
"postgresql-14-postgis-3" \ | ||
"postgresql-16-postgis-3" \ | ||
&& rm -rf /var/lib/apt/lists/* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Postgres Version Upgrades | ||
|
||
- Based on images from https://github.com/tianon/docker-postgres-upgrade | ||
- Adds the PostGIS dependency and builds an image for our repo. | ||
- The image is used for upgrading between containerised Postgres versions. | ||
|
||
```bash | ||
# From the repo root | ||
bash contrib/pg-upgrade/upgrade-db.sh | ||
``` | ||
|
||
This will start the upgrade, wait for completion, then mount | ||
the data and start the new Postgres 16 container. | ||
|
||
> Note it is important to shut down the postgres container first, or | ||
> a postmaster error will be encountered. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
# The services run in sequential order, via depends_on | ||
|
||
volumes: | ||
pg-14-data: | ||
name: drone-tm-pg-14-data | ||
pg-16-data: | ||
external: true | ||
name: drone-tm-pg-16-data | ||
|
||
services: | ||
# Check if the upgrade has already be complete --> v16 | ||
db-check-upgrade: | ||
image: postgis/postgis:16-3.4-alpine | ||
volumes: | ||
- pg-16-data:/var/lib/postgresql/data | ||
restart: "no" | ||
entrypoint: /bin/sh -c | ||
command: | ||
- | | ||
# The new database directory is empty, so continue upgrade | ||
if [ ! -f "/var/lib/postgresql/data/PG_VERSION" ]; then | ||
echo "Database is empty" | ||
exit 0 | ||
fi | ||
if [ "$(cat /var/lib/postgresql/data/PG_VERSION)" = "16" ]; then | ||
# The database is already upgraded, skip | ||
echo "Database already upgraded" | ||
exit 1 | ||
else | ||
# The database is not upgraded, continue | ||
echo "Database not upgraded yet" | ||
exit 0 | ||
fi | ||
# Only required as we are migrating from filesystem to volume | ||
db-to-volume: | ||
image: postgis/postgis:16-3.4-alpine | ||
volumes: | ||
- ${PROJECT_DIR:-.}/DockerData/dtm_db_data:/var/lib/postgresql/old/data | ||
- pg-14-data:/var/lib/postgresql/new/data | ||
restart: "no" | ||
entrypoint: /bin/sh -c | ||
command: | ||
- | | ||
rm -rf /var/lib/postgresql/new/data | ||
cp -r /var/lib/postgresql/old/data/* /var/lib/postgresql/new/data/ | ||
echo 'Copied postgres data to docker volume' | ||
# Do the actual db upgrade | ||
db-upgrade-version: | ||
image: ghcr.io/hotosm/drone-tm/pg-upgrade:14-to-16 | ||
build: contrib/pg-upgrade | ||
depends_on: | ||
db-to-volume: | ||
condition: service_completed_successfully | ||
volumes: | ||
- pg-14-data:/var/lib/postgresql/14/data | ||
# Volume defined in main docker-compose.yml | ||
- pg-16-data:/var/lib/postgresql/16/data | ||
env_file: .env | ||
environment: | ||
PGUSER: ${POSTGRES_USER} | ||
POSTGRES_INITDB_ARGS: -U ${POSTGRES_USER} | ||
restart: "no" | ||
|
||
# Replace the generated pg_hba.conf access file with the original | ||
db-config-hba: | ||
image: postgis/postgis:16-3.4-alpine | ||
depends_on: | ||
db-upgrade-version: | ||
condition: service_completed_successfully | ||
volumes: | ||
- pg-14-data:/var/lib/postgresql/14/data | ||
- pg-16-data:/var/lib/postgresql/16/data | ||
restart: "no" | ||
entrypoint: /bin/sh -c | ||
command: | ||
- | | ||
cp -f \ | ||
/var/lib/postgresql/14/data/pg_hba.conf \ | ||
/var/lib/postgresql/16/data/ | ||
echo 'Copied pg_hba.conf to new postgres dir' | ||
# Start the db so we can run maintenance tasks | ||
db-startup: | ||
image: postgis/postgis:16-3.4-alpine | ||
depends_on: | ||
db-config-hba: | ||
condition: service_completed_successfully | ||
volumes: | ||
- pg-16-data:/var/lib/postgresql/data | ||
env_file: .env | ||
networks: | ||
- dtm-network | ||
restart: unless-stopped | ||
healthcheck: | ||
test: pg_isready -U ${POSTGRES_USER:-dtm} -d ${POSTGRES_DB:-dtm_db} | ||
start_period: 5s | ||
interval: 10s | ||
timeout: 5s | ||
retries: 3 | ||
|
||
# Run maintenance, db vacuum | ||
db-upgrade: | ||
image: postgis/postgis:16-3.4-alpine | ||
depends_on: | ||
db-startup: | ||
condition: service_healthy | ||
env_file: .env | ||
networks: | ||
- dtm-network | ||
restart: "no" | ||
entrypoint: /bin/sh -c | ||
command: | ||
- | | ||
PGPASSWORD=${POSTGRES_PASSWORD} \ | ||
vacuumdb \ | ||
--host=db-startup \ | ||
--username=${POSTGRES_USER} \ | ||
--all \ | ||
--analyze-in-stages |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
|
||
# Pull upgrade container | ||
docker compose \ | ||
-f docker-compose.yml \ | ||
-f contrib/pg-upgrade/docker-compose.yml \ | ||
pull db-upgrade-version | ||
|
||
# Get exit code from db version check | ||
docker compose \ | ||
-f docker-compose.yml \ | ||
-f contrib/pg-upgrade/docker-compose.yml \ | ||
up db-check-upgrade --exit-code-from db-check-upgrade | ||
exit_code=$? | ||
|
||
# Exit script if upgrade complete | ||
if [ "$exit_code" -eq 1 ]; then | ||
echo "Database is already upgraded. Skipping." | ||
|
||
docker compose \ | ||
-f docker-compose.yml \ | ||
-f contrib/pg-upgrade/docker-compose.yml \ | ||
rm --force db-check-upgrade | ||
|
||
exit 0 | ||
fi | ||
|
||
# Stop any existing locks on db | ||
docker compose \ | ||
-f docker-compose.yml \ | ||
-f contrib/pg-upgrade/docker-compose.yml \ | ||
down | ||
|
||
# Do the db upgrade | ||
docker compose \ | ||
-f docker-compose.yml \ | ||
-f contrib/pg-upgrade/docker-compose.yml \ | ||
up -d db-upgrade | ||
|
||
# View any logs | ||
docker compose \ | ||
-f docker-compose.yml \ | ||
-f contrib/pg-upgrade/docker-compose.yml \ | ||
logs db-upgrade-version | ||
|
||
# Shut down db to prior to restart | ||
docker compose \ | ||
-f docker-compose.yml \ | ||
-f contrib/pg-upgrade/docker-compose.yml \ | ||
down |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hotosm.github.io |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
:root { | ||
--md-primary-fg-color: #d73f3f; | ||
--md-primary-fg-color--light: #e27575; | ||
--md-primary-fg-color--dark: #c22929; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Drone Tasking Manager | ||
|
||
Welcome to the docs! |
Oops, something went wrong.