.Net Core 2.2, PostgreSql, Amazon S3, Xunit, Docker
This project aims to create a document repository to save files on Amazon S3 or shared disk space or inmemory
- .Net Core
- PostgreSql
- Jwt authentication
- Xunit
- Fluent Assertions
- Moq
- MiniCover
- ElasticSearch + Kibana
- .Net Core >= 2.2
- Docker
To start the application in development mode, run:
dotnet build
cd src\DocumentRepositoryApi
dotnet run
Application will be served on route: http://localhost:5000
To start the application in docker container:
docker-compose up
Docker will spin up application, postgreSql container and PgAdmin to manage database
Swagger documentation will be available on route:
http://localhost:5000/swagger
To run integration tests:
dotnet test ./tests/DocumentRepositoryApi.IntegrationTests/DocumentRepositoryApi.IntegrationTests.csproj
To run unit tests:
dotnet test ./tests/DocumentRepositoryApi.UnitTests/DocumentRepositoryApi.UnitTests.csproj
To run unit and integration tests with script:
scripts/tests.sh
scripts/coverage.sh
Coverage file can be found in coverage-html/index.html file
Keys and the secrets are defined in user secret file. More information can be found .net core user secrets This application uses "8c43a081-db6b-43eb-8376-df1651b2d72a" as secret key id.
Application uses PostgreSql to store user information and document metadata (name, title and version). Connection string needs to be defined in user secret
ConnectionStrings": {
"PostgreSql": "Your connection string"
},
AmazonS3 should be selected as datasource in appsettings:
"Repository": {
"Provider": "amazons3storage"
}
Amazon S3 credential informations should be defined in user secret
"AWS": {
"BucketName": "Your Bucket Name",
"Region": "Region Name",
"Credentials":{
"AccessKey" :"XXXX",
"SecretKey": "XXXX"
}
}
"Repository": {
"Provider": "inmemorystorage"
}
appsettings:
"Repository": {
"Provider": "filestorage"
}
user secret:
"DocumentApi": {
"ContentPath": "shared file storage path"
}
user secret:
"Encryption": {
"Key": "Base64 key"
}
user secret:
"Jwt": {
"Secret": "this is my custom Secret key for authnetication"
}
To use default console logging appsettings.json:
"Logging": {
"LogLevel": {
"Default": "Warning"
},
"Provider": {
"Type": "0", //// 0:default,1:ELC+Kibana
}
},
To use elastic search + kibana
cmd > cd DocumentRepositoryApi
cmd > docker-compose -f docker-compose.elastic.yml up
appsettings.json:
"Logging": {
"LogLevel": {
"Default": "Warning"
},
"Provider": {
"Type": "1", //// 0:default,1:ELC+Kibana,
"Uri": "http://localhost:9200"
}
},