Skip to content

Commit

Permalink
chore: Docker compose seperate services and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
nklomp committed Jun 27, 2023
1 parent fa7e208 commit a8fb6c0
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 20,739 deletions.
13 changes: 13 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# dependencies
/node_modules
onto-demo-client/node_modules
siopv2-openid4vp-demo-backend/node_modules
onto-demo-shared-types/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ The most prominent low-level libraries are:
## Wallet Prerequisites

You will need an OID4VC capable wallet, that supports SIOPv2, OID4VP, OID4VCI and Presentation Exchange. You can use our
Open-Source wallet from the stores. See https://github.com/Sphereon-OpenSource/ssi-mobile-wallet
Open-Source wallet from the stores. See our wallet [Github](https://github.com/Sphereon-OpenSource/ssi-mobile-wallet) or
our [Wallet demo instructions](https://sphereon.com/sphereon-products/sphereon-wallet/sphereon-wallet-demo-instructions/)

## Issuer demo

If you run `pnpm run start:dev` the Issuer frontend, the verifier frontend and the agent will be started. Your browser
should automatically
open https://localhost:5001. You can also go to https://ssi.sphereon.com/demo/issuer, for an online hosted
demo. https://ssi.dutchblockchaincoalition.org/demo/issuer hosts a different integration/use case.
demo. https://ssi.dutchblockchaincoalition.org/demo/issuer hosts a different integration/use case you can test with.

You should be greeted with the introduction screen

Expand Down Expand Up @@ -155,20 +156,20 @@ and https://localhost:5002 for the verifier

Once the demo site has loaded, you should see the following screen:

#### Docker
### Docker

From the root folder run:

```bash
docker build -t sphereon-oid4vci-demo .
docker run -it -p 5000:5000 -p 5001:5001 -p 5002:5002 sphereon-oid4vci-demo
docker-compose build
docker-compose up
```

### Docker compose
The build phase might take a few minutes. If you run the docker-compose up command 3 services will be running. The ssi-agent, oid4vci-demo-frontend and oid4vp-frontend.

From the root folder run:
You should now be able to go to http://localhost:5001 and http://localhost:5002 respectively to test the issuer and verifier demo's.

```bash
docker-compose up
```
#### Environment variables and configuration for docker.
Please note that the environment variables for the 3 images come from the ./docker folder. You will have to copy the 3 example files and remove the .example suffix.

The configuration files are copied over to the agent image. So the above explained configuration options also apply when running in docker.
35 changes: 30 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,37 @@
version: '3.8'

services:
ssi-backend:
ssi-agent:
container_name: ssi-agent
env_file:
- ./docker/.env.ssi-agent
tty: true
build:
context: ./
dockerfile: ./Dockerfile
dockerfile: ./docker/Dockerfile.ssi-agent
ports:
- 5001:5001
- 5002:5002
- 3000:3000
- "5000:5000"
oid4vci-demo-frontend:
container_name: oid4vci-demo-frontend
env_file:
- ./docker/.env.oid4vci-demo-frontend
depends_on:
- ssi-agent
tty: true
build:
context: ./
dockerfile: ./docker/Dockerfile.oid4vci-demo-frontend
ports:
- "5001:5001"
oid4vp-demo-frontend:
container_name: oid4vp-demo-frontend
env_file:
- ./docker/.env.oid4vp-demo-frontend
depends_on:
- ssi-agent
tty: true
build:
context: ./
dockerfile: ./docker/Dockerfile.oid4vp-demo-frontend
ports:
- "5002:5002"
5 changes: 5 additions & 0 deletions docker/.env.oid4vci-demo-frontend
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
REACT_APP_OID4VP_AGENT_BASE_URL=http://ssi-agent:5000
REACT_APP_OID4VP_PRESENTATION_DEF_ID=sphereon
REACT_APP_OID4VCI_AGENT_BASE_URL='http://ssi-agent:5000/sphereon2023'
REACT_APP_ENVIRONMENT=sphereon
PORT=5001
5 changes: 5 additions & 0 deletions docker/.env.oid4vp-demo-frontend
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
NODE_ENV=development
PORT=5002
REACT_APP_QR_CODE_EXPIRES_AFTER_SEC=300
REACT_APP_PRESENTATION_DEF_ID=sphereon2023
REACT_APP_BACKEND_BASE_URI=http://ssi-agent:5000
13 changes: 13 additions & 0 deletions docker/.env.ssi-agent
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
NODE_ENV=development
HOSTNAME=0.0.0.0
PORT=5000
COOKIE_SIGNING_KEY=8E5er6YyAO6dIrDTm7BXYWsafBSLxzjb
DB_CONNECTION_NAME=default
DB_SQLITE_FILE="database/agent_default.sqlite"
DB_ENCRYPTION_KEY=29739248cad1bd1a0fc4d9b75cd4d2990de535baf5caadfdf8d8f86664aa830c
OID4VP_ENABLED="true"
OID4VP_WEBAPP_BASE_URI=http://oid4vp-demo-frontend:5000
OID4VP_AGENT_BASE_URI=http://oid4vp-demo-frontend:5000
AUTH_REQUEST_EXPIRES_AFTER_SEC=180
CONF_PATH="./conf"
UNIVERSAL_RESOLVER_RESOLVE_URL="https://dev.uniresolver.io/1.0/identifiers"
10 changes: 4 additions & 6 deletions Dockerfile → docker/Dockerfile.oid4vci-demo-frontend
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
FROM node:16-bullseye
FROM node:lts-bullseye
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 /usr/src/app
WORKDIR /opt/oid4vci-demo-frontend

COPY . .
COPY ./packages/oid4vci-demo-frontend .
RUN pnpm install -r
RUN rm -rf node_modules/.pnpm/[email protected]
RUN rm -rf packages/agent/node_modules/.pnpm/[email protected]
RUN pnpm build
WORKDIR /usr/src/app/packages/agent
WORKDIR /opt/oid4vci-demo-frontend
ENTRYPOINT ["pnpm", "start:prod"]
11 changes: 11 additions & 0 deletions docker/Dockerfile.oid4vp-demo-frontend
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:lts-bullseye
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/oid4vp-demo-frontend

COPY ./packages/oid4vp-demo-frontend .
RUN pnpm install -r
RUN pnpm build
WORKDIR /opt/oid4vp-demo-frontend
ENTRYPOINT ["pnpm", "start:prod"]
14 changes: 14 additions & 0 deletions docker/Dockerfile.ssi-agent
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:lts-bullseye
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/ssi-agent

COPY ./ .
RUN pnpm install -r
RUN pnpm build
RUN cd /opt/ssi-agent/packages/agent
RUN ls -al

WORKDIR /opt/ssi-agent/packages/agent
ENTRYPOINT ["pnpm", "start:prod"]
2 changes: 1 addition & 1 deletion packages/agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"scripts": {
"build": "tsc",
"build:clean": "tsc --build --clean && tsc --build",
"start:prod": "ts-node-esm dist/index.js",
"start:prod": "node --experimental-specifier-resolution=node --loader dist/index.js",
"start:dev": "node --experimental-specifier-resolution=node --loader ts-node/esm src/agent.ts"
},
"keywords": [],
Expand Down
Loading

0 comments on commit a8fb6c0

Please sign in to comment.