Skip to content

Commit

Permalink
VSCode debugging support (#278)
Browse files Browse the repository at this point in the history
* chore: add recommended extensions

* chore: add launch config for attaching

* chore: update entrypoint for Dockerfile.debug

* chore: switch to pgsql for local development

* chore: add task for docker compose up

* chore: rename launch configuration

* chore: move pg-admin dependency to postgres

* chore: remove unused reference

* fix: exclude obj and bin folders in mounting

* chore: make "start" task always build the compose stack

* chore: use postgres for local development

---------

Co-authored-by: tnotheis <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
3 people authored Oct 9, 2023
1 parent 5cf5764 commit 1fbd662
Showing 7 changed files with 89 additions and 57 deletions.
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["ms-azuretools.vscode-docker", "ms-dotnettools.csdevkit"]
}
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Consumer API (Docker)",
"type": "docker",
"request": "attach",
"platform": "netCore",
"sourceFileMap": {
"/app": "${workspaceFolder}"
},
"containerName": "consumerApi",
"processName": "ConsumerApi"
}
]
}
10 changes: 10 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "start",
"command": "docker",
"args": ["compose", "-f", "docker-compose/docker-compose.yml", "up", "--build", "--attach", "consumerApi"]
}
]
}
2 changes: 1 addition & 1 deletion ConsumerApi/Dockerfile.debug
Original file line number Diff line number Diff line change
@@ -3,4 +3,4 @@ EXPOSE 80

WORKDIR /app

ENTRYPOINT ["dotnet", "run", "--project", "ConsumerApi/ConsumerApi.csproj"]
ENTRYPOINT ["dotnet", "watch", "--non-interactive", "--project", "ConsumerApi/ConsumerApi.csproj"]
48 changes: 24 additions & 24 deletions ConsumerApi/appsettings.override.json
Original file line number Diff line number Diff line change
@@ -28,27 +28,27 @@
"Challenges": {
"Infrastructure": {
"SqlDatabase": {
"Provider": "SqlServer",
"ConnectionString": "Server=ms-sql-server;Database=enmeshed;User Id=challenges;Password=Passw0rd;TrustServerCertificate=True"
//"ConnectionString": "User ID=challenges;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;" // postgres
"Provider": "Postgres",
"ConnectionString": "User ID=challenges;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;" // postgres
// "ConnectionString": "Server=ms-sql-server;Database=enmeshed;User Id=challenges;Password=Passw0rd;TrustServerCertificate=True" // sqlserver
}
}
},
"Quotas": {
"Infrastructure": {
"SqlDatabase": {
"Provider": "SqlServer",
"ConnectionString": "Server=ms-sql-server;Database=enmeshed;User Id=quotas;Password=Passw0rd;TrustServerCertificate=True"
//"ConnectionString": "User ID=quotas;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;" // postgres
"Provider": "Postgres",
"ConnectionString": "User ID=quotas;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;" // postgres
// "ConnectionString": "Server=ms-sql-server;Database=enmeshed;User Id=quotas;Password=Passw0rd;TrustServerCertificate=True" // sqlserver
}
}
},
"Devices": {
"Infrastructure": {
"SqlDatabase": {
"Provider": "SqlServer",
"ConnectionString": "Server=ms-sql-server;Database=enmeshed;User Id=devices;Password=Passw0rd;TrustServerCertificate=True"
//"ConnectionString": "User ID=devices;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;" // postgres
"Provider": "Postgres",
"ConnectionString": "User ID=devices;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;" // postgres
// "ConnectionString": "Server=ms-sql-server;Database=enmeshed;User Id=devices;Password=Passw0rd;TrustServerCertificate=True" // sqlserver
},
"PushNotifications": {
"Provider": "Dummy"
@@ -58,9 +58,9 @@
"Files": {
"Infrastructure": {
"SqlDatabase": {
"Provider": "SqlServer",
"ConnectionString": "Server=ms-sql-server;Database=enmeshed;User Id=files;Password=Passw0rd;TrustServerCertificate=True"
//"ConnectionString": "User ID=files;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;" // postgres
"Provider": "Postgres",
"ConnectionString": "User ID=files;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;" // postgres
// "ConnectionString": "Server=ms-sql-server;Database=enmeshed;User Id=files;Password=Passw0rd;TrustServerCertificate=True" // sqlserver
},
"BlobStorage": {
"CloudProvider": "Azure",
@@ -72,9 +72,9 @@
"Messages": {
"Infrastructure": {
"SqlDatabase": {
"Provider": "SqlServer",
"ConnectionString": "Server=ms-sql-server;Database=enmeshed;User Id=messages;Password=Passw0rd;TrustServerCertificate=True"
//"ConnectionString": "User ID=messages;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;" // postgres
"Provider": "Postgres",
"ConnectionString": "User ID=messages;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;" // postgres
// "ConnectionString": "Server=ms-sql-server;Database=enmeshed;User Id=messages;Password=Passw0rd;TrustServerCertificate=True" // sqlserver
},
"BlobStorage": {
"CloudProvider": "Azure",
@@ -86,9 +86,9 @@
"Relationships": {
"Infrastructure": {
"SqlDatabase": {
"Provider": "SqlServer",
"ConnectionString": "Server=ms-sql-server;Database=enmeshed;User Id=relationships;Password=Passw0rd;TrustServerCertificate=True"
//"ConnectionString": "User ID=relationships;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;" // postgres
"Provider": "Postgres",
"ConnectionString": "User ID=relationships;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;" // postgres
// "ConnectionString": "Server=ms-sql-server;Database=enmeshed;User Id=relationships;Password=Passw0rd;TrustServerCertificate=True" // sqlserver
},
"BlobStorage": {
"CloudProvider": "Azure",
@@ -100,9 +100,9 @@
"Synchronization": {
"Infrastructure": {
"SqlDatabase": {
"Provider": "SqlServer",
"ConnectionString": "Server=ms-sql-server;Database=enmeshed;User Id=synchronization;Password=Passw0rd;TrustServerCertificate=True"
//"ConnectionString": "User ID=synchronization;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;" // postgres
"Provider": "Postgres",
"ConnectionString": "User ID=synchronization;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;" // postgres
// "ConnectionString": "Server=ms-sql-server;Database=enmeshed;User Id=synchronization;Password=Passw0rd;TrustServerCertificate=True" // sqlserver
},
"BlobStorage": {
"CloudProvider": "Azure",
@@ -114,9 +114,9 @@
"Tokens": {
"Infrastructure": {
"SqlDatabase": {
"Provider": "SqlServer",
"ConnectionString": "Server=ms-sql-server;Database=enmeshed;User Id=tokens;Password=Passw0rd;TrustServerCertificate=True"
//"ConnectionString": "User ID=tokens;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;" // postgres
"Provider": "Postgres",
"ConnectionString": "User ID=tokens;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;" // postgres
// "ConnectionString": "Server=ms-sql-server;Database=enmeshed;User Id=tokens;Password=Passw0rd;TrustServerCertificate=True" // sqlserver
},
"BlobStorage": {
"CloudProvider": "Azure",
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@
<PackageReference Include="AutoFixture" Version="4.18.0" />
<PackageReference Include="AutoFixture.Xunit2" Version="4.18.0" />
<PackageReference Include="FakeItEasy" Version="7.4.0" />
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.9" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="xunit" Version="2.5.1" />
66 changes: 35 additions & 31 deletions docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -21,14 +21,16 @@ services:
- Modules__Tokens__Infrastructure__BlobStorage__ConnectionInfo=${ENMESHED_BLOB_STORAGE_CONNECTION_STRING} # set this environment variable on your local system to an appropriate value (DefaultEndpointsProtocol=https;AccountName=<account-name>;AccountKey=<account-key>;EndpointSuffix=core.windows.net)

ports:
- "127.0.0.10:80:80"
- "5000:80"
- "8080:80"
depends_on:
- ms-sql-server
# - ms-sql-server
- rabbitmq
- azure-storage-emulator
- postgres
volumes:
- ../:/app
- /app/ConsumerApi/obj
- /app/ConsumerApi/bin

### infrastructure ###

@@ -42,38 +44,40 @@ services:
volumes:
- azure-storage-emulator-volume:/data

ms-sql-server:
container_name: bkb-mssql_server
hostname: ms-sql-server
image: mcr.microsoft.com/mssql/server:2019-latest
# ms-sql-server:
# container_name: bkb-mssql_server
# hostname: ms-sql-server
# image: mcr.microsoft.com/mssql/server:2019-latest
# environment:
# - MSSQL_SA_PASSWORD=Passw0rd
# - ACCEPT_EULA=Y
# - MSSQL_PID=Express
# volumes:
# - mssql-server-volume:/var/opt/mssql
# ports:
# - 1433:1433

postgres:
container_name: bkb-postgres
hostname: postgres
image: postgres
environment:
- MSSQL_SA_PASSWORD=Passw0rd
- ACCEPT_EULA=Y
- MSSQL_PID=Express
- POSTGRES_PASSWORD=admin
volumes:
- mssql-server-volume:/var/opt/mssql
- postgres-volume:/var/lib/postgresql/data
ports:
- 1433:1433

#postgres:
# container_name: bkb-postgres
# hostname: postgres
# image: postgres
# environment:
# - POSTGRES_PASSWORD=admin
# volumes:
# - postgres-volume:/var/lib/postgresql/data
# ports:
# - 5432:5432
- 5432:5432
depends_on:
- pg-admin

#pg-admin:
# container_name: bkb-pgadmin
# image: dpage/pgadmin4
# ports:
# - 85:80
# environment:
# - PGADMIN_DEFAULT_PASSWORD=admin
# - [email protected]
pg-admin:
container_name: bkb-pgadmin
image: dpage/pgadmin4
ports:
- 85:80
environment:
- PGADMIN_DEFAULT_PASSWORD=admin
- [email protected]

rabbitmq:
container_name: bkb-rabbitmq

0 comments on commit 1fbd662

Please sign in to comment.