From 9a471997286601ea67242de58b5d027f6e8f677d Mon Sep 17 00:00:00 2001 From: youainti Date: Tue, 15 Feb 2022 21:22:45 -0800 Subject: [PATCH] Moved the db_connection to another location, updated gitignore to avoid commiting data. DockerCompose is setting up properly. --- .gitignore | 2 +- PostgressDocker/docker-compose.yaml | 27 ++++++++++++------- .../db_connection.py | 2 +- 3 files changed, 20 insertions(+), 11 deletions(-) rename {PostgressDocker => downloader}/db_connection.py (55%) diff --git a/.gitignore b/.gitignore index 2dfd14c..e934503 100644 --- a/.gitignore +++ b/.gitignore @@ -180,4 +180,4 @@ Manifest.toml ###### Custom ##### -/20220201_clinical_trials.zip +**/host_data/*_clinical_trials/ diff --git a/PostgressDocker/docker-compose.yaml b/PostgressDocker/docker-compose.yaml index 8c62f3a..1ebe243 100644 --- a/PostgressDocker/docker-compose.yaml +++ b/PostgressDocker/docker-compose.yaml @@ -1,5 +1,15 @@ version: '3' +volumes: + aact_pg_database: #This is to hold the database. + aact_helpful_files: #This is to hold files that need accessed by both pgadmin and postgres. I honestly expect it to usually be empty. + driver: local + driver_opts: + type: 'none' + o: 'bind' + device: /home/will/research/ClinicalTrialsDataProcessing/PostgressDocker/host_data/ + #change this path to match the path you are holding the dump file in + services: aact: container_name: aact_db @@ -15,8 +25,11 @@ services: #pull in a single file #- $HOME/research/ClinicalTrialsDataProcessing/PostgressDocker/infile:/infile #add a storage volumes - - aact_pg_database:/var/lib/postgresql/ - - aact_helpful_files:/mnt/host_data #the :ro give read only permisions + - aact_pg_database:/var/lib/postgresql/ # this is the database that persits between uses + - aact_helpful_files:/mnt/host_data #use :ro # to give read only permisions + #entrypoint: + #none yet + #- echo "test" > /test.touched pgadmin: container_name: pgadmin4_webservice @@ -28,13 +41,9 @@ services: ports: - "5050:80" volumes: #host:container is the format. - #add a storage volumes - - aact_helpful_files:/mnt/host_data #addin :ro to the end would give read only permissions - -volumes: - aact_pg_database: #This is to hold the database. - aact_helpful_files: #This is to hold files that need accessed by both pgadmin and postgres. I honestly expect it to usually be empty. + #The volume with server login information. + - ./pgadmin4/servers.json:/pgadmin4/servers.json #Checklist for production # uncomment restart: always in both services. -# add a python environment to run data collection \ No newline at end of file +# add a python environment to run data collection etc \ No newline at end of file diff --git a/PostgressDocker/db_connection.py b/downloader/db_connection.py similarity index 55% rename from PostgressDocker/db_connection.py rename to downloader/db_connection.py index 5f36471..e5df6fc 100644 --- a/PostgressDocker/db_connection.py +++ b/downloader/db_connection.py @@ -1,6 +1,6 @@ import psycopg2 as psyco -conn = psyco.connect(dbname="aact_db", user="access", host="localhost", password="access") +conn = psyco.connect(dbname="aact_db", user="admin", host="localhost", password="root") curse = conn.cursor()