Skip to content

Commit

Permalink
Merge pull request #143 from bird-house/magpie-gunicorn-bind
Browse files Browse the repository at this point in the history
magpie 3.x + gunicorn bind
  • Loading branch information
fmigneault authored May 19, 2021
2 parents e787ffd + 987903c commit 93c1ef3
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 13 deletions.
7 changes: 4 additions & 3 deletions birdhouse/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,14 @@ For that test suite to pass, run the script
`scripts/bootstrap-instance-for-testsuite <scripts/bootstrap-instance-for-testsuite>`_ (:download:`download </birdhouse/scripts/bootstrap-instance-for-testsuite>`)
to prepare your new instance. Further documentation inside the script.

Optional component
Optional components
`all-public-access <./optional-components#give-public-access-to-all-resources-for-testing-purposes>`_
also need to be enabled in ``env.local``.
and `secure-thredds <./optional-components/#control-secured-access-to-resources-example>`_
also need to be enabled in ``env.local`` using ``EXTRA_CONF_DIRS`` variable.

ESGF login is also needed for
https://github.com/Ouranosinc/pavics-sdi/blob/master/docs/source/notebooks/esgf-dap.ipynb
part of test suite. ESGF credentails can be given to Jenkins via
part of test suite. ESGF credentials can be given to Jenkins via
https://github.com/Ouranosinc/jenkins-config/blob/aafaf6c33ea60faede2a32850604c07c901189e8/env.local.example#L11-L13

The canarie monitoring link
Expand Down
2 changes: 1 addition & 1 deletion birdhouse/config/magpie/magpie.ini.template
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ prefix = /magpie

[server:main]
use = egg:gunicorn#main
host = localhost
host = 0.0.0.0
port=2001
timeout=10
workers=3
Expand Down
3 changes: 3 additions & 0 deletions birdhouse/default.env
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ export FINCH_IMAGE="birdhouse/finch:version-0.7.4"

export THREDDS_IMAGE="unidata/thredds-docker:4.6.15"

# Tag version that will be used to update Magpie API, Magpie CLI, and matching Twitcher with Magpie Adapter
export MAGPIE_VERSION=3.12.0

# Root directory under which all data persistence should be nested under
export DATA_PERSIST_ROOT="/data"

Expand Down
4 changes: 2 additions & 2 deletions birdhouse/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ services:
logging: *default-logging

magpie:
image: pavics/magpie:3.8.0
image: pavics/magpie:${MAGPIE_VERSION}
container_name: magpie
ports:
- "2001:2001"
Expand Down Expand Up @@ -338,7 +338,7 @@ services:
logging: *default-logging

twitcher:
image: pavics/twitcher:magpie-3.8.0
image: pavics/twitcher:magpie-${MAGPIE_VERSION}
container_name: twitcher
ports:
- "8000:8000"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,21 @@ permissions:
group: anonymous
action: create

# preserve access for test-suite user
# Following permissions provide access to 'secure' directory nested under 'thredds' service to any user that is member
# of 'thredds-secure-authtest-group'. This permission will take priority over 'anonymous' group above that gets denied
# public access to 'secure' directory. Users that must be granted access to data under 'secure' should be added
# to the group to inherit permissions.
# The group is created dynamically if it doesn't already exist. User 'authtest' from 'create-magpie-authtest-user'
# script when bootstrapping the instance for testing purpose.

- service: thredds
resource: /birdhouse/testdata/secure
type: directory
permission:
name: browse
access: allow
scope: recursive
user: authtest
group: thredds-secure-authtest-group
action: create

- service: thredds
Expand All @@ -54,7 +60,7 @@ permissions:
name: read
access: allow
scope: recursive
user: authtest
group: thredds-secure-authtest-group
action: create

- service: thredds
Expand All @@ -64,5 +70,5 @@ permissions:
name: write
access: allow
scope: recursive
user: authtest
group: thredds-secure-authtest-group
action: create
6 changes: 5 additions & 1 deletion birdhouse/scripts/create-magpie-authtest-user
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ THIS_DIR="`dirname "$THIS_FILE"`"

TMP_CONFIG_FILE="/tmp/create-magpie-authtest-user.yml"

# Test user is added to 'thredds-secure-authtest-group' to obtain access to 'secure' directory under 'thredds' service.
# Those permissions are defined in 'optional-components/secure-thredds/secure-access-magpie-permission.cfg'
# which should also be included in 'EXTRA_CONF_DIRS' of your custom 'env.local' file.
# This user is also automatically added to 'anonymous' group without the need of explicit membership here.
cat <<__OEF__ > $TMP_CONFIG_FILE
users:
- username: authtest
password: authtest1234
email: authtest@example.com
group: anonymous
group: thredds-secure-authtest-group
__OEF__

set -x
Expand Down
17 changes: 15 additions & 2 deletions birdhouse/scripts/create-magpie-users
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,21 @@
# bogus03 bvNWVWCQi8M6 409 : User name matches an already existing user name.
#

RED=$(tput setaf 1)
NORMAL=$(tput sgr0)

THIS_FILE="`realpath "$0"`"
THIS_DIR="`dirname "$THIS_FILE"`"
COMPOSE_DIR="`dirname "$THIS_DIR"`"

# must retrieve MAGPIE_VERSION from 'default.env' or 'env.local'
if [ -f "$COMPOSE_DIR/default.env" ]; then
. "${COMPOSE_DIR}/default.env"
fi

if [ -f "$COMPOSE_DIR/env.local" ]; then
# Get PAVICS_FQDN, MAGPIE_ADMIN_PASSWORD, MAGPIE_ADMIN_USERNAME
. $COMPOSE_DIR/env.local
. "${COMPOSE_DIR}/env.local"
fi

##############################################################################
Expand All @@ -98,7 +106,12 @@ if [ -z "$MAGPIE_CLI_CONF" ]; then
fi

if [ -z "$MAGPIE_CLI_IMAGE" ]; then
MAGPIE_CLI_IMAGE="pavics/magpie:3.8.0"
# MAGPIE_VERSION must be provided by 'default.env', 'env.local' or directly
if [ -z "${MAGPIE_VERSION}" ]; then
echo "${RED}Error${NORMAL}: Required MAGPIE_VERSION is undefined or empty."
exit 1
fi
MAGPIE_CLI_IMAGE="pavics/magpie:${MAGPIE_VERSION}"
fi

# End configurable config via env var.
Expand Down

0 comments on commit 93c1ef3

Please sign in to comment.