Skip to content

yojimat/alura-challenge-backend-3

Repository files navigation

Alura Challenge Backend 3

How to set up

Programs

-- Visual Studio
-- SQL Server Express

Databases

-- Create two Databases, 'Transaction' and 'Identity',one for the Transactions and another for Identity Core Framework;

Application

  • Start dotnet user-secrets init;

  • Configure secrets.json with the connection strings and put the credentials of an email, to be used in SmtpClient, keys:

    • SQLServerExpressLocal
    • SQLServerExpressLocalIdentity
    • EmailRegisterUser
    • PasswordRegisterUser
  • Or set the connections string in appsettings.development.json;

Docker

Compose

  • Enter the root of project directory
  • To run just the application in windows powershell:
    • First create a certificate in windows:
dotnet dev-certs https -ep $env:USERPROFILE\.aspnet\https\aspnetapp.pfx -p <password>
dotnet dev-certs https --trust
  • Build the image docker build -t alurachallengebackend3:<env_name> .;
  • Inside the project directory use docker compose -f docker-compose.yaml up;

Application

  • Enter the root of project directory
  • To run just the application in windows powershell:
    • First create a certificate in windows:
     dotnet dev-certs https -ep $env:USERPROFILE\.aspnet\https\aspnetapp.pfx -p <password>
     dotnet dev-certs https --trust
    • Build the image docker build -t alurachallengebackend3:<env_name> .;
    • Then the docker command:
     docker run -it --rm -p <port_number>:80 -p <port_number>:443 `
     	-e ASPNETCORE_HTTPS_PORT=<port_number> ` 
     	-e ASPNETCORE_Kestrel__Certificates__Default__Path=/root/.aspnet/https/aspnetapp.pfx `
     	-e ASPNETCORE_Kestrel__Certificates__Default__Password=<password> `
     	-e ASPNETCORE_ENVIRONMENT=<env_name> `
     	-v $env:USERPROFILE\.aspnet\https:/root/.aspnet/https/:ro `
     	--name alurachallengebackend3-<env_shortname> alurachallengebackend3:<env_shortname>;

SQL Server

  • To run just the SQL server use:
    docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=yourStrong(!)Password" -e "MSSQL_PID=Express" -v db-data:/home/vntcyj/docker-projects/databases/alura-challenge-backend-3 -p 1433:1433 -d mcr.microsoft.com/mssql/server:2019-latest;

Tests to Do

  • Deleting a user, and test if still shows in the transactions lists;