-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from Indicio-tech/feat/mediator-demo
feat: mediator configuration
- Loading branch information
Showing
5 changed files
with
75 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,28 @@ | ||
FROM bcgovimages/von-image:py36-1.16-1 | ||
FROM bcgovimages/von-image:py36-1.16-1 AS base | ||
|
||
# Install and configure poetry | ||
USER root | ||
ENV POETRY_HOME=/opt/poetry \ | ||
VENV=/usr/src/app/.venv | ||
ENV PATH="$POETRY_HOME/bin:$VENV/bin:$PATH" | ||
|
||
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python - | ||
RUN poetry config virtualenvs.create true; poetry config virtualenvs.in-project true | ||
ENV POETRY_VERSION=1.1.11 | ||
ENV POETRY_HOME=/opt/poetry | ||
RUN curl -sSL https://install.python-poetry.org | python - | ||
|
||
RUN mkdir acapy_plugin_pickup && touch acapy_plugin_pickup/__init__.py | ||
COPY README.md setup.py pyproject.toml poetry.lock ./ | ||
ENV PATH="/opt/poetry/bin:$PATH" | ||
RUN poetry config virtualenvs.in-project true | ||
|
||
# Setup project | ||
RUN mkdir acapy_plugin_pickup && touch acapy_plugin_pickup/__init__.py | ||
COPY pyproject.toml poetry.lock README.md ./ | ||
RUN poetry install --no-dev -E indy | ||
USER $user | ||
|
||
# Make site packages location more accessible (for use with volumes) | ||
RUN ln -s $(poetry env info -p)/lib/python3.6/site-packages site-packages | ||
FROM bcgovimages/von-image:py36-1.16-1 | ||
COPY --from=base /home/indy/.venv /home/indy/.venv | ||
ENV PATH="/home/indy/.venv/bin:$PATH" | ||
EXPOSE 80 | ||
|
||
COPY docker/default.yml . | ||
COPY acapy_plugin_pickup/ acapy_plugin_pickup/ | ||
|
||
ENTRYPOINT ["/bin/bash", "-c", "poetry run aca-py \"$@\"", "--"] | ||
ENTRYPOINT ["/bin/bash", "-c", "aca-py \"$@\"", "--"] | ||
CMD ["start", "--arg-file", "default.yml"] |
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,14 @@ | ||
#!/bin/bash | ||
|
||
TUNNEL_ENDPOINT=${TUNNEL_ENDPOINT:-http://tunnel:4040} | ||
|
||
while [[ "$(curl -s -o /dev/null -w '%{http_code}' "${TUNNEL_ENDPOINT}/status")" != "200" ]]; do | ||
echo "Waiting for tunnel..." | ||
sleep 1 | ||
done | ||
ACAPY_ENDPOINT=$(curl --silent "${TUNNEL_ENDPOINT}/start" | python -c "import sys, json; print(json.load(sys.stdin)['url'])") | ||
echo "fetched end point [$ACAPY_ENDPOINT]" | ||
|
||
export ACAPY_ENDPOINT="[$ACAPY_ENDPOINT, ${ACAPY_ENDPOINT/http/ws}/ws]" | ||
#export ACAPY_ENDPOINT="$ACAPY_ENDPOINT" | ||
exec "$@" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
version: "3" | ||
services: | ||
tunnel: | ||
image: dbluhm/agent-tunnel | ||
command: -s reverse-proxy:80 -p 4040 -h ${AGENT_TUNNEL_HOST} | ||
ports: | ||
- 4040:4040 | ||
agent: | ||
image: acapy-pickup-mediator | ||
build: | ||
context: .. | ||
dockerfile: ./docker/Dockerfile | ||
volumes: | ||
- ./acapy-endpoint.sh:/acapy-endpoint.sh:ro,z | ||
environment: | ||
TUNNEL_ENDPOINT: http://tunnel:4040 | ||
entrypoint: > | ||
/bin/sh -c '/acapy-endpoint.sh aca-py "$$@"' -- | ||
command: > | ||
start --arg-file default.yml | ||
reverse-proxy: | ||
image: nginx:alpine | ||
restart: unless-stopped | ||
environment: | ||
AGENT_HTTP: "http://agent:3000" | ||
AGENT_WS: "http://agent:3002" | ||
ports: | ||
- 80:80 | ||
volumes: | ||
- ./mediator.conf.template:/etc/nginx/templates/default.conf.template:z |
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,15 @@ | ||
server { | ||
client_max_body_size 10M; | ||
listen 80; | ||
|
||
location / { | ||
proxy_pass ${AGENT_HTTP}; | ||
} | ||
|
||
location /ws { | ||
proxy_pass ${AGENT_WS}/; | ||
proxy_http_version 1.1; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "upgrade"; | ||
} | ||
} |