This project demonstrates how to configure a aspnet-core application by utilizing consul. Since I plan to integrate this feature into the ABP Framework, this solution is powered by ABP.
Considering you're in the repository root, just run the following commands:
-
Launch consul cluster
cd services/consul
docker compose up -d
-
Launch MySQL database
cd services/mysql
docker compose up -d
-
Create key in consul at http://localhost:8500/ui/dc1/kv.
If the web UI isn't available yet, just wait a few seconds until the cluster has been fully initialized.
- Add a new Key
MyKey
and add the following payload:
{ "Main": "Hello world from consul!" }
- Add a new Key
-
Start the project
- Open VisualStudio and launch
Neco.Abp.ConsulConfiguration.DbMigrator
and wait for the migrations to complete. - Switch the startup project to
Neco.Abp.ConsulConfiguration.Web
and select the kestrel profile. - Launch the web host; you should be greeted by
Hello world from consul!
- Open VisualStudio and launch
- Currently the application cannot be launched when consul isn't available.