-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* dockerfile and configs * docker helper scripts, update readme * add api response examples to readme * Update Dockerfile ensure pre-existing venv is not carried over from the host to the container
- Loading branch information
Showing
7 changed files
with
184 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
FROM python:3.9-slim | ||
|
||
COPY . /archive-verify | ||
WORKDIR /archive-verify | ||
|
||
# install services | ||
RUN \ | ||
apt-get update && \ | ||
apt-get install -y git redis gcc nginx nano && \ | ||
cp docker/nginx.conf /etc/nginx/nginx.conf && \ | ||
rm -rf .venv && \ | ||
python3 -m venv --upgrade-deps .venv && \ | ||
.venv/bin/pip install -e .[test] | ||
|
||
RUN \ | ||
.venv/bin/nosetests tests/ | ||
|
||
# setup test data | ||
RUN \ | ||
mkdir -p data/test_host/runfolders && \ | ||
mkdir -p logs && \ | ||
mkdir -p data/verify/test_1_archive/test_1_archive && \ | ||
mkdir -p data/verify/test_2_archive/test_2_archive && \ | ||
cd data/verify/test_1_archive/test_1_archive && \ | ||
dd if=/dev/urandom of=test_1_data count=4000 bs=1024 && \ | ||
md5sum test_1_data > checksums_prior_to_pdc.md5 && \ | ||
cd ../../test_2_archive/test_2_archive && \ | ||
dd if=/dev/urandom of=test_2_data count=4000 bs=1024 && \ | ||
md5sum test_2_data > checksums_prior_to_pdc.md5 && \ | ||
cd ../../../.. | ||
|
||
EXPOSE 9898 9899 | ||
|
||
CMD [ "docker/start.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#! /bin/bash | ||
|
||
set -o errexit | ||
|
||
# get the container hash from file or error out if it doesn't exist | ||
ID="$(cat docker/id.txt)" | ||
rm -f docker/id.txt | ||
|
||
docker stop \ | ||
"${ID}" | ||
|
||
docker rm \ | ||
"${ID}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#! /bin/bash | ||
|
||
set -o errexit | ||
|
||
# get the container hash from file or error out if it doesn't exist | ||
ID="$(cat docker/id.txt)" | ||
|
||
docker logs \ | ||
-f "${ID}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
events {} | ||
http { | ||
access_log /var/log/nginx/access.log; | ||
server { | ||
listen 9898; | ||
access_log /var/log/nginx/local_access.log; | ||
location / { | ||
proxy_pass http://localhost:8989; | ||
sub_filter_types application/json; | ||
sub_filter 'http://localhost:8989' 'http://$host:$server_port'; | ||
} | ||
} | ||
server { | ||
listen 9899; | ||
access_log /var/log/nginx/miarka_access.log; | ||
location /verify/api/1.0/ { | ||
proxy_pass http://localhost:8989/api/1.0/; | ||
sub_filter_types application/json; | ||
sub_filter 'http://localhost:8989' 'http://$host:$server_port'; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#! /bin/sh | ||
|
||
redis-server & | ||
/archive-verify/.venv/bin/rq worker & | ||
/archive-verify/.venv/bin/archive-verify-ws -c=/archive-verify/config/ & | ||
nginx & | ||
wait |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#! /bin/bash | ||
|
||
set -o errexit | ||
|
||
# build docker container | ||
docker build \ | ||
-t archive-verify:latest \ | ||
-f docker/Dockerfile \ | ||
. | ||
|
||
# start the container and store the container hash | ||
ID="$(docker run \ | ||
-d \ | ||
-p 127.0.0.1:9898:9898 \ | ||
-p 127.0.0.1:9899:9899 \ | ||
archive-verify:latest)" | ||
|
||
# write the container hash to a file | ||
echo "$ID" > docker/id.txt |