Files
tasks/docs/development/macos/postgresql.md
T
Michael SnowdenandGitHub c504991e6d Reorganize docs (#5535)
## What changed?
<!-- Describe what has changed in this PR -->
I reorganized our docs into `docs/{admin,architecture,development}`.

## Why?
<!-- Tell your future self why have you made these changes -->
We discussed this internally, but I believe this is a better
segmentation for the different audiences looking at our docs. I plan on
adding more stuff to docs/admin like metrics and dynamic config docs.

## How did you test it?
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->
I'm mainly looking for broken links.
- I went through each markdown file in docs manually. 
- I looked through all inspection errors in the IDE.
- I looked at all references to "docs/" or "develop/" in our code.

## Potential risks
<!-- Assuming the worst case, what can be broken when deploying this
change to production? -->

## Documentation
<!-- Have you made sure this change doesn't falsify anything currently
stated in `docs/`? If significant
new behavior is added, have you described that in `docs/`? -->

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->
2024-03-18 23:13:02 -07:00

2.2 KiB

Run PostgreSQL v9.6 on macOS

Install

brew install [email protected]

Start

brew services start [email protected]

Stop

brew services stop [email protected]

Post Installation

Create a user postgres

createuser -s root

Verify PostgreSQL v9.6 is running and accessible:

psql -h 127.0.0.1 -p 5432 -U root -d postgres

Within psql shell, add a password:

ALTER USER root WITH PASSWORD 'root';
ALTER USER root WITH SUPERUSER;
CREATE USER temporal WITH PASSWORD 'temporal';
ALTER USER temporal WITH SUPERUSER;

Change the following file context:

emacs /usr/local/var/[email protected]/pg_hba.conf

from

local   all             all                                     trust
host    all             all             127.0.0.1/32            trust
host    all             all             ::1/128                 trust

to

local   all             all                                     md5
host    all             all             127.0.0.1/32            md5
host    all             all             ::1/128                 md5

then restart PostgreSQL:

brew services restart [email protected]

Verify password:

psql -h 127.0.0.1 -p 5432 -U root -d postgres
psql -h 127.0.0.1 -p 5432 -U temporal -d postgres

TLS

TLS Key / Cert Setup Guide

emacs /usr/local/var/[email protected]/postgresql.conf

setting the variables below to

ssl=on
ssl_cert_file=<path to the server-cert.pem>
ssl_key_file=<path to the server-key.pem>
ssl_ca_file=<path to the ca.pem>
emacs /usr/local/var/[email protected]/pg_hba.conf

changes the configs like below

hostssl    all             all             127.0.0.1/32            md5 clientcert=1                                                     
hostssl    all             all             ::1/128                 md5 clientcert=1

then restart PostgreSQL:

brew services restart [email protected]

Verify TLS & password:

psql "sslmode=require host=localhost dbname=postgres user=root \
  sslkey=<path to the client-key.pem> \
  sslcert=<path to the client-cert.pem> \
  sslrootcert=<path to the ca.pem>"