To run this application locally it is recommended to have the following installed:
- docker
- docker-compose
- powershell
- dotnet sdk
- entity framework tools
Firstly there is a need to configure environment variables:
- Copy
.env.example
as.env
and populate the environment variables. - Copy
appsettings.json
asappsettings.Development.json
and populate the variables.
Next install dev-certs to use https in powershell
dotnet dev-certs https -ep ".aspnet\https\aspnetapp.pfx" -p devcertpasswd --trust
or in bash/zsh
dotnet dev-certs https -ep .aspnet/https/aspnetapp.pfx -p devcertpasswd --trust
Database migrations will be automatically applied when executing docker-compose via the migrations
service.
Next You should go back to the main directory and run docker compose --profile hot-reload up --build --watch
You can now visit the site at: http://localhost:8888/
Directory scripts
contains some helpful scripts which automate some parts of working with this directory.
The application is started using the following command (with hot-reload feature):
make
or without the hot-reload feature:
make no-reload
If you want to run the application manually you can use the following command:
docker compose --profile hot-reload up --build --watch
or without the hot-reload feature:
docker compose --profile without-hot-reload up --build --watch
The --watch
parameter starts containers with the hot-reload
feature. This enables the auto-reload functionality, meaning that the container will be automatically reloaded when the code for either the frontend or backend changes.
The
hot-reload
feature for backend applications usesdotnet watch
, which only detects changes to existing files. It will not restart the container if new files are added (dotnet watch issue).
When working with migrations remember to add parameter for project and startup project. For example when generating a new migration while in backend directory:
dotnet ef migrations add -p ./src/infrastructure -s ./src/api "Example"