Skip to content

Commit

Permalink
Merge pull request #93 from jbernal0019/master
Browse files Browse the repository at this point in the history
Deploy prod environment using swarm manager commands
  • Loading branch information
jbernal0019 authored Mar 12, 2021
2 parents 8f896e2 + d8a31c9 commit 75526ca
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 41 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
PFCONREPO=fnndsc
PFIOHREPO=fnndsc
PMANREPO=fnndsc
host=fnndsc
TAG=
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: docker build -t fnndsc/pfcon .
- uses: FNNDSC/cube-integration-action@v1
- uses: FNNDSC/cube-integration-action@v4

build:
needs: [test-pfcon, test-cube]
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
##############
pfcon v3.0.0.0
##############
############
pfcon v3.0.0
############

.. image:: https://github.com/fnndsc/pfcon/workflows/CI/badge.svg
:target: https://github.com/fnndsc/pfcon/actions
Expand Down
30 changes: 18 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,34 @@ version: '3.7'

services:
pfcon_service:
image: ${PFCONREPO}/pfcon
image: fnndsc/pfcon
env_file:
- ./secrets/.pfcon_service.env
ports:
- "5005:5005"
depends_on:
- pman_service
- pfioh_service
restart: on-failure
deploy:
restart_policy:
condition: on-failure
networks:
- remote
labels:
name: "pfcon"
role: "pfcon service"

pfioh_service:
# We need to map a physical dir in the HOST to the key store in pfioh.
# The keystore is specified by the --storeBase flag.
image: ${PFIOHREPO}/pfioh
# We need to mount a physical dir in the HOST onto the key store in pfioh. This dir
# is given by the STOREBASE env variable. The keystore is specified by the
# --storeBase flag.
image: fnndsc/pfioh
command: ["--forever", "--httpResponse", "--createDirsAsNeeded", "--storeBase", "/hostFS/storeBase", "--verbosity", "1"]
volumes:
- ${STOREBASE}:/hostFS/storeBase
restart: on-failure
- ${STOREBASE:?}:/hostFS/storeBase
deploy:
restart_policy:
condition: on-failure
networks:
remote:
aliases:
Expand All @@ -45,17 +50,18 @@ services:

pman_service:
# Since pman spins off containers of its own it needs to mount storeBase dir (where
# pfioh shares the data) into the spawned container. However, it can't mount a dir
# inside itself to the spawned container, it has to mount an actual existing
# directory in the host. This directory is passed in the STOREBASE env variable.
# pfioh shares the data) into the spawned container. This directory is passed in the
# STOREBASE env variable.
environment:
- STOREBASE
image: ${PMANREPO}/pman
image: fnndsc/pman
env_file:
- ./secrets/.pman_service.env
volumes:
- /var/run/docker.sock:/var/run/docker.sock
restart: on-failure
deploy:
restart_policy:
condition: on-failure
networks:
remote:
aliases:
Expand Down
9 changes: 4 additions & 5 deletions docker-compose_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ services:
command: ["--ip", "0.0.0.0", "--verbosity", "1"]

pfioh_service:
# The following is a bit complicated... Basically we need to map a physical dir
# in the HOST to the key store in pfioh. The keystore is specified by the
# We need to mount a physical dir in the HOST onto the key store in pfioh. This dir
# is given by the STOREBASE env variable. The keystore is specified by the
# --storeBase flag.
image: ${PFIOHREPO}/pfioh${TAG}
command: ["--forever", "--ip", "0.0.0.0", "--port", "5055", "--httpResponse", "--createDirsAsNeeded", "--storeBase", "/hostFS/storeBase", "--verbosity", "1"]
Expand All @@ -50,9 +50,8 @@ services:

pman_service:
# Since pman spins off containers of its own it needs to mount storeBase dir (where
# pfioh shares the data) into the spawned container. However, it can't mount a dir
# inside itself to the spawned container, it has to mount an actual existing
# directory in the host. This directory is passed in the STOREBASE env variable.
# pfioh shares the data) into the spawned container. This directory is passed in the
# STOREBASE env variable.
environment:
- STOREBASE
- SECRET_KEY="w1kxu^l=@pnsf!5piqz6!!5kdcdpo79y6jebbp+2244yjm*#+k"
Expand Down
10 changes: 5 additions & 5 deletions docker-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ if [[ "$1" == 'up' ]]; then
export STOREBASE=$(pwd)/FS/remote
windowBottom

title -d 1 "Starting containerized production environment using " " ./docker-compose.yml"
title -d 1 "Starting pfcon_stack production deployment on swarm using " " ./docker-compose.yml"
declare -a A_CONTAINER=(
"fnndsc/pfcon"
"fnndsc/pfioh"
Expand All @@ -60,17 +60,17 @@ if [[ "$1" == 'up' ]]; then
echo $CMD | sh
echo $sep
done
echo "docker-compose up -d"
docker-compose up -d
echo "docker stack deploy -c docker-compose.yml pfcon_stack"
docker stack deploy -c docker-compose.yml pfcon_stack
windowBottom
fi

if [[ "$1" == 'down' ]]; then

export STOREBASE=${STOREBASE}

title -d 1 "Destroying containerized production environment" "from ./docker-compose.yml"
docker-compose --no-ansi down >& dc.out >/dev/null
title -d 1 "Destroying pfcon_stack production deployment on swarm" "from ./docker-compose.yml"
docker stack rm pfcon_stack >& dc.out >/dev/null
cat dc.out | ./boxes.sh
echo "Removing ./FS tree" | ./boxes.sh
rm -fr ./FS
Expand Down
13 changes: 0 additions & 13 deletions make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -310,19 +310,6 @@ else
windowBottom
fi

if (( ! b_skipUnitTests && ! b_pause )) ; then
title -d 1 "Automatic restart of pfioh" \
"to clear any lingering traces of integration tests..."
echo "" | ./boxes.sh
windowBottom

windowBottom
docker-compose --no-ansi -f docker-compose_dev.yml \
restart pfioh_service >& dc.out > /dev/null
echo -en "\033[2A\033[2K"
cat dc.out | ./boxes.sh
fi

title -d 1 "Pause for manual restart of services?"
if (( b_pause )) ; then
echo "Pausing... hit *ANY* key to continue" | ./boxes.sh
Expand Down
2 changes: 1 addition & 1 deletion pfcon/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Config:
STATIC_FOLDER = 'static'
DEBUG = False
TESTING = False
SERVER_VERSION = "3.0.0.0"
SERVER_VERSION = "3.0.0"


class DevConfig(Config):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name = 'pfcon',
version = '3.0.0.0',
version = '3.0.0',
description = '(Python) Process and File Controller',
long_description = readme,
author = 'FNNDSC Developers',
Expand Down

0 comments on commit 75526ca

Please sign in to comment.