Skip to content

Commit

Permalink
Upgrade for aca-py v1.0.0
Browse files Browse the repository at this point in the history
Signed-off-by: jamshale <[email protected]>
  • Loading branch information
jamshale authored and loneil committed Oct 9, 2024
1 parent a6d5398 commit 5452462
Show file tree
Hide file tree
Showing 28 changed files with 1,281 additions and 1,095 deletions.
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
2 changes: 2 additions & 0 deletions charts/traction/templates/acapy/deployment.yaml
Original file line number Diff line number Diff line change
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
11 changes: 11 additions & 0 deletions charts/traction/values.yaml
Original file line number Diff line number Diff line change
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
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/[email protected]#subdirectory=basicmessage_storage
RUN pip install git+https://github.com/hyperledger/[email protected]#subdirectory=connection_update
RUN pip install git+https://github.com/hyperledger/[email protected]#subdirectory=multitenant_provider
RUN pip install git+https://github.com/hyperledger/[email protected]#subdirectory=rpc
RUN pip install git+https://github.com/hyperledger/[email protected]#subdirectory=basicmessage_storage
RUN pip install git+https://github.com/hyperledger/[email protected]#subdirectory=connection_update
RUN pip install git+https://github.com/hyperledger/[email protected]#subdirectory=multitenant_provider
RUN pip install git+https://github.com/hyperledger/[email protected]#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
6 changes: 2 additions & 4 deletions plugins/traction_innkeeper/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
### developer notes

- install python 3.6.13
- install poetry version 1.1.11
- the base docker image is python 3.6.13, so best to develop using that version
- there are issues using poetry lock files generated by a newer version, then run using an older version. the dockerfile uses 1.1.11, so stick with that
- install python 3.12
- install poetry version 1.8.3

### build and run
```
Expand Down
4 changes: 2 additions & 2 deletions plugins/traction_innkeeper/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9-slim AS base
FROM python:3.12-slim AS base
WORKDIR /usr/src/app

# Install and configure poetry
Expand All @@ -19,7 +19,7 @@ ARG install_flags=--no-dev
RUN poetry install ${install_flags}
USER $user

FROM python:3.9-bullseye
FROM python:3.12-bullseye
WORKDIR /usr/src/app
COPY --from=base /usr/src/app/.venv /usr/src/app/.venv
ENV PATH="/usr/src/app/.venv/bin:$PATH"
Expand Down
Loading

0 comments on commit 5452462

Please sign in to comment.