mirror of
https://github.com/jbranchaud/til
synced 2026-01-02 22:58:01 +00:00
Add Set Up A Project-Local Cluster With Postgres.app as a Postgres TIL
This commit is contained in:
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
|
||||
|
||||
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
||||
|
||||
_1675 TILs and counting..._
|
||||
_1676 TILs and counting..._
|
||||
|
||||
See some of the other learning resources I work on:
|
||||
|
||||
@@ -942,6 +942,7 @@ If you've learned something here, support my efforts writing daily TILs by
|
||||
- [Set Inclusion With hstore](postgres/set-inclusion-with-hstore.md)
|
||||
- [Set A Seed For The Random Number Generator](postgres/set-a-seed-for-the-random-number-generator.md)
|
||||
- [Set A Statement Timeout Threshold For A Session](postgres/set-a-statement-timeout-threshold-for-a-session.md)
|
||||
- [Set Up A Project-Local Cluster With Postgres.app](postgres/set-up-a-project-local-cluster-with-postgres-app.md)
|
||||
- [Sets With The Values Command](postgres/sets-with-the-values-command.md)
|
||||
- [Shorthand Absolute Value Operator](postgres/shorthand-absolute-value-operator.md)
|
||||
- [Show All Versions Of An Operator](postgres/show-all-versions-of-an-operator.md)
|
||||
|
||||
35
postgres/set-up-a-project-local-cluster-with-postgres-app.md
Normal file
35
postgres/set-up-a-project-local-cluster-with-postgres-app.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# Set Up A Project-Local Cluster With Postgres.app
|
||||
|
||||
I want to set up a PostgreSQL cluster in my project directory. This helps
|
||||
provide some separation and clarity that this cluster and its databases are just
|
||||
for this project.
|
||||
|
||||
This can be done with `Postgres.app` (on Mac) hitting the `+` button in the
|
||||
bottom left corner of the app. This will pop open a "Create new server" modal.
|
||||
|
||||
From there, you'll want to give the server a name that you can identify within
|
||||
`Postgres.app`. E.g. "<App Name> Cluster"
|
||||
|
||||
Then select the Postgres version. My existing project is still on 17, so I'll
|
||||
select that.
|
||||
|
||||
The not so intuitive part is the _Data Directory_. Use the "Choose..." file
|
||||
picker to find the root directory of your project. Select that. Then click into
|
||||
the text input for the data directory and append the name of the data directory
|
||||
_to be created_ to that path. If I want it to all go in `postgres-data`, then my
|
||||
path will look like:
|
||||
|
||||
```
|
||||
/Users/me/dev/my-app/postgres-data
|
||||
```
|
||||
|
||||
The `postgres-data` directory doesn't exist yet. But it will in a moment.
|
||||
|
||||
You probably want the default port, so leave that at `5432` unless you know
|
||||
otherwise.
|
||||
|
||||
Click `Create server`, though that won't actually create the server yet. Now
|
||||
with that server selected in `Postgres.app` click the `Initialize` button. That
|
||||
will create the `postgres-data` directory and then run `initdb` under the hood
|
||||
which will add everything your server needs. It will now be running at that
|
||||
port, ready to connect.
|
||||
Reference in New Issue
Block a user