Skip to content
This repository was archived by the owner on Nov 21, 2025. It is now read-only.
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
48 changes: 48 additions & 0 deletions .github/workflows/code-quality-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Code Quality Check

on:
push:
branches: [ main ]
pull_request:

env:
FLAKE8_VERSION: 3.9.2
BLACK_VERSION: 21.8b0

jobs:
format:
name: Format and Lint Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.6
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Cache python environment
id: cache-env
uses: actions/cache@v2
with:
path: env
key: ${{ runner.os }}-format-lint-${{ env.FLAKE8_VERSION }}-${{ env.BLACK_VERSION }}-${{ hashFiles('.github/workflows/code-quality-check.yml') }}
- name: create virtual environment
if: steps.cache-env.outputs.cache-hit != 'true'
run: |
python -m venv env
- name: Install dependencies
if: steps.cache-env.outputs.cache-hit != 'true'
run: |
env/bin/python -m pip install black==${{ env.BLACK_VERSION }}
env/bin/python -m pip install flake8==${{ env.FLAKE8_VERSION }}
- name: Black Format Check
run: |
env/bin/python -m black --check acapy_cache_redis int/tests
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
env/bin/python -m flake8 . --exclude=env --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
env/bin/python -m flake8 . --exclude=env --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
26 changes: 26 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Tests
on:
push:
branches: [ main ]
pull_request:

env:
POETRY_VERSION: 1.1.7

jobs:
int:
name: Integration Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run integration tests
run: |
docker-compose -f ./int/docker-compose.yml run tests
- name: Print logs on failure
if: failure()
run: |
docker-compose -f ./int/docker-compose.yml logs
- name: Clean up integration tests
if: always()
run: |
docker-compose -f ./int/docker-compose.yml down
28 changes: 17 additions & 11 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,42 @@ services:
ports:
- 4040:4040
agent:
image: bcgovimages/aries-cloudagent:py36-1.16-1_0.7.3
#build:
# context: ..
# dockerfile: ./docker/Dockerfile
image: acapy-cache-redis
build:
context: ./
dockerfile: ./docker/Dockerfile
depends_on:
redis:
redis-host:
condition: service_healthy
links:
- redis-host
- reverse-proxy
ports:
- 3000:3000
- 3001:3001
volumes:
- ./acapy-endpoint.sh:/acapy-endpoint.sh:ro,z
- ./acapy_cache_redis:/home/indy/acapy_cache_redis:ro,z
- ./docker/default.yml:/home/indy/default.yml:ro,z
environment:
TUNNEL_ENDPOINT: http://tunnel:4040
entrypoint: >
/bin/sh -c '/acapy-endpoint.sh aca-py "$$@"' --
/bin/sh -c '/acapy-endpoint.sh poetry run 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"
AGENT_HTTP: "agent:3000"
AGENT_WS: "agent:3002"
ports:
- 80:80
#volumes:
# - ./mediator.conf.template:/etc/nginx/templates/default.conf.template:z
volumes:
- ./nginx.conf.template:/etc/nginx/templates/default.conf.template:z

redis:
redis-host:
image: "redis:alpine"
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
Expand Down
24 changes: 24 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM bcgovimages/von-image:py36-1.16-1

USER root
ENV POETRY_HOME=/opt/poetry \
VENV=/usr/src/app/.venv
ENV PATH="$POETRY_HOME/bin:$VENV/bin:$PATH"

RUN curl -sSL https://install.python-poetry.org | python -
USER indy
RUN poetry config virtualenvs.create true; poetry config virtualenvs.in-project true

RUN mkdir acapy_cache_redis && touch acapy_cache_redis/__init__.py
COPY --chown=indy:indy README.md setup.py pyproject.toml poetry.lock ./

RUN poetry install --no-dev

# Make site packages location more accessible (for use with volumes)
RUN ln -s $(poetry env info -p)/lib/python3.6/site-packages site-packages

COPY --chown=indy:indy docker/default.yml .
COPY --chown=indy:indy acapy_cache_redis/ acapy_cache_redis/

ENTRYPOINT ["/bin/bash", "-c", "poetry run aca-py \"$@\"", "--"]
CMD ["start", "--arg-file", "default.yml"]
7 changes: 5 additions & 2 deletions docker/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ plugin:
# Transport
inbound-transport:
- [http, 0.0.0.0, 3000]
- [ws, 0.0.0.0, 3002]
outbound-transport: http
endpoint:
- http://localhost:3000
- http://agent:3000
- ws://agent:3002

# Ledger
no-ledger: true
Expand All @@ -28,7 +30,8 @@ connections-invite: true
log-level: debug

plugin-config-value:
- redis_cache.connection="redis://redis:6379/0"
- redis_cache.connection="redis://redis-host:6379/0"
- redis_cache.max_connections=90
# - redis_cache.credentials.username="username"
# - redis_cache.credentials.password="password"
# - redis_cache.ssl.cacerts=./ca.crt
16 changes: 16 additions & 0 deletions int/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM python:3.7
WORKDIR /usr/src/app/
RUN pip3 install --no-cache-dir poetry

# Add docker-compose-wait tool
ENV WAIT_VERSION 2.7.2
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/$WAIT_VERSION/wait /wait
RUN chmod +x /wait

COPY pyproject.toml .
COPY poetry.lock .
RUN poetry install --no-dev

COPY tests/* tests/

ENTRYPOINT ["/bin/sh", "-c", "/wait && poetry run pytest \"$@\"", "--"]
58 changes: 58 additions & 0 deletions int/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
version: "3"
services:
agent:
image: acapy-cache-redis
build:
context: ../
dockerfile: ./docker/Dockerfile
depends_on:
redis-host:
condition: service_healthy
# volumes:
# - ./acapy-endpoint.sh:/acapy-endpoint.sh:ro,z
# - ./acapy_cache_redis:/home/indy/acapy_cache_redis:ro,z
# - ./docker/default.yml:/home/indy/default.yml:ro,z
command: >
start -it http 0.0.0.0 3000
-ot http
-e http://agent:3000
--admin 0.0.0.0 3001 --admin-insecure-mode
--no-ledger
--plugin acapy_cache_redis.v0_1
--plugin-config-value redis_cache.connection="redis://redis-host:6379/0"
--log-level debug

redis-host:
image: "redis:alpine"
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
ports:
- "6379:6379"
# volumes:
# - ./redis-data:/var/lib/redis
# - ./redis.conf:/etc/redis/redis.conf:ro,z
environment:
- REDIS_REPLICATION_MODE=master

echo:
image: dbluhm/echo-agent:6c22a88
ports:
- "3002:3002"
command: --host 0.0.0.0 --port 3002 --log-level debug

tests:
container_name: juggernaut
build:
context: .
environment:
- WAIT_BEFORE_HOSTS=3
- WAIT_HOSTS=agent:3000,echo:3002
- WAIT_HOSTS_TIMEOUT=60
- WAIT_SLEEP_INTERVAL=1
- WAIT_HOST_CONNECT_TIMEOUT=30
- AGENT_ENDPOINT=http://agent:3000
- ADMIN_ENDPOINT=http://agent:3001
- ECHO_ENDPOINT=http://echo:3002
depends_on:
- agent
- echo
Loading