Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • bad1/assignment2
1 result
Show changes
Commits on Source (4)
......@@ -15,9 +15,25 @@ dotnet ef database update
add seed data to seeder (optional)
To setup the dockerfile:
docker-compose up
Local development:
For the MongoDB
If you have no container run this in bash or your fav terminal:
docker run -d --name mongodb \
-p 27017:27017 \
-e MONGO_INITDB_DATABASE=AssignmentLoggingDB \
mongo
this profile has no user / pass so it fits the connstring in appsettings.
Then run a get experience query and the db should appear (see compass or other app)
Force reset db
dotnet ef database drop --force
dotnet ef database update
Docker deploy:
To setup the dockerfile:
docker-compose down -v
docker-compose up -d --build
{
"Serilog": {
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Warning",
"System": "Warning"
}
},
"WriteTo": [
{
"Name": "MongoDBBson",
"Args": {
"databaseUrl": "mongodb://localhost:27017/AssignmentLoggingDB?appName=MongoDB+Compass&directConnection=true&serverSelectionTimeoutMS=2000",
"collectionName": "logs",
"cappedMaxSizeMb": "50",
"cappedMaxDocuments": "1000"
}
}
],
"Enrich": ["FromLogContext"]
},
"AllowedHosts": "*"
}
......@@ -16,7 +16,7 @@
{
"Name": "MongoDBBson",
"Args": {
"databaseUrl": "mongodb://localhost:27017/AssignmentLoggingDB?appName=MongoDB+Compass&directConnection=true&serverSelectionTimeoutMS=2000",
"databaseUrl": "mongodb://mongo:27017/AssignmentLoggingDB?appName=MongoDB+Compass&directConnection=true&serverSelectionTimeoutMS=2000",
"collectionName": "logs",
"cappedMaxSizeMb": "50",
"cappedMaxDocuments": "1000"
......
# Please refer https://aka.ms/HTTPSinContainer on how to setup an https developer certificate for your ASP.NET Core service.
version: '3.8'
services:
......@@ -7,6 +5,7 @@ services:
image: api
depends_on:
- db-assignment2
- mongo
restart: always
build:
context: .
......@@ -14,19 +13,33 @@ services:
ports:
- 8888:8888
environment:
ASPNETCORE_ENVIRONMENT: 'Development'
ASPNETCORE_ENVIRONMENT: 'Production'
DATABASE_CONNECTION_STRING: 'Server=db-assignment2;Database=master;User=sa;Password=lukasIsaNoob!;TrustServerCertificate=True'
MONGO_CONNECTION_STRING: 'mongodb://mongo:27017/AssignmentLoggingDB?appName=MongoDB+Compass&directConnection=true&serverSelectionTimeoutMS=2000'
volumes:
- ~/.vsdbg:/remote_debugger:rw
db-assignment2:
image: mcr.microsoft.com/mssql/server
image: mcr.microsoft.com/mssql/server:2019-latest
user: root
volumes:
- api:/var/opt/mssql/data
environment:
SA_PASSWORD: "lukasIsaNoob!"
ACCEPT_EULA: "Y"
mongo:
image: mongo
restart: always
ports:
- 27017:27017
volumes:
- mongo-data:/data/db
environment:
MONGO_INITDB_DATABASE: AssignmentLoggingDB
volumes:
api:
name: db-assignment2
mongo-data:
name: mongo-data