From 42e71e6493116682482a8a6554586bba8faaab50 Mon Sep 17 00:00:00 2001 From: Joshua Potter Date: Fri, 1 Dec 2023 10:06:17 -0700 Subject: [PATCH] Encourage the use ob abstract sockets. --- specs/phoenix/template/README.md | 16 +++++++++------- specs/postgres/template/README.md | 14 ++++++++------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/specs/phoenix/template/README.md b/specs/phoenix/template/README.md index 55a91c3..d240921 100644 --- a/specs/phoenix/template/README.md +++ b/specs/phoenix/template/README.md @@ -10,18 +10,20 @@ $> nix develop ## Quickstart -An empty Postgres cluster is initialized at `/data`. To start the database, run +An empty Postgres cluster is initialized at `/db`. To start the database, run the following: ```bash -$> pg_ctl start -o --unix_socket_directories="$PWD/data" +$> pg_ctl -D db -l db/logfile -o --unix_socket_directories=@phoenix start ``` -To shut the database down, run: +In the above command, `@phoenix` refers to an [abstract socket name](https://www.postgresql.org/docs/15/runtime-config-connection.html#GUC-UNIX-SOCKET-DIRECTORIES). +Rename to whatever is appropriate for your use case. To then connect to this +database instance, run: ```bash -$> pg_ctl stop +$> psql -h @phoenix ``` -You can connect to this database from the project root directory by running: +To later shut the database down, run: ```bash -$> psql -h "$PWD/data" -d postgres +$> pg_ctl -D db stop ``` Afterward, you can run the Phoenix setup commands: @@ -39,7 +41,7 @@ $> mix phx.server This project pins Mix dependencies using [mix2nix](https://github.com/ydlr/mix2nix). After updating your `mix.lock` file, make sure to re-run the following: ```bash -mix2nix > deps.nix +$> mix2nix > deps.nix ``` As of now, `mix2nix` cannot handle git dependencies found inside the `mix.lock` file. If you have git dependencies, add them manually or use diff --git a/specs/postgres/template/README.md b/specs/postgres/template/README.md index 87568d6..cb46b5e 100644 --- a/specs/postgres/template/README.md +++ b/specs/postgres/template/README.md @@ -10,16 +10,18 @@ $> nix develop ## Quickstart -An empty Postgres cluster is initialized at `/data`. To start the database, run +An empty Postgres cluster is initialized at `/db`. To start the database, run the following: ```bash -$> pg_ctl start -o --unix_socket_directories="$PWD/data" +$> pg_ctl -D db -l db/logfile -o --unix_socket_directories=@postgres start ``` -To shut the database down, run: +In the above command, `@postgres` refers to an [abstract socket name](https://www.postgresql.org/docs/15/runtime-config-connection.html#GUC-UNIX-SOCKET-DIRECTORIES). +Rename to whatever is appropriate for your use case. To then connect to this +database instance, run: ```bash -$> pg_ctl stop +$> psql -h @postgres ``` -You can connect to this database from the project root directory by running: +To later shut the database down, run: ```bash -$> psql -h "$PWD/data" -d postgres +$> pg_ctl -D db stop ```