personam-solis / data-training

Containers and configurations to learn
1 stars 0 forks source link

PostgreSQL #1

Closed personam-solis closed 7 months ago

personam-solis commented 7 months ago

Make a container with editable config files to learn how to perform administrative actions. This should use a training/data database that can be called at runtime

personam-solis commented 7 months ago

Direct Download: wget https://dataverse.harvard.edu/api/access/datafile/:persistentId?persistentId=doi:10.7910/DVN/2QYZBT/TGYUNU

personam-solis commented 7 months ago

database/server config recommendation IMDB PG Data

personam-solis commented 7 months ago

successfully import the database manually:

docker run  -d \
    -p 5500:5432  \
    -e POSTGRES_PASSWORD=postgres \
    -e POSTGRES_USER=postgres \
    --mount type=volume,source=imdb_test,target=/var/lib/postgresql/data \
    --mount type=bind,source=$(pwd)/Documents/tmp,target=/tmp\
    --name imdb-test \
    postgres:16

docker container exec -it imdb-test bash

psql -U postgres -W -d postgres -p 5432

CREATE ROLE imdb INHERIT;
GRANT imdb TO postgres;
DROP DATABASE IF EXISTS imdbdata;
CREATE DATABASE imdbdata OWNER postgres;
\q

pg_restore -v \
    --username "postgres" \
    --dbname "imdbdata" \
    /tmp/imdb_dump
personam-solis commented 7 months ago

download:

cd /home/solis/Documents/tmp
wget  -v --show-progress --no-check-certificate -O imdb_dump \
    https://dataverse.harvard.edu/api/access/datafile/:persistentId?persistentId=doi:10.7910/DVN/2QYZBT/TGYUNU