Added a justfile, adjusted docker networks, restructured how data is downloaded
parent
a2c0e4dcc7
commit
e240fff07c
@ -0,0 +1,65 @@
|
||||
#justfile, used for automating build/setup
|
||||
# TODO
|
||||
# - setup a .env file so things can be shared between just and docker
|
||||
# - move network name to .env
|
||||
# - move postgress login credentials (allow them to be printed from just while setting up)
|
||||
|
||||
|
||||
data_link := "https://ctti-aact.nyc3.digitaloceanspaces.com/27grtsnhtccplxapj2o8ak9aotvv"
|
||||
data_file := "postgres_data.dmp"
|
||||
|
||||
#must match the 'container name: aact_db' in the docker-compose.yaml
|
||||
docker_container := `docker container ls -a | grep aact_db | cut -f 1 -d " " | tr "\n" " "`
|
||||
|
||||
#check for necessary dependencies
|
||||
check-status:
|
||||
docker --version
|
||||
python --version
|
||||
curl --version
|
||||
echo "current docker containers:{{docker_container}}"
|
||||
#Setup the AACT container
|
||||
setup-containers:
|
||||
@echo "Check for downloaded data"
|
||||
[ -f ./AACT_downloader/aact_downloads/{{data_file}} ]
|
||||
@echo "Setting up AACT container"
|
||||
#check appropriate files and directories are setup
|
||||
|
||||
#run docker compose
|
||||
|
||||
#Stop the appropriate docker container
|
||||
stop-containers:
|
||||
#stop all docker containers if they are currently running.
|
||||
#The if statement is used because sometimes there are no running containers
|
||||
if [ "{{docker_container}}" ]; then docker stop {{docker_container}}; fi
|
||||
@echo "confirmed that docker containers {{docker_container}} are stopped"
|
||||
|
||||
#Remove the appropriate docker container as well as associated volumes
|
||||
clean-docker: stop-containers
|
||||
# remove docker containers
|
||||
if [ "{{docker_container}}" ]; then docker rm {{docker_container}}; fi
|
||||
# cleanup docker network
|
||||
docker network prune
|
||||
# cleanup docker volumes
|
||||
docker volume prune
|
||||
|
||||
#sets up the docker network
|
||||
setup-docker-network:
|
||||
docker network create pharmaceutical_research
|
||||
|
||||
#Download the AACT data
|
||||
download-aact-data:
|
||||
curl {{data_link}} > ./AACT_downloader/aact_downloads/ {{data_file}}
|
||||
|
||||
#Download and parse historical clinical trials data
|
||||
download-parse-historical-ct:
|
||||
echo "not implemented"
|
||||
|
||||
#Build everything from scratch
|
||||
build-from-scratch: check-status download-aact-data setup-containers download-parse-historical-ct
|
||||
echo "system will be built from scratch, including downloading data"
|
||||
|
||||
#build based on previously downloaded data
|
||||
build-from-download: check-status setup-containers download-parse-historical-ct
|
||||
echo "system will be built from downloading data"
|
||||
|
||||
|
||||
Loading…
Reference in New Issue