]> Untitled Git - lemmy.git/commitdiff
Upgrade to postgres 15. (#2659)
authorDessalines <dessalines@users.noreply.github.com>
Fri, 20 Jan 2023 17:15:07 +0000 (12:15 -0500)
committerGitHub <noreply@github.com>
Fri, 20 Jan 2023 17:15:07 +0000 (18:15 +0100)
docker/dev/docker-compose.yml
docker/federation/docker-compose.yml
docker/prod/docker-compose.yml
scripts/postgres_12_to_15_upgrade.sh [moved from scripts/postgres_12_to_14_upgrade.sh with 69% similarity]

index 56647a7a57fc5149c167317e148100a03f0fe617..e38d0ca1d076b3d1c4d0a2743c910f143791a724 100644 (file)
@@ -86,10 +86,36 @@ services:
     restart: always
 
   postgres:
-    image: postgres:14-alpine
+    image: postgres:15-alpine
     # this needs to match the database host in lemmy.hson
+    # Tune your settings via
+    # https://pgtune.leopard.in.ua/#/
+    # You can use this technique to add them here
+    # https://stackoverflow.com/a/30850095/1655478
     hostname: postgres
-    command: ["postgres", "-c", "session_preload_libraries=auto_explain", "-c", "auto_explain.log_min_duration=5ms", "-c", "auto_explain.log_analyze=true"]
+    command: [
+      "postgres",
+      "-c", "session_preload_libraries=auto_explain",
+      "-c", "auto_explain.log_min_duration=5ms",
+      "-c", "auto_explain.log_analyze=true"
+      # Tuning config
+      # "-c", "max_connections=200",
+      # "-c", "shared_buffers=3GB",
+      # "-c", "effective_cache_size=9GB",
+      # "-c", "maintenance_work_mem=768MB",
+      # "-c", "checkpoint_completion_target=0.9",
+      # "-c", "wal_buffers=16MB",
+      # "-c", "default_statistics_target=100",
+      # "-c", "random_page_cost=4",
+      # "-c", "effective_io_concurrency=2",
+      # "-c", "work_mem=7864kB",
+      # "-c", "min_wal_size=1GB",
+      # "-c", "max_wal_size=4GB",
+      # "-c", "max_worker_processes=4",
+      # "-c", "max_parallel_workers_per_gather=2",
+      # "-c", "max_parallel_workers=4",
+      # "-c", "max_parallel_maintenance_workers=2",
+    ]
     networks:
       - lemmyinternal
     # adding the external facing network to allow direct db access for devs
index f362f0197d37b3a345dea6d917b0a4212d8677e2..13e73fb98e5bed53163e44557cdabde184ca3d71 100644 (file)
@@ -47,7 +47,7 @@ services:
     ports: 
       - "8541:8541"
   postgres_alpha:
-    image: postgres:14-alpine
+    image: postgres:15-alpine
     environment:
       - POSTGRES_USER=lemmy
       - POSTGRES_PASSWORD=password
@@ -75,7 +75,7 @@ services:
     ports: 
       - "8551:8551"
   postgres_beta:
-    image: postgres:14-alpine
+    image: postgres:15-alpine
     environment:
       - POSTGRES_USER=lemmy
       - POSTGRES_PASSWORD=password
@@ -103,7 +103,7 @@ services:
     ports: 
       - "8561:8561"
   postgres_gamma:
-    image: postgres:14-alpine
+    image: postgres:15-alpine
     environment:
       - POSTGRES_USER=lemmy
       - POSTGRES_PASSWORD=password
@@ -132,7 +132,7 @@ services:
     ports: 
       - "8571:8571"
   postgres_delta:
-    image: postgres:14-alpine
+    image: postgres:15-alpine
     environment:
       - POSTGRES_USER=lemmy
       - POSTGRES_PASSWORD=password
@@ -161,7 +161,7 @@ services:
     ports: 
       - "8581:8581"
   postgres_epsilon:
-    image: postgres:14-alpine
+    image: postgres:15-alpine
     environment:
       - POSTGRES_USER=lemmy
       - POSTGRES_PASSWORD=password
index a0fe5cfeb875d3e63f358a42cd41a0e1bf4f23b2..a1efd03f1374c159037313c85b0658c04b2710f7 100644 (file)
@@ -72,7 +72,7 @@ services:
     restart: always
 
   postgres:
-    image: postgres:14-alpine
+    image: postgres:15-alpine
     # this needs to match the database host in lemmy.hson
     hostname: postgres
     networks:
similarity index 69%
rename from scripts/postgres_12_to_14_upgrade.sh
rename to scripts/postgres_12_to_15_upgrade.sh
index 6f1f6d461a2a9219796d074dd05785f6c3455450..0850e8fca79baeb3668d4da182624a8eb5284ded 100755 (executable)
@@ -3,12 +3,15 @@ set -e
 
 echo "Do not stop in the middle of this upgrade, wait until you see the message: Upgrade complete."
 
+echo "Stopping lemmy and all services..."
+sudo docker-compose stop
+
 echo "Make sure postgres is started..."
 sudo docker-compose up -d postgres
 sleep 20s
 
-echo "Exporting the Database to 12_14.dump.sql ..."
-sudo docker-compose exec -T postgres pg_dumpall -c -U lemmy > 12_14_dump.sql
+echo "Exporting the Database to 12_15.dump.sql ..."
+sudo docker-compose exec -T postgres pg_dumpall -c -U lemmy > 12_15_dump.sql
 echo "Done."
 
 echo "Stopping postgres..."
@@ -18,20 +21,20 @@ sleep 20s
 echo "Removing the old postgres folder"
 sudo rm -rf volumes/postgres
 
-echo "Updating docker-compose to use postgres version 14."
-sed -i "s/postgres:12-alpine/postgres:14-alpine/" ./docker-compose.yml
+echo "Updating docker-compose to use postgres version 15."
+sed -i "s/image: postgres:.*/image: postgres:15-alpine/" ./docker-compose.yml
 
 echo "Starting up new postgres..."
 sudo docker-compose up -d postgres
 sleep 20s
 
 echo "Importing the database...."
-cat 12_14_dump.sql | sudo docker-compose exec -T postgres psql -U lemmy
+cat 12_15_dump.sql | sudo docker-compose exec -T postgres psql -U lemmy
 echo "Done."
 
 POSTGRES_PASSWORD=$(grep "POSTGRES_PASSWORD" ./docker-compose.yml | cut -d"=" -f2)
 
-echo "Fixing a weird password issue with postgres 14"
+echo "Fixing a weird password issue with postgres 15"
 sudo docker-compose exec -T postgres psql -U lemmy -c "alter user lemmy with password '$POSTGRES_PASSWORD'"
 sudo docker-compose restart postgres
 
@@ -41,5 +44,5 @@ sudo chown -R 991:991 volumes/pictrs
 echo "Starting up lemmy..."
 sudo docker-compose up -d
 
-echo "A copy of your old database is at 12_14.dump.sql . You can delete this file if the upgrade went smoothly."
+echo "A copy of your old database is at 12_15.dump.sql . You can delete this file if the upgrade went smoothly."
 echo "Upgrade complete."