This project was created with Craftsman.
- Run
docker-compose up --build
from your.sln
directory to spin up your database(s) and other supporting infrastructure depending on your configuration (e.g. RabbitMQ, Keycloak, Jaeger, etc.). - If using a Keycloak auth server, you'll need to configure it manually (new realm, client, etc) or use the scaffolded Pulumi setup.
- Install the pulumi CLI
cd
to your scaffolded Pulumi project- Run
pulumi up
to start the scaffolding process - Create a new stack by pressing
Enter
when prompted and then typing the name of the stack (e.g.dev
). Alternatively you can use thepulumi stack init
command to make a new stack first.Note: The stack name must match the extension on your yaml config file (e.g.
Pulumi.dev.yaml
) would have a stack ofdev
. - Select yes to apply the configuration to your local Keycloak instance.
- If running a BFF:
- Make sure you have
yarn
installed - Run the project with
dotnet run
or your IDE
- Make sure you have
Once you have your database(s) running, you can run your API(s), BFF, and Auth Servers by using
the dotnet run
command or running your project(s) from your IDE of choice.
Migrations should be applied for you automatically on startup, but if you have any any issues, you can do the following:
1. Make sure you have a migrations in your boundary project (there should be a Migrations
directory in the project directory).
If there isn't see Running Migrations below.
2. Confirm your environment (ASPNETCORE_ENVIRONMENT
) is set to Development
using
$Env:ASPNETCORE_ENVIRONMENT = "Development"
for powershell or export ASPNETCORE_ENVIRONMENT=Development
for bash.
3. cd
to the boundary project root (e.g. cd RecipeManagement/src/RecipeManagement
)
4. Run your project and your migrations should be applied automatically. Alternatively, you can run dotnet ef database update
to apply your migrations manually.
> You can also stay in the `sln` root and run something like `dotnet ef database update --project RecipeManagement/src/RecipeManagement`
To run integration tests:
- Ensure that you have docker installed.
- Go to your src directory for the bounded context that you want to test.
- Confirm that you have migrations in your infrastructure project. If you need to add them, see the instructions below.
- Run the tests
⏳ If you don't have the database image pulled down to your machine, they will take some time on the first run.
- If your entity has foreign keys, you might need to adjust some of your tests after scaffolding to accomodate them.
To create a new migration, make sure your environment is set to Development
:
$Env:ASPNETCORE_ENVIRONMENT = "Development"
export ASPNETCORE_ENVIRONMENT=Development
Then run the following:
cd YourBoundedContextName/src/YourBoundedContextName
dotnet ef migrations add "MigrationDescription"
To apply your migrations to your local db, make sure your database is running in docker run the following:
cd YourBoundedContextName/src/YourBoundedContextName
dotnet ef database update