6 Commits

Author SHA1 Message Date
a10f3ef0f5 feat-postgres (#1)
Some checks failed
CI / Linux Tests (push) Failing after 5m44s
Store timestamps as strings in the database to fix errors with postgres.

Reviewed-on: #1
Co-authored-by: Michael Housh <michael@mhoush.com>
Co-committed-by: Michael Housh <michael@mhoush.com>
2026-02-11 21:51:52 +00:00
e3a731e3fa fix: Fix gitea build & push image.
Some checks failed
CI / Linux Tests (push) Has been cancelled
2026-02-11 11:23:10 -05:00
8e66d57994 fix: Fix gitea build & push image.
Some checks failed
CI / Linux Tests (push) Has been cancelled
2026-02-11 11:03:53 -05:00
87c651eed9 fix: Fix gitea build & push image building mulitple images.
Some checks failed
CI / Linux Tests (push) Has been cancelled
2026-02-11 10:50:14 -05:00
e8ab85a189 fix: Fix gitea build & push image building mulitple images.
Some checks failed
CI / Linux Tests (push) Has been cancelled
2026-02-11 10:44:19 -05:00
1fcf331729 feat: Add image cache support to gitea workflow, for quicker image builds.
Some checks failed
CI / Linux Tests (push) Has been cancelled
2026-02-11 10:41:39 -05:00
14 changed files with 70 additions and 28 deletions

View File

@@ -9,7 +9,8 @@ on:
env:
REGISTRY: git.housh.dev
IMAGE_NAME: ductcalc
USERNAME: michael
IMAGE_NAME: ${{ gitea.repository }}
jobs:
build-and-push-image:
@@ -24,15 +25,18 @@ jobs:
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ gitea.actor }}
password: ${{ secrets.CONTAINER_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
@@ -45,12 +49,13 @@ jobs:
- name: Build and push Docker image
id: push
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:build
cache-to: mode=min,image-manifest=true,oci-mediatypes=true,type=inline,ref=${{ env.IMAGE_NAME }}:build

View File

@@ -9,7 +9,8 @@ on:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ductcalc
IMAGE_NAME: ${{ github.repository }}
USERNAME: m-housh
jobs:
build-and-push-image:
@@ -27,7 +28,7 @@ jobs:
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
username: ${{ env.USERNAME }}
password: ${{ secrets.CONTAINER_TOKEN }}
- name: Set up Docker
@@ -48,7 +49,7 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
images: ${{ env.REGISTRY }}/${{ env.USERNAME }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
@@ -67,4 +68,6 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.USERNAME }}/${{ env.IMAGE_NAME }}:buildcache
cache-to: mode=max,image-manifest=true,oci-mediatypes=true,type=registry,ref=${{ env.USERNAME }}/${{ env.IMAGE_NAME }}:build

View File

@@ -66,8 +66,8 @@ extension ComponentPressureLoss {
.id()
.field("name", .string, .required)
.field("value", .double, .required)
.field("createdAt", .datetime)
.field("updatedAt", .datetime)
.field("createdAt", .string)
.field("updatedAt", .string)
.field(
"projectID", .uuid, .required, .references(ProjectModel.schema, "id", onDelete: .cascade)
)

View File

@@ -73,8 +73,8 @@ extension EquipmentInfo {
.field("staticPressure", .double, .required)
.field("heatingCFM", .int16, .required)
.field("coolingCFM", .int16, .required)
.field("createdAt", .datetime)
.field("updatedAt", .datetime)
.field("createdAt", .string)
.field("updatedAt", .string)
.field(
"projectID", .uuid, .required, .references(ProjectModel.schema, "id", onDelete: .cascade)
)

View File

@@ -90,8 +90,8 @@ extension EquivalentLength {
.field("type", .string, .required)
.field("straightLengths", .array(of: .int))
.field("groups", .data)
.field("createdAt", .datetime)
.field("updatedAt", .datetime)
.field("createdAt", .string)
.field("updatedAt", .string)
.field(
"projectID", .uuid, .required, .references(ProjectModel.schema, "id", onDelete: .cascade)
)

View File

@@ -7,10 +7,10 @@ extension DatabaseClient.Migrations: DependencyKey {
public static let liveValue = Self(
all: {
[
Project.Migrate(),
User.Migrate(),
User.Token.Migrate(),
User.Profile.Migrate(),
Project.Migrate(),
ComponentPressureLoss.Migrate(),
EquipmentInfo.Migrate(),
Room.Migrate(),

View File

@@ -120,8 +120,8 @@ extension Project {
.field("state", .string, .required)
.field("zipCode", .string, .required)
.field("sensibleHeatRatio", .double)
.field("createdAt", .datetime)
.field("updatedAt", .datetime)
.field("createdAt", .string)
.field("updatedAt", .string)
.field("userID", .uuid, .required, .references(UserModel.schema, "id", onDelete: .cascade))
.unique(on: "userID", "name")
.create()

View File

@@ -197,8 +197,8 @@ extension Room {
.field("registerCount", .int8, .required)
.field("delegatedToID", .uuid, .references(RoomModel.schema, "id"))
.field("rectangularSizes", .array)
.field("createdAt", .datetime)
.field("updatedAt", .datetime)
.field("createdAt", .string)
.field("updatedAt", .string)
.field(
"projectID", .uuid, .required, .references(ProjectModel.schema, "id", onDelete: .cascade)
)

View File

@@ -81,8 +81,8 @@ extension User.Profile {
.field("zipCode", .string, .required)
.field("theme", .string)
.field("userID", .uuid, .references(UserModel.schema, "id", onDelete: .cascade))
.field("createdAt", .datetime)
.field("updatedAt", .datetime)
.field("createdAt", .string)
.field("updatedAt", .string)
.unique(on: "userID")
.create()
}

View File

@@ -76,8 +76,8 @@ extension User {
.id()
.field("email", .string, .required)
.field("password_hash", .string, .required)
.field("createdAt", .datetime)
.field("updatedAt", .datetime)
.field("createdAt", .string)
.field("updatedAt", .string)
.unique(on: "email")
.create()
}
@@ -97,8 +97,8 @@ extension User.Token {
.id()
.field("value", .string, .required)
.field("user_id", .uuid, .required, .references(UserModel.schema, "id"))
.field("createdAt", .datetime)
.field("updatedAt", .datetime)
.field("createdAt", .string)
.field("updatedAt", .string)
.unique(on: "value")
.create()
}

View File

@@ -63,7 +63,8 @@ struct HomeView: HTML, Sendable {
.class("btn btn-xl btn-primary mt-6"),
.hx.get(route: .signup(.index)),
.hx.target("body"),
.hx.swap(.outerHTML)
.hx.swap(.outerHTML),
.hx.pushURL(true)
) {
"Get Started"
}

View File

@@ -23,3 +23,4 @@
- [x] Privacy policy
- [ ] Update README
- [ ] Self hosting documentation
- [x] Check signup flow when using 'get-started' button from home page, it may need a push url.

31
docker-compose.yaml Normal file
View File

@@ -0,0 +1,31 @@
services:
db:
image: docker.io/postgres:18
restart: unless-stopped
env_file: .env
volumes:
- ./data:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ductcalc"]
interval: 5s
timeout: 5s
retries: 5
app:
build:
dockerfile: docker/Dockerfile
context: .
restart: unless-stopped
env_file: .env
environment:
- POSTGRES_HOSTNAME=db
depends_on:
db:
condition: healthy
ports:
- 8081:8080
healthcheck:
test: curl --fail --silent http://0.0.0.0:8080/health || exit 1
interval: 1m
timeout: 10s
retries: 3

View File

@@ -1,4 +1,3 @@
services:
db:
image: docker.io/postgres:18
@@ -8,7 +7,9 @@ services:
- ./data:/var/lib/postgresql
app:
image: ghcr.io/m-housh/ductcalc:latest
build:
dockerfile: docker/Dockerfile
context: .
restart: unless-stopped
env_file: .env
depends_on: