Skip to content

Commit

Permalink
Merge pull request #88 from openstreetmap-polska/dev
Browse files Browse the repository at this point in the history
Remove migration code
  • Loading branch information
Zaczero authored Nov 6, 2024
2 parents 7d26d53 + dceab19 commit d45a087
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 23 deletions.
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@ services:
- ${LISTEN:-80}:8000

volumes:
- ./data/postgres:/app/data/postgres16
- ./data/postgres17:/app/data/postgres
- /mnt/data/${TAG}/photos:/app/data/photos
6 changes: 0 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
from anyio import create_task_group
from fastapi import APIRouter, FastAPI
from fastapi.middleware.cors import CORSMiddleware
from sqlalchemy import text
from starlette_compress import CompressMiddleware

from db import db_write
from json_response import JSONResponseUTF8
from middlewares.cache_control_middleware import CacheControlMiddleware
from middlewares.cache_response_middleware import CacheResponseMiddleware
Expand All @@ -26,10 +24,6 @@ async def lifespan(_):
worker_state = await WorkerService.init()

if worker_state.is_primary:
async with db_write() as session:
await session.connection(execution_options={'isolation_level': 'AUTOCOMMIT'})
await session.execute(text('VACUUM ANALYZE'))

async with create_task_group() as tg:
await tg.start(CountryService.update_db_task)
await tg.start(AEDService.update_db_task)
Expand Down
17 changes: 1 addition & 16 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,12 @@ let
'';
});

postgres16 = with pkgs; postgresql_16_jit.withPackages (ps: [ ps.postgis ]);
postgres17 = with pkgs; postgresql_17_jit.withPackages (ps: [ ps.postgis ]);

packages' = with pkgs; [
python'
uv
ruff
coreutils
postgres17
(postgresql_17_jit.withPackages (ps: [ ps.postgis ]))
valkey

# Scripts
Expand Down Expand Up @@ -63,18 +60,6 @@ let
--text-search-config=pg_catalog.simple \
--auth=trust \
--username=postgres
if [ $(cat data/postgres16/PG_VERSION) = "16" ]; then
mkdir -p /tmp/openaedmap-postgres
cp data/postgres/pg_hba.conf data/postgres16/pg_hba.conf
${postgres16}/bin/pg_ctl start -o "-c config_file=config/postgres.conf" -D data/postgres16
${postgres16}/bin/pg_dump -h localhost -U postgres -d postgres -F c -Z 3 -f backup.pgdump
${postgres16}/bin/pg_ctl stop -D data/postgres16
${postgres17}/bin/pg_ctl start -o "-c config_file=config/postgres.conf" -D data/postgres
${postgres17}/bin/pg_restore -h localhost -U postgres -d postgres backup.pgdump
${postgres17}/bin/pg_ctl stop -D data/postgres
rm backup.pgdump
fi
fi
mkdir -p /tmp/openaedmap-postgres data/supervisor
Expand Down

0 comments on commit d45a087

Please sign in to comment.