Hello World
Build Your First Application on Arch
Aspire
Set up an Aspire Solution
AppHost Setup
Create a new .NET Aspire AppHost project. Aspire orchestrates every service in the solution, so the entire Hello World environment starts with a single run.

Add the following code to AppHost.cs.
var builder = DistributedApplication.CreateBuilder(args); var sqlServer = builder.AddHelloWorldSqlServer(); builder.AddControlPanel(sqlServer); // builder.AddApplicationApi(sqlServer); // builder.AddProject("HelloWorld", "..\\..\\HelloWorld\\HelloWorld.csproj"); builder.Build().Run();
A working example can be seen here.
Database Setup
Add the following extension method to set up a Sql Server database on port 51000.
public static IResourceBuilder<SqlServerServerResource> AddHelloWorldSqlServer(this IDistributedApplicationBuilder builder) { var password = builder.AddParameter("password", "p@ssw0rd"); var sqlServer = builder.AddSqlServer("HelloWorld-SqlServer", password, 51000) .WithDataVolume("HelloWorld-SqlServer-Data") .WithEndpoint("tcp", e => { e.IsProxied = false; }); return sqlServer; }
See here for a working example.
Control Panel Setup
Add the following extension method to set up the Control Panel on port 50000. This pulls the Control Panel image from our Docker registry and runs it inside a container on your machine via Aspire.
public static void AddControlPanel(this IDistributedApplicationBuilder builder, IResourceBuilder<SqlServerServerResource> sqlServer) { var controlPanelDb = sqlServer.AddDatabase("ControlPanelDb"); builder.AddContainer("ControlPanel", "gitea.triunnialabs.com/triunnialabs/arch-control-panel", "0.0.22") .WithEndpoint(50000, 8080, isProxied: false, name: "http") .WithEndpoint("http", e => e.TargetHost = "0.0.0.0") .WithEnvironment("ControlPanel__DataPath", "/opt/triunnialabs/arch/controlpanel") .WithBindMount("..\\..\\..\\data\\ControlPanel", "/opt/triunnialabs/arch/controlpanel") .WithReference(controlPanelDb) .WaitFor(controlPanelDb); }
See here for a working example.
Register Hello World Application
Run the Aspire solution at this point to access the Control Panel at http://localhost:50000.

Set up the Control Panel's database with connection strings pointing to Aspire. You may need to use host.docker.internal instead of localhost.

Create the Hello World Application in the Control Panel.

Create the Application Api in the Hello World application and set it up per documentation.
Application Api Setup
Add the following extension method to set up the Application Api on port 50001. This pulls the Application Api image from our Docker registry and runs it inside a container on your machine via Aspire.

Work with the Control Panel to fill in the values for the environment variables. Uncomment the AddApplicationApi() line in AppHost.cs.
public static void AddApplicationApi(this IDistributedApplicationBuilder builder, IResourceBuilder<SqlServerServerResource> sqlServer) { var applicationApiDb = sqlServer.AddDatabase("ApplicationApiDb"); var applicationApi = builder.AddContainer("ApplicationApi", "gitea.triunnialabs.com/triunnialabs/arch-application-api", "0.9.8") .WithEndpoint(50001, 8080, isProxied: false, name: "http") .WithEndpoint("http", e => e.TargetHost = "0.0.0.0") // Obtain the values for these fields from the Control Panel .WithEnvironment("Microservice__Name", "") .WithEnvironment("Microservice__EnvelopePassword", "") .WithEnvironment("Microservice__EnableDiagnostics", "true") .WithEnvironment("Microservice__Application__Url", "") .WithEnvironment("Microservice__Application__ApplicationId", "") .WithEnvironment("Microservice__Application__ApiKey", "") .WithEnvironment("Microservice__Application__EnvelopePassword", "") .WithEnvironment("Microservice__ProtectedMemory__HmacSha512HashKey", "") .WithEnvironment("Microservice__ProtectedMemory__AesEncryptionPassword", "") .WithEnvironment("Microservice__ProtectedMemory__AesEncryptionSalt", "") .WithEnvironment("SqlServer__ConnectionString", "") .WithEnvironment("SqlServer__ReadOnlyConnectionString", "") .WithEnvironment("YubiHsm__ConnectorUrl", "") .WithEnvironment("Guardian__AccessToken", "") .WithEnvironment("Guardian__BootstrapKeyObjectId", "") // Api will write log and other files to this relatiove source folder .WithBindMount("..\\..\\..\\data\\ApplicationApi", "/opt/triunnialabs/arch/application-api") .WithReference(applicationApiDb) .WaitFor(applicationApiDb); }
See here for a working example. Other Api setups can be seen at the same link.
Health Check
Run a Health Check against the Application Api from the Control Panel to confirm it is running and reachable before proceeding.
Next Steps
When the Application Api is running Healthy proceed to the Development page to build your first Hello World app.
Tech Sovereignty
Arch
Company
About Contact