set pgpassword as environment var

This commit is contained in:
Ed Chalstrey 2022-02-17 11:10:00 +00:00
parent cb08e9b2ad
commit a89401eefe

View File

@ -105,13 +105,19 @@ password `<pgpassword>` is arbitrary and probably should not be your Ubuntu logi
sudo -u postgres psql -c "SELECT 1 FROM pg_user WHERE usename = '<username>';" | grep -q 1 || sudo -u postgres psql -c "CREATE ROLE <username> SUPERUSER LOGIN PASSWORD '<pgpassword>';"
```
Set the `<pgpassword>` as an environment variable.
```
export PGPASSWORD=<pgpassword>
```
Create a colouring london database if none exists. The name (`<colouringlondondb>`) is arbitrary.
```
sudo -u postgres psql -c "SELECT 1 FROM pg_database WHERE datname = '<colouringlondondb>';" | grep -q 1 || sudo -u postgres createdb -E UTF8 -T template0 --locale=en_US.utf8 -O <username> <colouringlondondb>
```
Run `psql` interactively (you will be prompted to enter the `<pgpassword>`).
Run `psql` interactively.
```
psql -d <colouringlondondb> -U <username> -h localhost
@ -132,8 +138,6 @@ do this are located in the `migrations` folder of your local repository.
`ls ./colouring-london/migrations/*.up.sql 2>/dev/null | while read -r migration; do psql -d <colouringlondondb> -U <username> -h localhost < $migration; done;`
(you will be prompted to enter the `<pgpassword>`)
## Setting up Node
Now upgrade the npm package manager to the most recent release with global privileges. This