Skip to content

Commit

Permalink
All services up and running
Browse files Browse the repository at this point in the history
  • Loading branch information
esune committed Feb 6, 2023
1 parent 98aa973 commit 0c4fa64
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 16 deletions.
6 changes: 3 additions & 3 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ services:
- DB_NAME=${MONGODB_NAME}
- OIDC_CONTROLLER_DB_USER=${OIDC_CONTROLLER_DB_USER}
- OIDC_CONTROLLER_DB_USER_PWD=${OIDC_CONTROLLER_DB_USER_PWD}
- ACAPY_ADMIN_URL=${AGENT_ADMIN_URL}
- CONTROLLER_URL=${CONTROLLER_URL}
- ACAPY_TENANCY=${AGENT_TENANT_MODE}
- ACAPY_AGENT_URL=${AGENT_ENDPOINT}
- ACAPY_ADMIN_URL=${AGENT_ADMIN_URL}
- MT_ACAPY_WALLET_ID=${MT_ACAPY_WALLET_ID}
- MT_ACAPY_WALLET_KEY=${MT_ACAPY_WALLET_KEY}
- ST_ACAPY_ADMIN_API_KEY=${AGENT_ADMIN_API_KEY}
- ST_ACAPY_ADMIN_API_KEY_NAME=${ST_ACAPY_ADMIN_API_KEY_NAME}
- ACAPY_NGROK_TUNNEL_HOST=${AGENT_NGROK_TUNNEL_HOST}
- CONTROLLER_NGROK=${CONTROLLER_NGROK}
ports:
- ${CONTROLLER_SERVICE_PORT}:5000
volumes:
Expand Down
42 changes: 29 additions & 13 deletions docker/manage
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,9 @@ EOF
# -----------------------------------------------------------------------------------------------------------------
# Default Settings:
# -----------------------------------------------------------------------------------------------------------------
DEFAULT_CONTAINERS="keycloak controller-db"
ACAPY_CONTAINERS="aca-py"
PROD_CONTAINERS="controller"
DEV_CONTAINERS=""
DEFAULT_CONTAINERS="keycloak keycloak-db controller-db"
ACAPY_CONTAINERS="aca-py wallet-db aca-py-ngrok"
PROD_CONTAINERS="controller controller-ngrok"

# -----------------------------------------------------------------------------------------------------------------
# Functions:
Expand Down Expand Up @@ -158,8 +157,8 @@ configureEnvironment() {

# agent
export AGENT_TENANT_MODE="${AGENT_TENANT_MODE:-single}"
export AGENT_HOST=${AGENT_HOST:-http://aca-py}
export AGENT_NGROK_TUNNEL_HOST="${AGENT_HOST}:4040"
export AGENT_HOST="http://aca-py"
export AGENT_NGROK_TUNNEL="http://aca-py-ngrok:4040"
export AGENT_NAME="VC-AuthN Agent"
export AGENT_HTTP_PORT="8030"
export AGENT_ADMIN_PORT=${AGENT_ADMIN_PORT:-"8077"}
Expand All @@ -170,6 +169,9 @@ configureEnvironment() {
if [ ! -z "${AGENT_ADMIN_API_KEY}" ]; then
AGENT_ADMIN_MODE="admin-api-key ${AGENT_ADMIN_API_KEY}"
fi
export AGENT_WALLET_SEED=${AGENT_WALLET_SEED}
export MT_ACAPY_WALLET_ID=${MT_ACAPY_WALLET_ID}
export MT_ACAPY_WALLET_KEY=${MT_ACAPY_WALLET_KEY}

# keycloak-db
export KEYCLOAK_DB_NAME="keycloak"
Expand All @@ -193,8 +195,6 @@ configureEnvironment() {
export POSTGRESQL_WALLET_DATABASE="wallet_db"
export POSTGRESQL_WALLET_USER="walletuser"
export POSTGRESQL_WALLET_PASSWORD="walletpassword"
export POSTGRESQL_WALLET_ADMIN_USER="postgres"
export POSTGRESQL_WALLET_ADMIN_PASSWORD="mysecretpassword"
}

getStartupParams() {
Expand Down Expand Up @@ -244,16 +244,13 @@ toLower() {
}

initializeUserPrompts() {
PS3="Is your agent single or multi tenant? "

PS3="Is your agent single-tenant or multi-tenant? "
select opt in "Single-Tenant" "Multi-Tenant/Traction" "Quit"; do

case $REPLY in
1)
echo "AGENT_TENANT_MODE=single" > .env
echo AGENT_WALLET_SEED=$(generateSeed vc-authn-oidc) >> .env
echo "AGENT_WALLET_SEED=$(generateSeed vc-authn-oidc)" >> .env
echo "ACAPY_HOST=http://aca-py" >> .env
echo
break
;;
2)
Expand All @@ -275,6 +272,11 @@ initializeUserPrompts() {
esac
done
}

setDefaultProofConfig() {
# post default proof-request configuration to controller
docker run --network=vc-authn_vc_auth --rm curlimages/curl:latest -X POST "http://controller:5000/api/vc-configs" -H "accept: application/json" -H "X-Api-Key: controller-api-key" -H "Content-Type: application/json-patch+json" -d "{ \"id\": \"test-request-config\", \"subject_identifier\": \"email\", \"configuration\": { \"name\": \"Basic Proof\", \"version\": \"1.0\", \"requested_attributes\": [ { \"name\": \"email\", \"restrictions\": [] }, { \"name\": \"first_name\", \"restrictions\": [] }, { \"name\": \"last_name\", \"restrictions\": [] } ], \"requested_predicates\": [] }}"
}
# =================================================================================================================

pushd ${SCRIPT_HOME} >/dev/null
Expand All @@ -288,10 +290,24 @@ start|up)
if [[ ! -f ".env" ]]; then
# first/clean run, prompt user selections
initializeUserPrompts
echoWarning "User preferences were saved in docker/.env for future use"
fi

configureEnvironment $@

# if [[ "$AGENT_TENANT_MODE" != "single" ]]; then
# # do not start agent services when using external multi-tenant instance
# unset ACAPY_CONTAINERS
# fi

docker-compose up -d ${_startupParams} ${DEFAULT_CONTAINERS} ${ACAPY_CONTAINERS} ${PROD_CONTAINERS}

# if [[ ! -f ".env" ]]; then
# # first/clean run, set default proof-configuration
# sleep 10
# setDefaultProofConfig
# fi

docker-compose logs -f
;;
logs)
Expand Down

0 comments on commit 0c4fa64

Please sign in to comment.