Remove postgres and references to it

This commit is contained in:
Michael Hohn
2024-06-16 19:43:29 -07:00
committed by =Michael Hohn
parent b756668e70
commit 6229c08900
8 changed files with 29 additions and 418 deletions

View File

@@ -72,93 +72,8 @@ These are simple steps using a single container.
5. check containers from server container
docker exec -it server bash
curl -I postgres:5432
curl -I http://rabbitmq:15672
### Some postgres specific commands
1. Access PostgreSQL
psql -h localhost -p 5432 -U exampleuser -d exampledb
1. List all tables
\dt
1. Examine a table
select * from db_infos
1. Show all columns in a specific table
\d+ db_infos
1. Miscellany
\pset pager off
\lo_import FILE [COMMENT]
### Manually create needed postgres databases
docker-compose now runs a db init script, but this information is useful for
debugging/manual work.
~~This is still necessary after `docker-compose up` to avoid~~
[error] failed to initialize database, got error failed to connect to
`user=exampleuser database=server_db`: 172.25.0.3:5432 (postgres): server
error: FATAL: database "server_db" does not exist (SQLSTATE 3D000)
from
./server -loglevel=debug -mode=container
The steps:
# on the host
psql -h localhost -p 5432 -U exampleuser -d postgres
# Conditionally create dbs
SELECT 'CREATE DATABASE server_db' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'server_db')\gexec
SELECT 'CREATE DATABASE querypack_db' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'querypack_db')\gexec
SELECT 'CREATE DATABASE qldb_db' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'qldb_db')\gexec
# List all dbs
\l
### To run pgmin, the minimal go/postgres test part of this repository
1. Run pgmin
```sh
cd ~/work-gh/mrva/mrvacommander/cmd/postgres
GOOS=linux GOARCH=arm64 go build
docker exec -it server bash
/mrva/mrvacommander/cmd/postgres/postgres
```
Exit the container. Back on the host:
psql -h localhost -p 5432 -U exampleuser -d exampledb
\dt
Should show
List of relations
Schema | Name | Type | Owner
--------+-------------+-------+-------------
public | owner_repos | table | exampleuser
1. Check table contents
exampledb=# select * from owner_repos;
owner | repo
-------+---------
foo | foo/bar
### Use the minio ql database db
1. Web access via