Skip to content

Commit

Permalink
Merge branch 'main' into manage
Browse files Browse the repository at this point in the history
  • Loading branch information
H4LL authored Oct 14, 2024
2 parents 31edeb6 + b2831c0 commit 1e7c8ef
Show file tree
Hide file tree
Showing 80 changed files with 2,626 additions and 2,972 deletions.
1 change: 0 additions & 1 deletion .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ exclude_patterns:
- ".vscode/"
- "charts/"
- "scripts/"
- "services/endorser/"
- "services/tenant-ui/frontend/src/overlayLibrary"
- "services/tenant-ui/frontend/src/types/acapyApi"
- "services/traction/acapy_client/"
Expand Down
21 changes: 0 additions & 21 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,6 @@ updates:
all-actions:
patterns: [ "*" ]

# Maintain dependencies for Python Packages
- package-ecosystem: "pip"
directory: "/services/endorser"
schedule:
interval: "weekly"
day: "monday"
time: "04:00"
timezone: "Canada/Pacific"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]

# Maintain dependencies for Python Packages
- package-ecosystem: "pip"
directory: "/plugins"
Expand Down Expand Up @@ -126,15 +114,6 @@ updates:
day: "monday"
time: "04:00"
timezone: "Canada/Pacific"

# Maintain dependencies for docker
- package-ecosystem: "docker"
directory: "/services/endorser"
schedule:
interval: "weekly"
day: "monday"
time: "04:00"
timezone: "Canada/Pacific"

# Maintain dependencies for docker
- package-ecosystem: "docker"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/on_pr_closed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
clean-ghcr:
runs-on: ubuntu-22.04
if: github.repository_owner == 'bcgov'
if: ${{ false }}
name: Delete closed PR images
steps:
- name: Delete Images
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ Traction makes it easier to integrate digital trust technology into existing lin

- [ACA-Py + plugins](./plugins/README.md)
- [Tenant UI](./services/tenant-ui/README.md)
- [Endorser Services](./services/endorser/README.md)


## Start contributing to Traction
Expand Down
9 changes: 8 additions & 1 deletion charts/traction/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,14 @@ kubectl delete secret,pvc --selector "app.kubernetes.io/instance"=my-release
| `acapy.walletStorageCredentials.password` | Database password. | `""` |
| `acapy.walletStorageCredentials.admin_account` | Database account with CREATEDB role used to create additional databases per wallet. | `postgres` |
| `acapy.walletStorageCredentials.admin_password` | Database password for admin account. | `""` |
| `acapy.walletStorageCredentials.existingSecret` | Name of an existing secret containing 'database-user', 'database-password', 'admin-password' keys. | `""` |
| `acapy.walletStorageCredentials.existingSecret` | Name of an existing secret containing 'database-user', 'database-password', 'admin-password' keys.

### Multitenancy Configuration

| Name | Description | Value |
| ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------- |
| `acapy.multitenancyConfiguration.json` | json with config. Overrides all other values including subchart values. e.g.: '{"wallet_type":"single-wallet-askar", "wallet_name":"askar-wallet"}' | `""` |
| `acapy.multitenancyConfiguration.wallet_type` | The multitenant wallet type. | `single-wallet-askar` |

### Acapy Plugins

Expand Down
11 changes: 11 additions & 0 deletions charts/traction/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,17 @@ Generate acapy wallet storage credentials
{{- end -}}
{{- end -}}

{{/*
Multitenancy config
*/}}
{{- define "acapy.multitenancyConfiguration" -}}
{{- if .Values.acapy.multitenancyConfiguration.json -}}
{{- .Values.acapy.multitenancyConfiguration.json -}}
{{- else -}}
'{"wallet_type":"{{ .Values.acapy.multitenancyConfiguration.wallet_type | default "single-wallet-askar" }}"}'
{{- end -}}
{{- end -}}

{{- define "acapy.openshift.route.tls" -}}
{{- if (.Values.acapy.openshift.route.tls.enabled) -}}
tls:
Expand Down
8 changes: 5 additions & 3 deletions charts/traction/templates/acapy/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ spec:
--endpoint https://{{ include "acapy.host" . }} \
--arg-file '/home/aries/argfile.yml' \
--plugin 'aries_cloudagent.messaging.jsonld' \
{{- if .Values.acapy.plugins.multitenantProvider }}
--plugin multitenant_provider.v1_0 \
{{- end }}
{{- if .Values.acapy.plugins.tractionInnkeeper }}
--plugin traction_plugins.traction_innkeeper.v1_0 \
--plugin-config-value traction_innkeeper.innkeeper_wallet.tenant_id=\"$(INNKEEPER_WALLET_TENANT_ID)\" \
Expand All @@ -62,9 +65,6 @@ spec:
{{- if .Values.acapy.plugins.connectionUpdate }}
--plugin connection_update.v1_0 \
{{- end }}
{{- if .Values.acapy.plugins.multitenantProvider }}
--plugin multitenant_provider.v1_0 \
{{- end }}
{{- if .Values.acapy.plugins.rpc }}
--plugin rpc.v1_0 \
{{- end }}
Expand Down Expand Up @@ -124,6 +124,8 @@ spec:
value: {{ include "acapy.walletStorageConfig" . }}
- name: ACAPY_WALLET_STORAGE_CREDS
value: {{ include "acapy.walletStorageCredentials" . }}
- name: ACAPY_MULTITENANCY_CONFIGURATION
value: {{ include "acapy.multitenancyConfiguration" . }}
readinessProbe:
httpGet:
path: /status/ready
Expand Down
13 changes: 12 additions & 1 deletion charts/traction/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ acapy:
is_production: true
is_write: true
genesis_url: "http://test.bcovrin.vonx.io/genesis"
endorser_did: "Ket75eV5UQvVkW2XBjgDH7"
endorser_did: "DfQetNSm7gGEHuzfUvpfPn"
endorser_alias: "bcovrin-test-endorser"

## @section Wallet Storage configuration
Expand Down Expand Up @@ -184,6 +184,17 @@ acapy:
secretKeys:
adminPasswordKey: admin-password
userPasswordKey: database-password
## @section ACA-Py Multitenancy Configuration
## Specifies the multitenancy config.
## Possible values: wallet_type, wallet_name, wallet_key, cache_size, 'key_derivation_method.
## "wallet_name" is only used when "wallet_type" is "askar-profile"
##
## @param acapy.multitenancyConfiguration.json Raw json with config. Overrides all other values including subchart values. e.g.: '{"wallet_type":"single-wallet-askar", "wallet_name":"askar-wallet"}'
## @param acapy.multitenancyConfiguration.wallet_type Database account name.
##
multitenancyConfiguration:
json: ''
wallet_type: single-wallet-askar
## @section Acapy Plugins
##
## Specify the plugins to enable.
Expand Down
2 changes: 1 addition & 1 deletion docs/traction-anoncreds-workshop.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# A Traction Sandbox Hyperledger Aries/AnonCreds Workshop

Find the Traction AnonCreds workshop in its new home at [Hyperledger Aries ACA-Py Docs](https://aca-py.org/latest/demo/Aries-Workshop/).
Find the Traction AnonCreds workshop in its new home at [Hyperledger Aries ACA-Py Docs](https://aca-py.org/latest/demo/ACA-Py-Workshop/).
26 changes: 20 additions & 6 deletions plugins/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.134.0/containers/python-3/.devcontainer/base.Dockerfile
ARG VARIANT="3.9"
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
ARG VARIANT="3.12"
FROM mcr.microsoft.com/devcontainers/python:${VARIANT}

# Poetry
ARG POETRY_VERSION="none"
RUN if [ "${POETRY_VERSION}" != "none" ]; then su vscode -c "umask 0002 && pip3 install poetry==${POETRY_VERSION}"; fi
ARG POETRY_VERSION="1.8.3"
ENV POETRY_HOME="/opt/poetry" \
POETRY_VERSION=${POETRY_VERSION}

RUN curl -sSL https://install.python-poetry.org | python3 - \
&& update-alternatives --install /usr/local/bin/poetry poetry /opt/poetry/bin/poetry 900 \
# Enable tab completion for bash
&& poetry completions bash >> /home/vscode/.bash_completion \
# Enable tab completion for Zsh
&& mkdir -p /home/vscode/.zfunc/ \
&& poetry completions zsh > /home/vscode/.zfunc/_poetry \
&& echo "fpath+=~/.zfunc\nautoload -Uz compinit && compinit" >> /home/vscode/.zshrc

COPY pyproject.toml poetry.lock ./
COPY /traction_innkeeper ./traction_innkeeper
RUN poetry config virtualenvs.create false \
&& poetry install --no-root --all-extras \
&& rm -rf /root/.cache/pypoetry
2 changes: 1 addition & 1 deletion plugins/.devcontainer/configs/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ wallet-key: 'insecure-change-me'
wallet-storage-type: postgres_storage
wallet-storage-config: '{"url":"host.docker.internal:5432","max_connections":5,"wallet_scheme":"DatabasePerWallet"}'
wallet-storage-creds: '{"account":"postgres","password":"postgresPass","admin_account":"postgres","admin_password":"postgresPass"}'
multitenancy-config: '{"wallet-type":"askar-profile","wallet-name":"askar-wallet"}'
multitenancy-config: '{"wallet-type":"single-wallet-askar","wallet-name":"askar-wallet"}'

log-level: info

Expand Down
2 changes: 1 addition & 1 deletion plugins/.devcontainer/configs/devcontainer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ wallet-key: 'insecure-change-me'
# wallet-storage-type: postgres_storage
# wallet-storage-config: '{"url":"host.docker.internal:5432","max_connections":5,"wallet_scheme":"DatabasePerWallet"}'
# wallet-storage-creds: '{"account":"postgres","password":"postgresPass","admin_account":"postgres","admin_password":"postgresPass"}'
multitenancy-config: '{"wallet-type":"askar-profile","wallet-name":"askar-wallet"}'
multitenancy-config: '{"wallet-type":"single-wallet-askar","wallet-name":"askar-wallet"}'

log-level: info

Expand Down
52 changes: 22 additions & 30 deletions plugins/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,38 @@
"dockerfile": "Dockerfile",
"context": "..",
"args": {
"VARIANT": "3.9-bullseye",
"VARIANT": "3.12-bullseye",
"POETRY_VERSION": "1.8.3"
}
},
"customizations": {
"vscode": {
"extensions": ["ms-python.python", "ms-python.vscode-pylance"],
"settings": {
"python.pythonPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint",
"python.testing.pytestArgs": [
".",
"--no-cov"
],
"python.testing.pytestArgs": ["./basicmessage_storage", "--no-cov"],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.testing.pytestPath": "pytest",
"editor.defaultFormatter": null,
"editor.formatOnSave": false, // enable per language
"[python]": {
"editor.formatOnSave": true
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": true
},
"editor.defaultFormatter": "charliermarsh.ruff",
"ruff.organizeImports": true
},
"python.formatting.provider": "black",
"python.formatting.blackArgs": [],
"python.venvFolders": ["${localWorkspaceFolder}/plugins/.venv"]
},
"extensions": [
"ms-python.python",
"ms-python.pylint",
"ms-python.vscode-pylance"
]
}
},
"ruff.codeAction.fixViolation": {
"enable": true
},
"ruff.fixAll": true,
"ruff.format.args": ["--config=./pyproject.toml"],
"ruff.lint.args": ["--config=./pyproject.toml"]
}
}
},

"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
Expand All @@ -57,8 +47,10 @@
"remoteEnv": {
// "PATH": "${containerEnv:PATH}:${workspaceRoot}/.venv/bin"
},

// "mounts": ["source=${localWorkspaceFolder}/demo/configs,target=/configs,type=bind,consistency=cached"],
// Use 'forwardPorts' to make a list of ports inside the container available locally.

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
3000,3001,3002,
8032
Expand Down
22 changes: 1 addition & 21 deletions plugins/.devcontainer/post-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,4 @@ set -ex
WORKSPACE_DIR=$(pwd)

# install all ACA-Py requirements
python -m pip install --upgrade pip
#pip3 install -r requirements.txt -r requirements.askar.txt -r requirements.bbs.txt -r requirements.dev.txt -r requirements.indy.txt

# Change some Poetry settings to better deal with working in a container
poetry config cache-dir ${WORKSPACE_DIR}/.cache
poetry config virtualenvs.in-project true
# Now install all dependencies
poetry install

export PATH=${PATH}:${WORKSPACE_DIR}/.venv/bin

# add all the requirements to the default python
poetry export --without-hashes --format=requirements.txt > requirements.txt
pip install -r requirements.txt

# install black for formatting
pip3 install black

# cleanup
rm poetry.lock
rm requirements.txt
python -m pip install --upgrade pip
15 changes: 8 additions & 7 deletions plugins/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.2 AS base
FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.12-1.0.0 AS base

# Install and Configure Poetry
USER root
ENV POETRY_VERSION=1.6.1
ENV POETRY_VERSION=1.8.3
ENV POETRY_HOME=/opt/poetry
RUN apt-get update && apt-get install -y curl && apt-get clean
RUN curl -sSL https://install.python-poetry.org | python -
Expand All @@ -24,16 +24,17 @@ RUN poetry install --only main
RUN ln -s $(poetry env info -p)/lib/python3.6/site-packages site-packages


FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.2
FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.12-1.0.0
COPY --from=base --chown=aries:aries /home/aries/.venv /home/aries/.venv
ENV PATH="/home/aries/.venv/bin:$PATH"

COPY --chown=aries:aries docker/default.yml ./
COPY --chown=aries:aries traction_innkeeper/traction_innkeeper traction_plugins/traction_innkeeper
RUN pip install git+https://github.com/hyperledger/aries-acapy-plugins@0.12.2#subdirectory=basicmessage_storage
RUN pip install git+https://github.com/hyperledger/aries-acapy-plugins@0.12.2#subdirectory=connection_update
RUN pip install git+https://github.com/hyperledger/aries-acapy-plugins@0.12.2#subdirectory=multitenant_provider
RUN pip install git+https://github.com/hyperledger/aries-acapy-plugins@0.12.2#subdirectory=rpc
RUN pip install git+https://github.com/hyperledger/aries-acapy-plugins@1.0.0#subdirectory=basicmessage_storage
RUN pip install git+https://github.com/hyperledger/aries-acapy-plugins@1.0.0#subdirectory=connection_update
RUN pip install git+https://github.com/hyperledger/aries-acapy-plugins@1.0.0#subdirectory=multitenant_provider
RUN pip install git+https://github.com/hyperledger/aries-acapy-plugins@1.0.0#subdirectory=rpc


ENTRYPOINT ["/bin/bash", "-c", "aca-py \"$@\"", "--"]
CMD ["start", "--arg-file", "default.yml"]
5 changes: 2 additions & 3 deletions plugins/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ The dockerfile is copying over the local plugins code, but should it? Probably s

### developer notes

- install python 3.6.13
- install poetry version 1.1.15
- the base docker image is python 3.6.13, so best to develop using that version
- install python 3.12
- install poetry version 1.8.3

### build and run
```
Expand Down
4 changes: 2 additions & 2 deletions plugins/docker/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ jwt-secret: insecure-jwt-secret
multitenant-admin: true

# Wallet
# wallet-name: default
wallet-name: default
wallet-type: askar
# wallet-key: "insecure, for use in demo only"
wallet-key: "insecure, for use in demo only"

log-level: info

Expand Down
11 changes: 5 additions & 6 deletions plugins/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,21 @@ readme = "README.md"


[tool.poetry.dependencies]
python = "^3.9"
aries-cloudagent = { version = "0.12.2" }
python = "^3.12"
aries-cloudagent = { version = "1.0.0" }
python-dateutil = "^2.8.2"
typing-extensions = "4.8.0"
traction-innkeeper = {path = "./traction_innkeeper", develop = true}

aries-askar = { version = "~0.3.0" }
aries-askar = { version = "~0.3.2" }
anoncreds= { version = "0.2.0" }
indy-credx = { version = "~1.1.1" }
indy-vdr = { version = "~0.4.0" }
indy-vdr = { version = "~0.4.1" }
ursa-bbs-signatures = { version = "~1.0.1" }
python3-indy = { version = "^1.11.1" }

[tool.poetry.dev-dependencies]
black = "^24.4.2"
flake8 = "^7.1.0"
ruff = "^0.5.7"

[build-system]
requires = ["setuptools", "poetry-core>=1.2"]
Expand Down
Loading

0 comments on commit 1e7c8ef

Please sign in to comment.