Cleanup All Data But Users

Cleanup all data except users in ReSeeD

Stop the container and delete all volumes, except rdms_db

Stop the containers

hd stop
hd down

Delete all of the docker volumes except rdms_db

docker volume rm rdms_app rdms_cache rdms_db-fcrepo rdms_derivatives rdms_fcrepo rdms_file_uploads rdms_matomo rdms_matomo_logs rdms_mysql-db rdms_redis rdms_solr

rdms_db-fcrepo rdms_fcrepo rdms_matomo rdms_matomo_logs rdms_mysql-db rdms_redis rdms_solr Error response from daemon: remove rdms_app: volume is in use - [322684a1f6077dd2cf3a1fdd8c68ccce0dcc80169fcd97e2af9eafdff21333bf] Error response from daemon: remove rdms_cache: volume is in use - [322684a1f6077dd2cf3a1fdd8c68ccce0dcc80169fcd97e2af9eafdff21333bf] Error response from daemon: remove rdms_derivatives: volume is in use - [322684a1f6077dd2cf3a1fdd8c68ccce0dcc80169fcd97e2af9eafdff21333bf] Error response from daemon: remove rdms_file_uploads: volume is in use - [322684a1f6077dd2cf3a1fdd8c68ccce0dcc80169fcd97e2af9eafdff21333bf]

The processes were not running in docker, but I still got errors. So I had to stop the docker process, remove the other volumes, and start it again

sudo systemctl stop docker
sudo rm -rf /var/lib/docker/volumes/rdms_app
sudo rm -rf /var/lib/docker/volumes/rdms_cache
sudo rm -rf /var/lib/docker/volumes/rdms_derivatives
sudo rm -rf /var/lib/docker/volumes/rdms_file_uploads
sudo systemctl start docker

Clean up the data in the rdms_db and remove contents deleted from Fedora

Start the docker containers

hd up -d

Get list of containers

docker ps
NAME                COMMAND                  SERVICE             STATUS              PORTS
rdms-app-1          "irb"                    app                 exited (0)          
rdms-appdb-1        "docker-entrypoint.s…"   appdb               running (healthy)   5432/tcp
rdms-db-1           "docker-entrypoint.s…"   db                  running             5432/tcp
rdms-fcrepo-1       "catalina.sh run"        fcrepo              running             0.0.0.0:8080->8080/tcp, :::8080->8080/tcp
rdms-fcrepodb-1     "docker-entrypoint.s…"   fcrepodb            running (healthy)   5432/tcp
rdms-matomo_app-1   "/entrypoint.sh php-…"   matomo_app          running             0.0.0.0:9000->9000/tcp, :::9000->9000/tcp
rdms-matomo_db-1    "docker-entrypoint.s…"   matomo_db           running             3306/tcp
rdms-redis-1        "docker-entrypoint.s…"   redis               running (healthy)   0.0.0.0:6379->6379/tcp, :::6379->6379/tcp
rdms-solr-1         "docker-entrypoint.s…"   solr                running (healthy)   0.0.0.0:8983->8983/tcp, :::8983->8983/tcp
rdms-web-1          "bash -c /bin/docker…"   web                 running             0.0.0.0:3000->3000/tcp, :::3000->3000/tcp
rdms-workers-1      "bash -c 'bundle ins…"   workers             running

Connect to the database in the appdb container. In my case it is named rdms-appdb-1

docker exec -it rdms-appdb-1 /bin/bash 
bash-5.1# psql -h localhost -p 5432 -U postgres -d postgres 

Get list of databases

\l 
                                 List of databases
       Name       |  Owner   | Encoding | Collate |  Ctype  |   Access privileges   
------------------+----------+----------+---------+---------+-----------------------
 hyrax_production | postgres | UTF8     | C       | C.UTF-8 | 
 postgres         | postgres | UTF8     | C       | C.UTF-8 | 
 template0        | postgres | UTF8     | C       | C.UTF-8 | =c/postgres          +
                  |          |          |         |         | postgres=CTc/postgres
 template1        | postgres | UTF8     | C       | C.UTF-8 | =c/postgres          +
                  |          |          |         |         | postgres=CTc/postgres
(4 rows)

Connect to the hyrax_production database

\c hyrax_production 

You are now connected to database "hyrax_production" as user "postgres".

List all of the tables

\dt 

Delete the contents of tables

Exit the database

hyrax_production=# exit

Exit from the container

exit

Restart the containers

hd restart