-
Notifications
You must be signed in to change notification settings - Fork 517
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial version of a scenario test with restart
Signed-off-by: Ian Costanzo <ian@anon-solutions.ca>
- Loading branch information
Showing
4 changed files
with
1,011 additions
and
575 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 |
---|---|---|
@@ -0,0 +1,150 @@ | ||
services: | ||
wallet-db: | ||
image: postgres:12 | ||
environment: | ||
- POSTGRES_USER=DB_USER | ||
- POSTGRES_PASSWORD=DB_PASSWORD | ||
ports: | ||
- 5433:5432 | ||
volumes: | ||
- wallet-db-data:/var/lib/pgsql/data | ||
|
||
alice: | ||
image: bcgovimages/aries-cloudagent:py3.12_1.0.1 | ||
ports: | ||
- "3001:3001" | ||
environment: | ||
RUST_LOG: 'aries-askar::log::target=error' | ||
command: > | ||
start | ||
--label Alice | ||
--inbound-transport http 0.0.0.0 3000 | ||
--outbound-transport http | ||
--endpoint http://alice:3000 | ||
--admin 0.0.0.0 3001 | ||
--admin-insecure-mode | ||
--tails-server-base-url http://tails:6543 | ||
--genesis-url http://test.bcovrin.vonx.io/genesis | ||
--wallet-type askar | ||
--wallet-name alice | ||
--wallet-key insecure | ||
--wallet-storage-type "postgres_storage" | ||
--wallet-storage-config "{\"url\":\"wallet-db:5432\",\"max_connections\":5}" | ||
--wallet-storage-creds "{\"account\":\"DB_USER\",\"password\":\"DB_PASSWORD\",\"admin_account\":\"DB_USER\",\"admin_password\":\"DB_PASSWORD\"}" | ||
--auto-provision | ||
--log-level debug | ||
--debug-webhooks | ||
healthcheck: | ||
test: curl -s -o /dev/null -w '%{http_code}' "http://localhost:3001/status/live" | grep "200" > /dev/null | ||
start_period: 30s | ||
interval: 7s | ||
timeout: 5s | ||
retries: 5 | ||
depends_on: | ||
tails: | ||
condition: service_started | ||
|
||
alice-upgrade: | ||
image: acapy-test | ||
profiles: ["upgrade-test"] | ||
ports: | ||
- "3001:3001" | ||
environment: | ||
RUST_LOG: 'aries-askar::log::target=error' | ||
command: > | ||
start | ||
--label Alice | ||
--inbound-transport http 0.0.0.0 3000 | ||
--outbound-transport http | ||
--endpoint http://alice:3000 | ||
--admin 0.0.0.0 3001 | ||
--admin-insecure-mode | ||
--tails-server-base-url http://tails:6543 | ||
--genesis-url http://test.bcovrin.vonx.io/genesis | ||
--wallet-type askar | ||
--wallet-name alice | ||
--wallet-key insecure | ||
--wallet-storage-type "postgres_storage" | ||
--wallet-storage-config "{\"url\":\"wallet-db:5432\",\"max_connections\":5}" | ||
--wallet-storage-creds "{\"account\":\"DB_USER\",\"password\":\"DB_PASSWORD\",\"admin_account\":\"DB_USER\",\"admin_password\":\"DB_PASSWORD\"}" | ||
--auto-provision | ||
--log-level debug | ||
--debug-webhooks | ||
healthcheck: | ||
test: curl -s -o /dev/null -w '%{http_code}' "http://localhost:3001/status/live" | grep "200" > /dev/null | ||
start_period: 30s | ||
interval: 7s | ||
timeout: 5s | ||
retries: 5 | ||
depends_on: | ||
tails: | ||
condition: service_started | ||
|
||
bob: | ||
image: acapy-test | ||
ports: | ||
- "3002:3001" | ||
environment: | ||
RUST_LOG: 'aries-askar::log::target=error' | ||
command: > | ||
start | ||
--label Bob | ||
--inbound-transport http 0.0.0.0 3000 | ||
--outbound-transport http | ||
--endpoint http://bob:3000 | ||
--admin 0.0.0.0 3001 | ||
--admin-insecure-mode | ||
--tails-server-base-url http://tails:6543 | ||
--genesis-url http://test.bcovrin.vonx.io/genesis | ||
--wallet-type askar | ||
--wallet-name bob | ||
--wallet-key insecure | ||
--wallet-storage-type "postgres_storage" | ||
--wallet-storage-config "{\"url\":\"wallet-db:5432\",\"max_connections\":5}" | ||
--wallet-storage-creds "{\"account\":\"DB_USER\",\"password\":\"DB_PASSWORD\",\"admin_account\":\"DB_USER\",\"admin_password\":\"DB_PASSWORD\"}" | ||
--auto-provision | ||
--log-level debug | ||
--debug-webhooks | ||
--monitor-revocation-notification | ||
healthcheck: | ||
test: curl -s -o /dev/null -w '%{http_code}' "http://localhost:3001/status/live" | grep "200" > /dev/null | ||
start_period: 30s | ||
interval: 7s | ||
timeout: 5s | ||
retries: 5 | ||
|
||
tails: | ||
image: ghcr.io/bcgov/tails-server:latest | ||
ports: | ||
- 6543:6543 | ||
environment: | ||
- GENESIS_URL=http://test.bcovrin.vonx.io/genesis | ||
command: > | ||
tails-server | ||
--host 0.0.0.0 | ||
--port 6543 | ||
--storage-path /tmp/tails-files | ||
--log-level INFO | ||
example: | ||
container_name: controller | ||
privileged: true | ||
build: | ||
context: ../.. | ||
environment: | ||
- DOCKER_HOST=unix:///var/run/docker.sock | ||
- ALICE=http://alice:3001 | ||
- ALICE_UPGRADE=http://alice-upgrade:3001 | ||
- BOB=http://bob:3001 | ||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
- ./example.py:/usr/src/app/example.py:ro,z | ||
command: python -m example | ||
depends_on: | ||
alice: | ||
condition: service_healthy | ||
bob: | ||
condition: service_healthy | ||
|
||
volumes: | ||
wallet-db-data: |
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,41 @@ | ||
"""Minimal reproducible example script. | ||
This script is for you to use to reproduce a bug or demonstrate a feature. | ||
""" | ||
|
||
import asyncio | ||
from os import getenv | ||
|
||
import docker | ||
|
||
from acapy_controller import Controller | ||
from acapy_controller.logging import logging_to_stdout | ||
from acapy_controller.protocols import connection, didexchange | ||
|
||
ALICE = getenv("ALICE", "http://alice:3001") | ||
BOB = getenv("BOB", "http://bob:3001") | ||
|
||
|
||
async def main(): | ||
"""Test Controller protocols.""" | ||
async with Controller(base_url=ALICE) as alice, Controller(base_url=BOB) as bob: | ||
await connection(alice, bob) | ||
await didexchange(alice, bob) | ||
|
||
# play with docker | ||
client = docker.from_env() | ||
containers = client.containers.list(all=True) | ||
docker_containers = {} | ||
for container in containers: | ||
container_name = container.attrs['Config']['Labels']['com.docker.compose.service'] | ||
container_id = container.attrs['Id'] | ||
container_is_running = container.attrs['State']['Running'] | ||
docker_containers[container_name] = {'Id': container_id, 'Running': container_is_running} | ||
print(">>> container:", container_name, docker_containers[container_name]) | ||
|
||
# try to restart a container (stop alice and start alice-upgrade) | ||
|
||
|
||
if __name__ == "__main__": | ||
logging_to_stdout() | ||
asyncio.run(main()) |
Oops, something went wrong.