From 45c6b7c5429f288c7be9c250f981edb53dc24227 Mon Sep 17 00:00:00 2001 From: Benoit Date: Fri, 11 Oct 2024 18:58:28 +0900 Subject: [PATCH] Mastodon: Add postgresql config --- cfg/jobs/mastodon.run | 6 +++--- run/mastodon/workspace/postgresql.conf | 25 +++++++++++++++++++++++++ run/mastodon/workspace/setup.sh | 3 ++- 3 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 run/mastodon/workspace/postgresql.conf diff --git a/cfg/jobs/mastodon.run b/cfg/jobs/mastodon.run index 24b521e..06b2345 100644 --- a/cfg/jobs/mastodon.run +++ b/cfg/jobs/mastodon.run @@ -10,7 +10,7 @@ VER="${VER//./-}" UPSTREAM_VER="4.3.0" UPSTREAM_VER_DASH="${UPSTREAM_VER//./-}" UPSTREAM_NAME="mastodon" -SERIAL="1benoitjpnet" +SERIAL="2benoitjpnet" CNAME="$UPSTREAM_NAME-$UPSTREAM_VER_DASH-$SERIAL-$DIST-$VER" ALIAS="$UPSTREAM_NAME-$UPSTREAM_VER-$SERIAL" @@ -32,14 +32,14 @@ incus exec "$CNAME" -- bash -c ' lsb-release \ ca-certificates ' -incus file push "$WORKSPACE"/{setup.sh,setup_mastodon.sh} "$CNAME"/tmp/ +incus file push "$WORKSPACE"/{setup.sh,setup_mastodon.sh,postgresql.conf} \ + "$CNAME"/tmp/ incus exec "$CNAME" -- bash /tmp/setup.sh incus exec "$CNAME" \ --user 1001 \ --env HOME=/home/mastodon \ --force-noninteractive \ -- bash /tmp/setup_mastodon.sh -incus file push "$WORKSPACE"/postgresql.conf "$CNAME"/etc/postgresql/17/main/postgresql.conf # Clean incus exec "$CNAME" -- \ diff --git a/run/mastodon/workspace/postgresql.conf b/run/mastodon/workspace/postgresql.conf new file mode 100644 index 0000000..1c393ca --- /dev/null +++ b/run/mastodon/workspace/postgresql.conf @@ -0,0 +1,25 @@ +# DB Version: 17 +# OS Type: linux +# DB Type: web +# Total Memory (RAM): 3 GB +# CPUs num: 6 +# Connections num: 300 +# Data Storage: ssd + +max_connections = 300 +shared_buffers = 768MB +effective_cache_size = 2304MB +maintenance_work_mem = 192MB +checkpoint_completion_target = 0.9 +wal_buffers = 16MB +default_statistics_target = 100 +random_page_cost = 1.1 +effective_io_concurrency = 200 +work_mem = 873kB +huge_pages = off +min_wal_size = 1GB +max_wal_size = 4GB +max_worker_processes = 6 +max_parallel_workers_per_gather = 3 +max_parallel_workers = 6 +max_parallel_maintenance_workers = 3 diff --git a/run/mastodon/workspace/setup.sh b/run/mastodon/workspace/setup.sh index ef72086..6865b2d 100644 --- a/run/mastodon/workspace/setup.sh +++ b/run/mastodon/workspace/setup.sh @@ -12,7 +12,7 @@ echo "deb [signed-by=/usr/share/keyrings/postgresql.asc] http://apt.postgresql.o # System packages apt update apt install -y \ - imagemagick ffmpeg libvips-tools libpq-dev libxml2-dev libxslt1-dev file git-core \ + imagemagick libvips-tools libpq-dev libxml2-dev libxslt1-dev file git-core \ g++ libprotobuf-dev protobuf-compiler pkg-config gcc autoconf \ bison build-essential libssl-dev libyaml-dev libreadline6-dev \ zlib1g-dev libncurses5-dev libffi-dev libgdbm-dev \ @@ -25,4 +25,5 @@ useradd -m -s /bin/bash mastodon passwd -d mastodon # Postgresql su - postgres -c "psql -c 'CREATE USER mastodon CREATEDB;'" +cat /tmp/postgresql.conf >> /etc/postgresql/17/main/postgresql.conf exit 0