From fad6aa913d421da0db2128afde9cbf1cf65aaf9d Mon Sep 17 00:00:00 2001 From: jreadey Date: Thu, 25 Apr 2024 13:30:39 -0700 Subject: [PATCH] added codespace config --- .devcontainer/devcontainer.json | 29 +++++ .devcontainer/docker-compose.yaml | 107 ++++++++++++++++++ .gitignore | 3 + .hsds/config/override.yml | 9 ++ .hsds/config/passwd.txt | 13 +++ .hsds/data/hsdstest/home/.domain.json | 1 + .../hsdstest/home/test_user1/.domain.json | 1 + .../home/test_user1/h5pyd_test/.domain.json | 1 + data/hsdstest/home/test_user1/.domain.json | 1 + 9 files changed, 165 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/docker-compose.yaml create mode 100644 .hsds/config/override.yml create mode 100644 .hsds/config/passwd.txt create mode 100644 .hsds/data/hsdstest/home/.domain.json create mode 100644 .hsds/data/hsdstest/home/test_user1/.domain.json create mode 100644 .hsds/data/hsdstest/home/test_user1/h5pyd_test/.domain.json create mode 100644 data/hsdstest/home/test_user1/.domain.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..f0c5dab7 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,29 @@ +{ + "name": "h5pyd with HSDS", + "hostRequirements": { + "cpus": 4 + }, + "dockerComposeFile": "docker-compose.yaml", + "updateContentCommand": "python3 -m pip install -r requirements.txt", + "postCreateCommand": "", + "service": "app", + "workspaceFolder": "/workspace", + "forwardPorts": [5101], + "portsAttributes": { + "5101": {"label": "HSDS port", "onAutoForward": "silent"} + }, + "features": { + "ghcr.io/devcontainers/features/docker-outside-of-docker": {} + }, + "customizations": { + "codespaces": { + "openFiles": [] + }, + "vscode": { + "extensions": [ + "ms-python.python", + "ms-toolsai.jupyter" + ] + } + } +} \ No newline at end of file diff --git a/.devcontainer/docker-compose.yaml b/.devcontainer/docker-compose.yaml new file mode 100644 index 00000000..933dbea8 --- /dev/null +++ b/.devcontainer/docker-compose.yaml @@ -0,0 +1,107 @@ +version: "3" +services: + app: + image: "mcr.microsoft.com/devcontainers/universal:2" + environment: + - HS_ENDPOINT=http://localhost:5101 + - HS_USERNAME=test_user1 + - HS_PASSWORD=test + - H5PYD_TEST_FOLDER=/home/test_user1/h5pyd_test/ + volumes: + - ..:/workspace:cached + + # Overrides default command so things don't shut down after the process ends. + command: sleep infinity + + # Runs app on the same network as the SN container, allows "forwardPorts" in devcontainer.json function. + network_mode: service:sn + head: + image: hdfgroup/hsds:master + restart: on-failure + mem_limit: 512m + environment: + - TARGET_SN_COUNT=1 + - TARGET_DN_COUNT=4 + - NODE_TYPE=head_node + ports: + - 5100 + volumes: + - ../.hsds/data:/data + - ../.hsds/config/:/config/ + dn1: + image: hdfgroup/hsds:master + restart: on-failure + mem_limit: 1g + environment: + - NODE_TYPE=dn + - ROOT_DIR=/data + ports: + - 6101 + depends_on: + - head + volumes: + - ../.hsds/data:/data + - ../.hsds/config/:/config/ + links: + - head + dn2: + image: hdfgroup/hsds:master + restart: on-failure + mem_limit: 1g + environment: + - NODE_TYPE=dn + ports: + - 6102 + depends_on: + - head + volumes: + - ../.hsds/data:/data + - ../.hsds/config/:/config/ + links: + - head + dn3: + image: hdfgroup/hsds:master + restart: on-failure + mem_limit: 1g + environment: + - NODE_TYPE=dn + ports: + - 6103 + depends_on: + - head + volumes: + - ../.hsds/data:/data + - ../.hsds/config/:/config/ + links: + - head + dn4: + image: hdfgroup/hsds:master + restart: on-failure + mem_limit: 1g + environment: + - NODE_TYPE=dn + ports: + - 6104 + depends_on: + - head + volumes: + - ../.hsds/data:/data + - ../.hsds/config/:/config/ + links: + - head + sn: + image: hdfgroup/hsds:master + restart: on-failure + mem_limit: 1g + environment: + - SN_PORT=5101 + - NODE_TYPE=sn + ports: + - 5101:5101 + depends_on: + - head + volumes: + - ../.hsds/data:/data + - ../.hsds/config/:/config/ + links: + - head diff --git a/.gitignore b/.gitignore index 9f4c2f4f..c9085396 100644 --- a/.gitignore +++ b/.gitignore @@ -66,3 +66,6 @@ target/ # macOS stuff .DS_Store + +# hsds config +/.hsds/ diff --git a/.hsds/config/override.yml b/.hsds/config/override.yml new file mode 100644 index 00000000..c13dbb06 --- /dev/null +++ b/.hsds/config/override.yml @@ -0,0 +1,9 @@ +log_level: DEBUG +bucket_name: hsdstest +server_name: "HSDS for Github codespaces" +aws_region: us-west-2 # (original was us-east-1) +aws_s3_gateway: http://s3.us-west-2.amazonaws.com/ # (original was null) +aws_s3_no_sign_request: True # (original was false) +root_dir: /data + + diff --git a/.hsds/config/passwd.txt b/.hsds/config/passwd.txt new file mode 100644 index 00000000..fc4dc113 --- /dev/null +++ b/.hsds/config/passwd.txt @@ -0,0 +1,13 @@ +# HSDS password file template +# +# +# This file contains a list of usernames/passwords that will be used to authenticate +# requests to HSDS. +# If using HTTP Basic Auth, copy file to "passwd.txt" in the same directory before deploying HSDS. +# Otherwise, if using Azure Active Directory or Kerberos, don't copy this file - usernames will be +# authenticated using those identity providers. +# For production use, replace the "test" password below with secret passwords and add +# and any new accounts desired. +admin:admin +test_user1:test +test_user2:test diff --git a/.hsds/data/hsdstest/home/.domain.json b/.hsds/data/hsdstest/home/.domain.json new file mode 100644 index 00000000..d6f91997 --- /dev/null +++ b/.hsds/data/hsdstest/home/.domain.json @@ -0,0 +1 @@ +{"owner": "admin", "acls": {"admin": {"create": true, "read": true, "update": true, "delete": true, "readACL": true, "updateACL": true}, "default": {"create": false, "read": true, "update": false, "delete": false, "readACL": false, "updateACL": false}}, "created": 1708897646.0599918, "lastModified": 1708897646.0599918} \ No newline at end of file diff --git a/.hsds/data/hsdstest/home/test_user1/.domain.json b/.hsds/data/hsdstest/home/test_user1/.domain.json new file mode 100644 index 00000000..9bd46f8d --- /dev/null +++ b/.hsds/data/hsdstest/home/test_user1/.domain.json @@ -0,0 +1 @@ +{"owner": "test_user1", "acls": {"test_user1": {"create": true, "read": true, "update": true, "delete": true, "readACL": true, "updateACL": true}, "default": {"create": false, "read": true, "update": false, "delete": false, "readACL": false, "updateACL": false}}, "created": 1711992550.3733413, "lastModified": 1711992550.3733413} \ No newline at end of file diff --git a/.hsds/data/hsdstest/home/test_user1/h5pyd_test/.domain.json b/.hsds/data/hsdstest/home/test_user1/h5pyd_test/.domain.json new file mode 100644 index 00000000..ce715d4a --- /dev/null +++ b/.hsds/data/hsdstest/home/test_user1/h5pyd_test/.domain.json @@ -0,0 +1 @@ +{"owner": "test_user1", "acls": {"test_user1": {"create": true, "read": true, "update": true, "delete": true, "readACL": true, "updateACL": true}, "default": {"create": false, "read": true, "update": false, "delete": false, "readACL": false, "updateACL": false}}, "created": 1711992550.3733413, "lastModified": 1711992550.3733413} diff --git a/data/hsdstest/home/test_user1/.domain.json b/data/hsdstest/home/test_user1/.domain.json new file mode 100644 index 00000000..9bd46f8d --- /dev/null +++ b/data/hsdstest/home/test_user1/.domain.json @@ -0,0 +1 @@ +{"owner": "test_user1", "acls": {"test_user1": {"create": true, "read": true, "update": true, "delete": true, "readACL": true, "updateACL": true}, "default": {"create": false, "read": true, "update": false, "delete": false, "readACL": false, "updateACL": false}}, "created": 1711992550.3733413, "lastModified": 1711992550.3733413} \ No newline at end of file