OPC # 0003: Move Gitea out of OPC Aspire Orchestration

This commit is contained in:
amadzarak
2026-04-25 22:51:03 -04:00
parent 5009f6e688
commit 7e360749b9
4 changed files with 49 additions and 22 deletions
-22
View File
@@ -31,27 +31,6 @@ var cpPostgres = builder.AddPostgres("opc-postgres", password: cpPostgresPass
.WithPgAdmin();
var controlPlaneDb = cpPostgres.AddDatabase("opcdb");
var giteaDb = cpPostgres.AddDatabase("giteadb");
#endregion
#region GITEA
// Gitea is ControlPlane's code management component — owns its own DB on opc-postgres.
var gitea = builder.AddContainer("gitea", "gitea/gitea", "latest")
.WithHttpEndpoint(port: 3000, targetPort: 3000, name: "http")
.WithEndpoint(port: 2222, targetPort: 22, name: "ssh")
.WithVolume("clarity-gitea-data", "/data")
.WithEnvironment("GITEA__database__DB_TYPE", "postgres")
.WithEnvironment("GITEA__database__HOST", "host.docker.internal:5433")
.WithEnvironment("GITEA__database__NAME", "giteadb")
.WithEnvironment("GITEA__database__USER", "postgres")
.WithEnvironment("GITEA__database__PASSWD", "controlplane-dev")
.WithEnvironment("GITEA__server__DOMAIN", "opc.clarity.test")
.WithEnvironment("GITEA__server__ROOT_URL", "http://opc.clarity.test")
.WithEnvironment("GITEA__server__SSH_DOMAIN", "opc.clarity.test")
.WithEnvironment("GITEA__server__SSH_PORT", "2222")
.WithEnvironment("GITEA__service__DISABLE_REGISTRATION", "true")
.WaitFor(giteaDb)
.WithLifetime(ContainerLifetime.Persistent);
#endregion
#region RABBITMQ
@@ -67,7 +46,6 @@ var api = builder.AddProject<Projects.ControlPlane_Api>("controlplane-api")
.WaitFor(rabbit)
.WithReference(controlPlaneDb)
.WaitFor(controlPlaneDb)
.WithEnvironment("Gitea__BaseUrl", gitea.GetEndpoint("http"))
.WithEnvironment("ClientAssets__Folder", clientAssetsPath)
.WithEnvironment("Docker__RepoRoot", Path.GetFullPath(Path.Combine(builder.AppHostDirectory, "..", ".."))) // ClarityStack/ root — needed for Directory.*.props
.WithExternalHttpEndpoints();
+33
View File
@@ -20,6 +20,8 @@ networks:
volumes:
postgres-data:
minio-data:
clarity-gitea-data:
external: true
services:
@@ -154,6 +156,37 @@ services:
aliases:
- nginx
# ── Gitea ─────────────────────────────────────────────────────────────────
# Platform source control. Hosts OPC, Clarity, and Gateway repos.
# Accessible at https://opc.clarity.test (nginx terminates TLS).
gitea:
image: gitea/gitea:latest
container_name: clarity-gitea
restart: unless-stopped
ports:
- "3000:3000"
- "2222:22"
environment:
GITEA__database__DB_TYPE: postgres
GITEA__database__HOST: postgres:5432
GITEA__database__NAME: giteadb
GITEA__database__USER: postgres
GITEA__database__PASSWD: postgres
GITEA__server__DOMAIN: opc.clarity.test
GITEA__server__ROOT_URL: https://opc.clarity.test
GITEA__server__SSH_DOMAIN: opc.clarity.test
GITEA__server__SSH_PORT: "2222"
GITEA__service__DISABLE_REGISTRATION: "true"
volumes:
- clarity-gitea-data:/data
depends_on:
postgres:
condition: service_healthy
networks:
clarity-net:
aliases:
- gitea
# ── Dnsmasq ───────────────────────────────────────────────────────────────
# Resolves *.clarity.test → 127.0.0.1 so browser requests hit nginx on the host.
dnsmasq:
+15
View File
@@ -0,0 +1,15 @@
server {
listen 443 ssl;
server_name opc.clarity.test;
ssl_certificate /etc/nginx/certs/clarity.test.crt;
ssl_certificate_key /etc/nginx/certs/clarity.test.key;
location / {
proxy_pass http://gitea:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
+1
View File
@@ -7,3 +7,4 @@
-- clarity_{tenant} → Created at provisioning time by ControlPlane.Worker.
SELECT 'CREATE DATABASE keycloakdb' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'keycloakdb')\gexec
SELECT 'CREATE DATABASE giteadb' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'giteadb')\gexec