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

Chore/local backbone for tests #125

Closed
Closed
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
124 changes: 124 additions & 0 deletions .dev/appsettings.override.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{
"Cors": {
"AccessControlAllowCredentials": true
},
"Authentication": {
"ApiKey": "test"
},
"Infrastructure": {
"EventBus": {
"Vendor": "RabbitMQ",
"ConnectionInfo": "rabbitmq",
"RabbitMQUsername": "guest",
"RabbitMQPassword": "guest",
"ConnectionRetryCount": 5
},
"SqlDatabase": {
"Provider": "Postgres",
"ConnectionString": "User Id=adminUi;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;"
}
},
"Modules": {
"Challenges": {
"Infrastructure": {
"SqlDatabase": {
"Provider": "Postgres",
"ConnectionString": "User ID=challenges;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;"
}
}
},
"Quotas": {
"Infrastructure": {
"SqlDatabase": {
"Provider": "Postgres",
"ConnectionString": "User ID=quotas;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;"
}
}
},
"Devices": {
"Infrastructure": {
"SqlDatabase": {
"Provider": "Postgres",
"ConnectionString": "User ID=devices;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;"
},
"PushNotifications": {
"Provider": "Dummy"
}
}
},
"Files": {
"Infrastructure": {
"SqlDatabase": {
"Provider": "Postgres",
"ConnectionString": "User ID=files;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;"
},
"BlobStorage": {
"CloudProvider": "Azure",
"ConnectionInfo": "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite:10000/devstoreaccount1;"
}
}
},
"Messages": {
"Infrastructure": {
"SqlDatabase": {
"Provider": "Postgres",
"ConnectionString": "User ID=messages;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;"
},
"BlobStorage": {
"CloudProvider": "Azure",
"ConnectionInfo": "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite:10000/devstoreaccount1;"
}
}
},
"Relationships": {
"Infrastructure": {
"SqlDatabase": {
"Provider": "Postgres",
"ConnectionString": "User ID=relationships;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;"
},
"BlobStorage": {
"CloudProvider": "Azure",
"ConnectionInfo": "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite:10000/devstoreaccount1;"
}
}
},
"Synchronization": {
"Infrastructure": {
"SqlDatabase": {
"Provider": "Postgres",
"ConnectionString": "User ID=synchronization;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;"
},
"BlobStorage": {
"CloudProvider": "Azure",
"ConnectionInfo": "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite:10000/devstoreaccount1;"
}
}
},
"Tokens": {
"Infrastructure": {
"SqlDatabase": {
"Provider": "Postgres",
"ConnectionString": "User ID=tokens;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;"
},
"BlobStorage": {
"CloudProvider": "Azure",
"ConnectionInfo": "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite:10000/devstoreaccount1;"
}
}
}
},
"Serilog": {
"MinimumLevel": {
"Default": "Debug"
},
"Enrich": ["FromLogContext", "WithProcessId", "WithThreadId"],
"WriteTo": [
{
"Name": "Console",
"Args": {
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff}|{Level} - CorrelationId:{CorrelationId} - RequestId:{RequestId} - RequestPath:{RequestPath}{NewLine} {SourceContext}{NewLine} {Message}{NewLine}{Exception}"
}
}
]
}
}
85 changes: 85 additions & 0 deletions .dev/compose.backbone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
services:
consumer-api:
image: ghcr.io/nmshd/backbone-consumer-api:v4.2.0
container_name: consumer-api
hostname: consumer-api
environment:
- ASPNETCORE_ENVIRONMENT=Development
ports:
- "8090:8080"
depends_on:
database:
condition: service_started
rabbitmq:
condition: service_started
seed-database:
condition: service_completed_successfully
azure-storage-emulator:
condition: service_started
configs:
- source: Config
target: app/appsettings.override.json

### infrastructure ###

database:
container_name: bkb-postgres
hostname: postgres
image: postgres
environment:
- POSTGRES_PASSWORD=Passw0rd
- POSTGRES_DB=enmeshed
ports:
- 5432:5432
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres"]
interval: 5s
timeout: 5s
retries: 5

azure-storage-emulator:
container_name: azure-storage-emulator
hostname: azurite
image: mcr.microsoft.com/azure-storage/azurite
command: azurite -d /data/debug.log -l /data --blobHost "0.0.0.0" --queueHost "0.0.0.0"
ports:
- "10000:10000"

rabbitmq:
container_name: bkb-rabbitmq
hostname: rabbitmq
image: rabbitmq:3.12.10-management-alpine
ports:
- "5672:5672"

### seeds ###

seed-database:
image: postgres
volumes:
- ./setup-postgres.sql:/app/setup-db/setup-postgres.sql
environment:
- PGPASSWORD=Passw0rd
command: psql -h postgres -U postgres -d enmeshed -f /app/setup-db/setup-postgres.sql
depends_on:
database:
condition: service_healthy

seed-client:
container_name: seed-client
image: ghcr.io/nmshd/backbone-admin-cli:v2.2.0
depends_on:
consumer-api:
condition: service_healthy
command: backbone client create --clientId test --clientSecret test --defaultTier Basic
environment:
Database__Provider: Postgres
Database__ConnectionString: "Server=postgres;Database=enmeshed;User Id=devices;Password=Passw0rd;Port=5432"

configs:
Config:
file: appsettings.override.json

networks:
default:
name: backbone
4 changes: 4 additions & 0 deletions .dev/scripts/testSetup.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
export DATABASE_CONNECTION_STRING="mongodb://localhost:27018/?readPreference=primary&appname=connector_test&ssl=false"
export NMSHD_TEST_BASEURL="http://localhost:8090"
export NMSHD_TEST_CLIENTID="test"
export NMSHD_TEST_CLIENTSECRET="test"

docker compose -p connector-tests -f test/compose.yml up -d mongo
docker compose -p connector-test-backbone -f .dev/compose.backbone.yml up -d
4 changes: 4 additions & 0 deletions .dev/scripts/testSetupFerret.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
export DATABASE_CONNECTION_STRING="mongodb://localhost:27019"
export NMSHD_TEST_BASEURL="http://localhost:8090"
export NMSHD_TEST_CLIENTID="test"
export NMSHD_TEST_CLIENTSECRET="test"

docker compose -p connector-tests -f test/compose.yml up -d ferret
docker compose -p connector-test-backbone -f .dev/compose.backbone.yml up -d
Loading
Loading