This repository was archived by the owner on Apr 29, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +59
-10
lines changed
Expand file tree Collapse file tree 5 files changed +59
-10
lines changed Original file line number Diff line number Diff line change 1010
1111jobs :
1212 build :
13+ strategy :
14+ fail-fast : false
15+ matrix :
16+ runner : [ X64, arm-runner ]
1317 name : " update: build and deploy postgres server images"
14- runs-on : ubuntu-latest
18+ runs-on : [ self-hosted, ${{ matrix.runner }} ]
1519 permissions :
1620 contents : read
1721 packages : write
1822 steps :
1923 - uses : actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
2024 with :
2125 fetch-depth : 0
22- - uses : DeterminateSystems/nix-installer-action@65d7c888b2778e8cf30a07a88422ccb23499bfb8
23- - uses : DeterminateSystems/magic-nix-cache-action@749fc5bbc9fa49d60c2b93f6c4bc867b82e1d295
2426 - uses : actions/checkout@v3
2527
2628 - name : Build images
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # shellcheck shell=bash
3+
4+ sudo -u postgres /bin/initdb --locale=C -D /data
5+ sudo -u postgres ln -s /etc/postgresql.conf /data/postgresql.conf
6+ sudo -u postgres /bin/postgres -p 5432 -D /data
Original file line number Diff line number Diff line change 1+ Docker images are pushed to ` ghcr.io ` on every commit. Try the following:
2+
3+ ```
4+ docker run --rm -it ghcr.io/supabase/nix-postgres-15:latest
5+ ```
6+
7+ Every Docker image that is built on every push is given a tag that exactly
8+ corresponds to a Git commit in the repository &mdash ; for example commit
9+ [ d3e0c39d34e1bb4d37e058175a7bc376620f6868] ( https://github.com/supabase/nix-postgres/commit/d3e0c39d34e1bb4d37e058175a7bc376620f6868 )
10+ in this repository has a tag in the container registry which can be used to pull
11+ exactly that version.
12+
13+ This just starts the server. Client container images are not provided; you can
14+ use ` nix run ` for that, as outlined [ here] ( ./start-client-server.md ) .
Original file line number Diff line number Diff line change 173173
174174 # Make a Docker Image from a given PostgreSQL version and binary package.
175175 makePostgresDocker = version : binPackage :
176- pkgs . dockerTools . buildLayeredImage {
176+ let
177+ initScript = pkgs . runCommand "docker-init.sh" { } ''
178+ mkdir -p $out/bin
179+ cp ${ ./docker/init.sh } $out/bin/init.sh
180+ chmod +x $out/bin/init.sh
181+ '' ;
182+
183+ postgresqlConfig = pkgs . runCommand "postgresql.conf" { } ''
184+ mkdir -p $out/etc/
185+ substitute ${ ./tests/postgresql.conf.in } $out/etc/postgresql.conf \
186+ --subst-var-by PGSODIUM_GETKEY_SCRIPT "${ ./tests/util/pgsodium_getkey.sh } "
187+ '' ;
188+
189+ in pkgs . dockerTools . buildImage {
177190 name = "postgresql-${ version } " ;
178191 tag = "latest" ;
179- contents = with pkgs ; [ coreutils bash binPackage ] ;
192+
193+ runAsRoot = ''
194+ #!${ pkgs . runtimeShell }
195+ ${ pkgs . dockerTools . shadowSetup }
196+ groupadd -r postgres
197+ useradd -r -g postgres postgres
198+ mkdir -p /data /run/postgresql
199+ chown postgres:postgres /data /run/postgresql
200+ '' ;
201+
202+ copyToRoot = pkgs . buildEnv {
203+ name = "image-root" ;
204+ paths = with pkgs ; [
205+ initScript coreutils bash binPackage
206+ dockerTools . binSh sudo postgresqlConfig
207+ ] ;
208+ pathsToLink = [ "/bin" "/etc" "/var" "/share" ] ;
209+ } ;
180210
181211 config = {
182- Cmd = [ "/bin/postgres " ] ;
212+ Cmd = [ "/bin/init.sh " ] ;
183213 ExposedPorts = { "5432/tcp" = { } ; } ;
184214 WorkingDir = "/data" ;
185215 Volumes = { "/data" = { } ; } ;
Original file line number Diff line number Diff line change 5757
5858# - Connection Settings -
5959
60- #listen_addresses = 'localhost' # what IP address(es) to listen on;
61- # comma-separated list of addresses;
62- # defaults to 'localhost'; use '*' for all
63- # (change requires restart)
60+ listen_addresses = '*' # what IP address(es) to listen on;
6461#port = 5432 # (change requires restart)
6562max_connections = 100 # (change requires restart)
6663#superuser_reserved_connections = 3 # (change requires restart)
You can’t perform that action at this time.
0 commit comments