Skip to content

Commit

Permalink
Fix docker build, add smoketests (#1815)
Browse files Browse the repository at this point in the history
* Replace setup.py install with a wheel build and install.

* Test containers in circleci

* Add healthchecks to the server containers
  • Loading branch information
vEpiphyte committed Jul 22, 2020
1 parent b4ea5a6 commit 503fcb9
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 1 deletion.
56 changes: 56 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,32 @@ commands:
. venv/bin/activate
twine upload dist/*
check_docker_smoketests:
description: "Check docker smoke test results"
steps:
- run:
name: validate docker smoketest
command: |
sleep 60
docker ps
docker container ls -a
docker logs test01
docker logs test02
docker logs test03
dstatus01=`docker inspect test01 --format '{{.State.Health.Status}}'`
dstatus02=`docker inspect test02 --format '{{.State.Health.Status}}'`
dstatus03=`docker inspect test03 --format '{{.State.Health.Status}}'`
docker stop test01
docker stop test02
docker stop test03
docker rm test01
docker rm test02
docker rm test03
if [ $dstatus01 != "healthy" ]; then exit 1; fi
if [ $dstatus02 != "healthy" ]; then exit 1; fi
if [ $dstatus03 != "healthy" ]; then exit 1; fi
exit 0
do_docker_login:
description: "Login to docker"
steps:
Expand All @@ -276,6 +302,16 @@ commands:
docker build -t vertexproject/synapse-axon:${CIRCLE_TAG} -f docker/images/axon/Dockerfile .
docker build -t vertexproject/synapse-cortex:${CIRCLE_TAG} -f docker/images/cortex/Dockerfile .
docker build -t vertexproject/synapse-cryotank:${CIRCLE_TAG} -f docker/images/cryotank/Dockerfile .
- run:
name: smoke test image
command: |
docker run --rm -it --entrypoint python vertexproject/synapse:${CIRCLE_TAG} -m synapse.servers.cortex --help
dstatus00=$?
if [ $dstatus00 != "0" ]; then exit 1; fi
docker run -d --name test01 vertexproject/synapse-axon:${CIRCLE_TAG}
docker run -d --name test02 vertexproject/synapse-cortex:${CIRCLE_TAG}
docker run -d --name test03 vertexproject/synapse-cryotank:${CIRCLE_TAG}
- check_docker_smoketests
- run:
name: tag and push container
command: |
Expand All @@ -297,6 +333,16 @@ commands:
docker build -t vertexproject/synapse-axon:v2.x.x -f docker/images/axon/Dockerfile .
docker build -t vertexproject/synapse-cortex:v2.x.x -f docker/images/cortex/Dockerfile .
docker build -t vertexproject/synapse-cryotank:v2.x.x -f docker/images/cryotank/Dockerfile .
- run:
name: smoke test image
command: |
docker run --rm -it --entrypoint python vertexproject/synapse:v2.x.x -m synapse.servers.cortex --help
dstatus00=$?
if [ $dstatus00 != "0" ]; then exit 1; fi
docker run -d --name test01 vertexproject/synapse-axon:v2.x.x
docker run -d --name test02 vertexproject/synapse-cortex:v2.x.x
docker run -d --name test03 vertexproject/synapse-cryotank:v2.x.x
- check_docker_smoketests
- run:
name: tag and push container
command: |
Expand All @@ -318,6 +364,16 @@ commands:
docker build -t vertexproject/synapse-axon:${CIRCLE_BRANCH} -f docker/images/axon/Dockerfile .
docker build -t vertexproject/synapse-cortex:${CIRCLE_BRANCH} -f docker/images/cortex/Dockerfile .
docker build -t vertexproject/synapse-cryotank:${CIRCLE_BRANCH} -f docker/images/cryotank/Dockerfile .
- run:
name: smoke test image
command: |
docker run --rm -it --entrypoint python vertexproject/synapse:${CIRCLE_BRANCH} -m synapse.servers.cortex --help
dstatus00=$?
if [ $dstatus00 != "0" ]; then exit 1; fi
docker run -d --name test01 vertexproject/synapse-axon:${CIRCLE_BRANCH}
docker run -d --name test02 vertexproject/synapse-cortex:${CIRCLE_BRANCH}
docker run -d --name test03 vertexproject/synapse-cryotank:${CIRCLE_BRANCH}
- check_docker_smoketests
- run:
name: tag and push container
command: |
Expand Down
7 changes: 6 additions & 1 deletion docker/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/bash

cd /build/synapse && python setup.py install
if [ -d /build/synapse ]; then
cd /build/synapse
python setup.py build bdist_wheel
cd dist
python -m pip install *.whl
fi

rm -rf /build
2 changes: 2 additions & 0 deletions docker/images/axon/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ EXPOSE 27492
VOLUME /vertex/storage

ENTRYPOINT /vertex/synapse/entrypoint.sh

HEALTHCHECK --start-period=10s --retries=1 --timeout=10s --interval=30s CMD python -m synapse.tools.healthcheck -c cell:///vertex/storage/
2 changes: 2 additions & 0 deletions docker/images/cortex/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ EXPOSE 27492
VOLUME /vertex/storage

ENTRYPOINT /vertex/synapse/entrypoint.sh

HEALTHCHECK --start-period=10s --retries=1 --timeout=10s --interval=30s CMD python -m synapse.tools.healthcheck -c cell:///vertex/storage/
2 changes: 2 additions & 0 deletions docker/images/cryotank/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ EXPOSE 27492
VOLUME /vertex/storage

ENTRYPOINT /vertex/synapse/entrypoint.sh

HEALTHCHECK --start-period=10s --retries=1 --timeout=10s --interval=30s CMD python -m synapse.tools.healthcheck -c cell:///vertex/storage/

0 comments on commit 503fcb9

Please sign in to comment.