Skip to content

Commit

Permalink
feat(rest): add docker and postgres sample
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <timo@animo.id>
  • Loading branch information
TimoGlastra committed Mar 31, 2024
1 parent ee41acc commit 0a2d557
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 3 deletions.
4 changes: 1 addition & 3 deletions packages/rest/samples/cliConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
],
"cheqdLedger": [
{
"network": "mainnet",
"cosmosPayerSeed": "bird cage swing"
"network": "mainnet"
},
{
"network": "testnet"
Expand All @@ -43,7 +42,6 @@
"outboundTransport": ["http", "ws"],
"autoAcceptMediationRequests": false,
"connectionImageUrl": "https://image.com/image.png",
"webhookUrl": "https://my-webhook-server",
"adminPort": 3000,
"multiTenant": true
}
47 changes: 47 additions & 0 deletions packages/rest/samples/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
version: '3.8'

volumes:
postgres:

services:
credo:
image: ghcr.io/openwallet-foundation/credo-rest:0.10.0
depends_on:
- postgres
ports:
# Admin API
- 3000:3000

# DIDComm
- 5000:5000
- 5001:5001

# Use the local config file in the container
volumes:
- ./cliConfig.json:/cliConfig.json
command: ['--config', '/cliConfig.json']

# This dynamically loads the wallet id, wallet key and agent endpoint (so you can use ngrok)
# you also want to dynamically inject postgres connection details in prod
env_file:
- path: docker.env.local
required: true

environment:
# Configure credo to use postgres as storage
CREDO_REST_POSTGRES_HOST: postgres:5432
CREDO_REST_POSTGRES_USERNAME: postgres
CREDO_REST_POSTGRES_PASSWORD: postgres
CREDO_REST_STORAGE_TYPE: postgres

# Postgres (when deploying you probably want to use a managed service for this)
postgres:
image: postgres:15-alpine
ports:
- '5432:5432'
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DATABASE: postgres
volumes:
- postgres:/var/lib/postgresql/data
11 changes: 11 additions & 0 deletions packages/rest/samples/docker.env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CREDO_REST_WALLET_ID=your_wallet_id
CREDO_REST_WALLET_KEY=your_wallet_key

# You can use ngrok (ngrok http 3001) to expose your local server to the internet
# and interact with Paradym and other agents.
# CREDO_REST_ENDPOINT=https://d297-217-123-18-26.ngrok-free.app
CREDO_REST_ENDPOINT=http://localhost:5001

# You can configure credo to send webhooks to your server
# Or, during development e.g. use https://rbaskets.in/web
# CREDO_REST_WEBHOOK_URL=https://webhook.site/fbcd1feb-da81-447b-8888-e34cad509143

0 comments on commit 0a2d557

Please sign in to comment.