Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Adding localhost environment variable in run.sh script for local development #728

Merged
merged 3 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ jobs:
DEFAULT_WALLET_ENABLED: "false"
API_KEY_AUTO_PROVISIONING: "false"
API_KEY_ENABLED: "true"
DOCKERHOST: "host.docker.internal"
uses: isbang/[email protected]
with:
compose-file: "./infrastructure/shared/docker-compose-demo.yml"
Expand All @@ -85,6 +86,7 @@ jobs:
DEFAULT_WALLET_AUTH_API_KEY: default
API_KEY_AUTO_PROVISIONING: false
API_KEY_ENABLED: true
DOCKERHOST: "host.docker.internal"
uses: isbang/[email protected]
with:
compose-file: "./infrastructure/shared/docker-compose-demo.yml"
Expand Down
9 changes: 8 additions & 1 deletion infrastructure/local/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ while [[ $# -gt 0 ]]; do
WAIT="--wait"
shift # past argument
;;
-d | --dockerhost)
DOCKERHOST="$2"
shift # past argument
shift # past value
;;
-e | --env)
ENV_FILE="$2"
shift # past argument
Expand Down Expand Up @@ -96,13 +101,15 @@ NAME="${NAME:=local}"
PORT="${PORT:=80}"
ENV_FILE="${ENV_FILE:=${SCRIPT_DIR}/.env}"
NETWORK="${NETWORK:=${NAME}-prism}"
DOCKERHOST="${DOCKERHOST:=host.docker.internal}"

echo "NAME = ${NAME}"
echo "PORT = ${PORT}"
echo "ENV_FILE = ${ENV_FILE}"
echo "NETWORK = ${NETWORK}"
echo "GLOBAL_WEBHOOK_URL = ${GLOBAL_WEBHOOK_URL}"
echo "GLOBAL_WEBHOOK_API_KEY = ${GLOBAL_WEBHOOK_API_KEY}"
echo "DOCKERHOST = ${DOCKERHOST}"

echo "--------------------------------------"
echo "Starting stack using docker compose"
Expand All @@ -116,7 +123,7 @@ if [ -n "$GLOBAL_WEBHOOK_API_KEY" ]; then
export GLOBAL_WEBHOOK_API_KEY=${GLOBAL_WEBHOOK_API_KEY}
fi

PORT=${PORT} NETWORK=${NETWORK} docker compose \
PORT=${PORT} NETWORK=${NETWORK} DOCKERHOST=${DOCKERHOST} docker compose \
-p ${NAME} \
-f ${SCRIPT_DIR}/../shared/docker-compose.yml \
--env-file ${ENV_FILE} ${DEBUG} up ${BACKGROUND} ${WAIT}
3 changes: 3 additions & 0 deletions infrastructure/shared/apisix/conf/apisix.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins:
- name: proxy-rewrite
- name: cors

routes:
- uri: /prism-agent/*
Expand All @@ -15,6 +16,8 @@ routes:
- uri: /didcomm*
upstream_id: 3
plugins:
cors:
allow_origins: "*"
proxy-rewrite:
regex_uri: ["^/didcomm(.*)", "/$1"]
- uri: /apidocs/*
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/shared/docker-compose-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ services:
prism-agent:
image: ghcr.io/input-output-hk/prism-agent:${PRISM_AGENT_VERSION}
environment:
DIDCOMM_SERVICE_URL: http://host.docker.internal:${PORT}/didcomm
DIDCOMM_SERVICE_URL: http://${DOCKERHOST}:${PORT}/didcomm
PRISM_NODE_HOST: prism-node
PRISM_NODE_PORT: 50053
SECRET_STORAGE_BACKEND: postgres
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/shared/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ services:
AGENT_DB_NAME: agent
AGENT_DB_USER: postgres
AGENT_DB_PASSWORD: postgres
DIDCOMM_SERVICE_URL: http://host.docker.internal:${PORT}/didcomm
DIDCOMM_SERVICE_URL: http://${DOCKERHOST}:${PORT}/didcomm
PRISM_NODE_HOST: prism-node
PRISM_NODE_PORT: 50053
VAULT_ADDR: ${VAULT_ADDR:-http://vault-server:8200}
Expand Down