-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of github.com:Sphereon-Opensource/OID4VC-demo …
…into feat/VDX-308-env-subst # Conflicts: # packages/agent/conf/demos/sphereon/oid4vci_metadata/sphereon.json # packages/agent/conf/demos/sphereon/oid4vci_options/sphereon.json
- Loading branch information
Showing
61 changed files
with
722 additions
and
673 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Builder stage | ||
FROM node:lts-bookworm AS oid4vc-demo-builder | ||
SHELL ["/bin/bash", "-c"] | ||
RUN npm -g install pnpm && SHELL=bash pnpm setup && source /root/.bashrc && pnpm add -g pnpm | ||
RUN pnpm add typescript tslib | ||
WORKDIR /opt/oid4vc-demo | ||
|
||
COPY /. . | ||
RUN rm -rf /root/.local/share/pnpm/store | ||
RUN pnpm install -r | ||
RUN pnpm build | ||
|
||
# Final stage | ||
FROM node:lts-bookworm | ||
ARG PACKAGE_PATH | ||
ARG NODE_SCRIPT | ||
ENV NODE_SCRIPT=${NODE_SCRIPT} | ||
COPY --from=oid4vc-demo-builder /opt/oid4vc-demo/${PACKAGE_PATH} /opt/oid4vc-demo/${PACKAGE_PATH} | ||
# package node_modules has symlinks to root node_modules | ||
COPY --from=oid4vc-demo-builder /opt/oid4vc-demo/node_modules /opt/oid4vc-demo/node_modules | ||
|
||
WORKDIR /opt/oid4vc-demo/${PACKAGE_PATH} | ||
ENTRYPOINT npm run-script ${NODE_SCRIPT} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
version: '3.8' | ||
|
||
services: | ||
oid4vc-demo-ssi-agent: | ||
container_name: oid4vc-demo-ssi-agent | ||
image: oid4vc-demo-ssi-agent:latest | ||
build: | ||
context: ../../.. | ||
dockerfile: ./docker/Dockerfile | ||
args: | ||
PACKAGE_PATH: packages/agent | ||
NODE_SCRIPT: "start:dev" | ||
volumes: | ||
- "./agent/conf:/opt/oid4vc-demo/packages/agent/conf:ro" | ||
- "./agent/.env.local:/opt/oid4vc-demo/packages/agent/.env.local:ro" | ||
ports: | ||
- "5000:5000" | ||
|
||
oid4vci-demo-frontend: | ||
container_name: oid4vci-demo-frontend | ||
image: oid4vci-demo-frontend:latest | ||
depends_on: | ||
- oid4vc-demo-ssi-agent | ||
tty: true | ||
build: | ||
context: ../../.. | ||
dockerfile: ./docker/Dockerfile | ||
args: | ||
PACKAGE_PATH: packages/oid4vci-demo-frontend | ||
NODE_SCRIPT: "start:prod" | ||
volumes: | ||
- "./oid4vci-demo-frontend/conf:/opt/oid4vc-demo/packages/oid4vci-demo-frontend/src/configs:ro" | ||
- "./oid4vci-demo-frontend/.env.local:/opt/oid4vc-demo/packages/oid4vci-demo-frontend/.env.local:ro" | ||
ports: | ||
- "5001:5001" | ||
restart: unless-stopped | ||
|
||
oid4vp-demo-frontend: | ||
container_name: oid4vp-demo-frontend | ||
image: oid4vp-demo-frontend:latest | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" | ||
depends_on: | ||
- oid4vc-demo-ssi-agent | ||
tty: true | ||
build: | ||
context: ../../.. | ||
dockerfile: ./docker/Dockerfile | ||
args: | ||
PACKAGE_PATH: packages/oid4vp-demo-frontend | ||
NODE_SCRIPT: "start:prod" | ||
volumes: | ||
- "./oid4vp-demo-frontend/.env.local:/opt/oid4vc-demo/packages/oid4vp-demo-frontend/.env.local:ro" | ||
ports: | ||
- "5002:5002" | ||
restart: unless-stopped |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
#!/bin/bash | ||
|
||
ecosystem_name=$1 | ||
agent_host_address=$2 | ||
if [ -z "$ecosystem_name" ] || [ -z "$agent_host_address" ]; then | ||
echo "Usage: ./install-configs.sh <ecosystem> <agent host address>" | ||
exit 1 | ||
fi | ||
|
||
# Check if agent_host_address contains 'http://' or 'https://' | ||
if [[ ! $agent_host_address =~ ^http ]]; then | ||
echo "agent host address should be an http/https URL" | ||
exit 1 | ||
fi | ||
|
||
if [ ! -e "../../../packages/agent/conf/demos/${ecosystem_name}" ]; then | ||
echo "There is no ecosystem named ${ecosystem_name} in /packages/agent/conf/demos" | ||
exit 1 | ||
fi | ||
|
||
if [ ! -e "../../../packages/oid4vci-demo-frontend/src/configs/${ecosystem_name}.json" ]; then | ||
echo "There is no ecosystem file named ${ecosystem_name} json in packages/oid4vci-demo-frontend/src/configs" | ||
exit 1 | ||
fi | ||
|
||
|
||
# copy & patch .env files from templates | ||
mkdir -p ./agent | ||
cp ../../../packages/agent/.env.example ./agent/.env.local | ||
sed -i "s|^CONF_PATH=.*|CONF_PATH=\"/opt/oid4vc-demo/packages/agent/conf/${ecosystem_name}\"|" ./agent/.env.local | ||
sed -i "s|^OID4VP_WEBAPP_BASE_URI=.*|OID4VP_WEBAPP_BASE_URI=${agent_host_address}|" ./agent/.env.local | ||
sed -i "s|^OID4VP_AGENT_BASE_URI=.*|OID4VP_AGENT_BASE_URI=${agent_host_address}|" ./agent/.env.local | ||
|
||
mkdir -p ./oid4vci-demo-frontend/conf | ||
cp ../../../packages/oid4vci-demo-frontend/.env.example ./oid4vci-demo-frontend/.env.local | ||
sed -i "s|^REACT_APP_DEFAULT_ECOSYSTEM=.*|REACT_APP_DEFAULT_ECOSYSTEM=$ecosystem_name|" ./oid4vci-demo-frontend/.env.local | ||
|
||
mkdir -p ./oid4vp-demo-frontend | ||
cp ../../../packages/oid4vp-demo-frontend/.env.example ./oid4vp-demo-frontend/.env.local | ||
sed -i "s|^REACT_APP_BACKEND_BASE_URI=.*|REACT_APP_BACKEND_BASE_URI=${agent_host_address}|" ./oid4vp-demo-frontend/.env.local | ||
|
||
# change the urls in vci frontend configs | ||
cp "../../../packages/oid4vci-demo-frontend/src/configs/${ecosystem_name}.json" ./oid4vci-demo-frontend/conf | ||
config_file="./oid4vci-demo-frontend/conf/${ecosystem_name}.json" | ||
if [ -f "$config_file" ]; then | ||
new_oid4vp_agent_base_url="${agent_host_address}" | ||
new_oid4vci_agent_base_url="${agent_host_address}" | ||
|
||
jq --arg oid4vp "$new_oid4vp_agent_base_url" --arg oid4vci "$new_oid4vci_agent_base_url" \ | ||
'.general.oid4vpAgentBaseUrl = $oid4vp | .general.oid4vciAgentBaseUrl = $oid4vci' \ | ||
"$config_file" > temp.json && mv temp.json "$config_file" | ||
else | ||
echo "Config file not found: ${config_file}" | ||
fi | ||
|
||
src_dir="../../../packages/agent/conf/demos/${ecosystem_name}" | ||
dest_dir="./agent/conf" | ||
mkdir -p $dest_dir/${ecosystem_name} | ||
|
||
# Check if the source directory exists (because we might have different names for our config here) | ||
if [ ! -d "$src_dir" ]; then | ||
# If the exact match doesn't exist, find the first directory containing the environment name | ||
src_dir=$(find ../../../../packages/agent/conf/demos -type d -name "*${ecosystem_name}*" | head -n 1) | ||
fi | ||
# Copy the found dir to destination | ||
cp -r "$src_dir" "$dest_dir" | ||
|
||
# modify the values in the destination folder | ||
find "$dest_dir" -type f -name '*.json' | while read json_file; do | ||
jq --arg newUrl "$new_oid4vci_agent_base_url" \ | ||
'( | ||
if .metadata then .metadata.credential_issuer = $newUrl else . end | ||
) | | ||
( | ||
if .metadata then .metadata.credential_endpoint = ($newUrl + "/credentials") else . end | ||
)' \ | ||
"$json_file" > temp.json && mv temp.json "$json_file" | ||
done | ||
|
||
oid4vci_metadata_folder="${dest_dir}/oid4vci_metadata" | ||
if [ -d "$oid4vci_metadata_folder" ]; then | ||
find "$oid4vci_metadata_folder" -type f -name '*.json' | while read json_file; do | ||
jq --arg newUrl "$new_oid4vci_agent_base_url" \ | ||
'if .metadata then .metadata |= (.credential_issuer = $newUrl, .credential_endpoint = ($newUrl + "/credentials")) else . end' \ | ||
"$json_file" > temp.json && mv temp.json "$json_file" | ||
done | ||
fi | ||
|
||
simplified_dest_dir=$dest_dir | ||
|
||
# Loop to remove each occurrence of '../' from the beginning of simplified_dest_dir | ||
while [[ $simplified_dest_dir == ../* ]]; do | ||
simplified_dest_dir=${simplified_dest_dir#../} | ||
done | ||
echo "Configuration installation complete for environment ${ecosystem_name} in docker/compose/build" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.