Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magpie thredds #107

Merged
merged 25 commits into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
807a13d
updated magpie and twitcher to 3.2.0 + add thredds browse permission …
Nov 10, 2020
d2c6405
secure config for thredds
fmigneault Nov 9, 2020
5bcc1c3
readme secure-thredds updates + remove public handled by other config
fmigneault Nov 10, 2020
89cbd89
remove top-level secure directory permission + add write deny permission
fmigneault Nov 11, 2020
d9f4739
add readme details
fmigneault Nov 11, 2020
2c460c9
fix typos and over-length doc lines
fmigneault Nov 11, 2020
2ddf64e
fix markdown links
fmigneault Nov 11, 2020
c6982c3
add how-to enable secure component
fmigneault Nov 11, 2020
b08f972
Merge pull request #99 from bird-house/test-magpie-auth
fmigneault Nov 12, 2020
9759e1d
Merge remote-tracking branch 'origin/master' into bump_magpie_and_twi…
tlvu Nov 13, 2020
90b27b3
README: remove trailing white
tlvu Nov 13, 2020
32cd6f9
create-magpie-users: bump magpie image to match newer version
tlvu Nov 13, 2020
8f8eb2a
bump magpie 3.2.1 (fix permission modifiers from config) + add resour…
fmigneault Nov 18, 2020
67ff45c
allow test user access to thredds secure resource + use permission ob…
fmigneault Nov 19, 2020
c9ce4ca
Merge remote-tracking branch 'origin/master' into bump_magpie_and_twi…
tlvu Nov 20, 2020
0d332a3
custom magpie thredds config
fmigneault Nov 24, 2020
6cbfe85
bump magpie/twticher v3.3.0
fmigneault Nov 25, 2020
0863653
update magpie's thredds config with extra prefixes
fmigneault Nov 26, 2020
6e9b1d8
add doc reference to magpie thredds config
fmigneault Nov 26, 2020
f448778
add ncml extension to magpie-thredds config
fmigneault Nov 30, 2020
79c56f1
bump magpie and twitcher to 3.5.0
Jan 27, 2021
242e234
bump magpie/twitcher 3.5.1
fmigneault Feb 8, 2021
7c1a831
Merge branch 'master' into magpie-thredds
fmigneault Mar 16, 2021
81b2304
reapply readme details against latest master changes
fmigneault Mar 16, 2021
ea21821
Merge branch 'master' into magpie-thredds
fmigneault Mar 18, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions birdhouse/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,20 @@ Requirements:
version from the distro).

To run `docker-compose` for PAVICS, the [`pavics-compose.sh`](pavics-compose.sh) wrapper script must be used.
This script will source the `env.local` file, apply the appropriate variable substitutions on all the configuration files ".template", and run `docker-compose` with all the command line arguments given to `pavics-compose.sh`. See [`env.local.example`](env.local.example) for more details on what can go into the `env.local` file.
This script will source the `env.local` file, apply the appropriate variable substitutions on all the configuration
files ".template", and run `docker-compose` with all the command line arguments given to `pavics-compose.sh`.
See [`env.local.example`](env.local.example) for more details on what can go into the `env.local` file.

If the file `env.local` is somewhere else, symlink it here, next to
`docker-compose.yml` because many scripts assume this location.

To follow infrastructure-as-code, it is encouraged to source control the above
`env.local` file and any override needed to customized this PAVICS deployment
for your organization. For an example of possible override, see how the [emu
service](optional-components/emu/docker-compose-extra.yml)
for your organization. For an example of possible override, see how the
[emu service](optional-components/emu/docker-compose-extra.yml)
([README](optional-components/README.md)) can be optionally added to the
deployment via the [override
mechanism](https://docs.docker.com/compose/extends/). Ouranos specific
override can be found in this
deployment via the [override mechanism](https://docs.docker.com/compose/extends/).
Ouranos specific override can be found in this
[birdhouse-deploy-ouranos](https://github.com/bird-house/birdhouse-deploy-ouranos)
repo.

Expand Down Expand Up @@ -62,16 +63,18 @@ To launch all the containers, use the following command:
./pavics-compose.sh up -d
```

If you get a `'No applicable error code, please check error log'` error from the WPS processes, please make sure that the WPS databases exists in the
postgres instance. See [`scripts/create-wps-pgsql-databases.sh`](scripts/create-wps-pgsql-databases.sh).
If you get a `'No applicable error code, please check error log'` error from the WPS processes,
please make sure that the WPS databases exists in the postgres instance.
See [`scripts/create-wps-pgsql-databases.sh`](scripts/create-wps-pgsql-databases.sh).


## Manual steps post deployment

### Change geoserver default admin password

* Go to
https://<PAVICS_FQDN>/geoserver/web/wicket/bookmarkable/org.geoserver.security.web.UserGroupRoleServicesPage (Security -> Users, Groups, and Roles)
https://<PAVICS_FQDN>/geoserver/web/wicket/bookmarkable/org.geoserver.security.web.UserGroupRoleServicesPage
(Security -> Users, Groups, and Roles)

* Login using the default username `admin` and default password `geoserver`.

Expand Down Expand Up @@ -129,9 +132,13 @@ Optional component
[all-public-access](optional-components#give-public-access-to-all-resources-for-testing-purposes)
also need to be enabled in `env.local`.

To test secured access to THREDDS files and directories, optional component
[secure-thredds](optional-components#control-secured-access-to-resources-example)
also need to be enabled in `env.local`.

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 Expand Up @@ -216,7 +223,7 @@ Given a version number MAJOR.MINOR.PATCH, increment the:

1. MINOR version when we add new components or update existing components
that also require change to other existing components (ex: new Magpie that
also force Twitcher and/or Frondend update) or the change to the existing
also force Twitcher and/or Frontend update) or the change to the existing
component is a major one (ex: major refactoring of Twitcher, big merge
with corresponding upstream component from birdhouse project).

Expand Down
4 changes: 2 additions & 2 deletions birdhouse/components/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ How to Enable the Component
Old way to deploy the automatic deployment
------------------------------------------

Superseeded by this new ``scheduler`` component. Keeping for reference only.
Superseded by this new ``scheduler`` component. Keeping for reference only.

Doing it this old way do not need the ``scheduler`` compoment but lose the
Doing it this old way do not need the ``scheduler`` component but lose the
ability for the autodeploy system to update itself.

Configure logrotate for all following automations to prevent disk full::
Expand Down
25 changes: 25 additions & 0 deletions birdhouse/config/magpie/providers.cfg.template
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,31 @@ providers:
c4i: false
type: thredds
sync_type: thredds
# below is a custom config to indicate how magpie should convert thredds path elements into resources/permissions
# see: https://pavics-magpie.readthedocs.io/en/latest/services.html#servicethredds
configuration:
skip_prefix: "thredds" # prefix to ignore, below prefixes will be matched against whatever comes after in path
file_patterns:
# note: make sure to employ quotes and double escapes to avoid parsing YAML error
- ".+\\.nc"
fmigneault marked this conversation as resolved.
Show resolved Hide resolved
fmigneault marked this conversation as resolved.
Show resolved Hide resolved
metadata_type:
prefixes:
- null # note: special YAML value evaluated as `no-prefix`, use quotes if literal value is needed
- "\\w+\\.gif" # threddsIcon, folder icon, etc.
- "\\w+\\.ico" # favicon
- "\\w+\\.txt" # licence
- "\\w+\\.css" # tds.css
- "catalog\\.\\w+" # note: special case for `THREDDS` top-level directory (root) accessed for `BROWSE`
- catalog
- ncml
fmigneault marked this conversation as resolved.
Show resolved Hide resolved
- uddc
- iso
data_type:
prefixes:
- fileServer
- dodsC
- wcs
- wms

ncWMS2:
url: http://${PAVICS_FQDN}:8080/ncWMS2
Expand Down
4 changes: 2 additions & 2 deletions birdhouse/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ services:
restart: always

magpie:
image: pavics/magpie:1.7.3
image: pavics/magpie:3.3.0
container_name: magpie
ports:
- "2001:2001"
Expand All @@ -307,7 +307,7 @@ services:
restart: always

twitcher:
image: pavics/twitcher:magpie-1.7.3
image: pavics/twitcher:magpie-3.3.0
container_name: twitcher
ports:
- "8000:8000"
Expand Down
7 changes: 5 additions & 2 deletions birdhouse/env.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,17 @@ export POSTGRES_MAGPIE_PASSWORD=postgres-qwerty
# Format: space separated list of dirs
#
#export EXTRA_CONF_DIRS="/path/to/dir1 ./path/to/dir2 dir3 dir4"
#export EXTRA_CONF_DIRS="./optional-components/canarie-api-full-monitoring
#export EXTRA_CONF_DIRS="
# ./optional-components/canarie-api-full-monitoring
# ./optional-components/emu
# ./optional-components/testthredds
# ./optional-components/generic_bird
# ./optional-components/all-public-access
# ./optional-components/secure-thredds
# ./components/scheduler
# ./components/monitoring
# /path/to/private-config-repo"
# /path/to/private-config-repo
#"

# Extra repos, than the current repo, the autodeploy should keep up-to-date.
# Any changes to these extra repos will also trigger autodeploy.
Expand Down
38 changes: 33 additions & 5 deletions birdhouse/optional-components/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Optional components

## Monitor all components in Canarie node, both public and internal url
## Monitor all components in Canarie node, both public and internal URL

So that the url https://<PAVICS_FQDN>/canarie/node/service/stats also return
what the end user really see (a component might work but is not accessible to
Expand Down Expand Up @@ -116,9 +116,13 @@ Canarie monitoring will also be automatically configured for this WPS service.

## Give public access to all resources for testing purposes

By enabling this component, all WPS services and data on Thredds are completely public, please beware.
Once enabled, if you need to revert the change, you have to do it manually by logging into Magpie.
Just disabling this component will not revert the change.
By enabling this component, all WPS services and data on Thredds are completely public, please beware.

Once enabled, if you need to revert the change, you have to do it manually by logging into Magpie.
Just disabling this component will not revert the change. Alternatively, you can create an identical file to
[`./optional-components/all-public-access/all-public-access-magpie-permission.cfg`](all-public-access/all-public-access-magpie-permission.cfg).
and replace all desired `action: create` entries into `action: remove` to make sure the permissions are removed as
startup if they exist.

This optional component is required for the test suite at
https://github.com/Ouranosinc/PAVICS-e2e-workflow-tests.
Expand All @@ -128,4 +132,28 @@ How to enable in `env.local` (a copy from

* Add `./optional-components/all-public-access` to `EXTRA_CONF_DIRS`.

The anonymous user will now have all the permissions described in [`./optional-components/all-public-access/all-public-access-magpie-permission.cfg`](all-public-access/all-public-access-magpie-permission.cfg).
The anonymous user will now have all the permissions described in
[`./optional-components/all-public-access/all-public-access-magpie-permission.cfg`](all-public-access/all-public-access-magpie-permission.cfg).


## Control secured access to resources example

Optional configuration
[`./optional-components/secure-thredds/secure-access-magpie-permission.cfg`](secure-thredds/secure-access-magpie-permission.cfg)
is provided as example to illustrate how to apply permissions on specific THREDDS resources to limit their access publicly.
This permission configuration can be combined with others, such as
[all-public-access](#Give-public-access-to-all-resources-for-testing-purposes)
ones to formulate specific permissions schemes that matches your data structure and desired access rules.

How to enable in `env.local` (a copy from
[`env.local.example`](../env.local.example)):

* Add `./optional-components/secure-thredds` to `EXTRA_CONF_DIRS`.

The anonymous user will *not* have access anymore to THREDDS test directory `birdhouse/testdata/secure` and any other
directories and files under it. Directories above that one will still be accessible if
[all-public-access](#Give-public-access-to-all-resources-for-testing-purposes) component was also employed.

On a typical server, custom and private permission rules should be provided in a similar fashion to ensure that
each time a new instance is booted, the same scheme of access configuration is applied. Permissions applied manually
into Magpie will not be replicated onto other server instance.
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,8 @@ permissions:
permission: read
group: anonymous
action: create

- service: thredds
permission: browse
group: anonymous
action: create
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version: '2.1'
services:
magpie:
volumes:
- ./optional-components/secure-thredds/secure-access-magpie-permission.cfg:/opt/local/src/magpie/config/permissions/secure-access-magpie-permission.cfg:ro
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
permissions:
# note:
# following permissions can be combined with others such as 'optional-components/all-public-access'
# to provide access to 'everything' except those under 'secure' directories listed below

# following permissions only enforce security on specific directories and files under it
# these can be reverted or combined with other set of permissions on resources 'above' or 'under' in the hierarchy
# users or groups will need explicit permissions under following resources for them to access sub-directories/files
- service: thredds
resource: /birdhouse/testdata/secure
type: directory
permission:
name: browse
access: deny
scope: recursive
group: anonymous
action: create

- service: thredds
resource: /birdhouse/testdata/secure
type: directory
permission:
name: read
access: deny
scope: recursive
group: anonymous
action: create

- service: thredds
resource: /birdhouse/testdata/secure
type: directory
permission:
name: write
access: deny
scope: recursive
group: anonymous
action: create

# preserve access for test-suite user
- service: thredds
resource: /birdhouse/testdata/secure
type: directory
permission:
name: browse
access: allow
scope: recursive
user: authtest
action: create

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

- service: thredds
resource: /birdhouse/testdata/secure
type: directory
permission:
name: write
access: allow
scope: recursive
user: authtest
action: create
2 changes: 1 addition & 1 deletion birdhouse/scripts/create-magpie-users
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ if [ -z "$MAGPIE_CLI_CONF" ]; then
fi

if [ -z "$MAGPIE_CLI_IMAGE" ]; then
MAGPIE_CLI_IMAGE="pavics/magpie:2.0.1"
MAGPIE_CLI_IMAGE="pavics/magpie:3.2.0"
fi

# End configurable config via env var.
Expand Down