Getting local development running again

This commit is contained in:
Finley Ghosh 2025-12-03 22:21:12 +11:00
parent 9eb7747c45
commit 23853455f4
6 changed files with 32 additions and 76 deletions

4
.gitignore vendored
View file

@ -14,3 +14,7 @@ app/cake_eclipse_helper.php
app/webroot/pdf/* app/webroot/pdf/*
app/webroot/attachments_files/* app/webroot/attachments_files/*
backups/* backups/*
# Go binaries
go/server
go/vault

27
Dockerfile.local.go Normal file
View file

@ -0,0 +1,27 @@
FROM golang:1.24-alpine
WORKDIR /app
# Copy go.mod and go.sum first
COPY go/go.mod go/go.sum ./
# Download dependencies
RUN go mod download
# Install Air for hot reload (pinned to v1.52.3 for Go 1.24 compatibility)
RUN go install github.com/air-verse/air@v1.52.3
# Install sqlc for SQL code generation
RUN go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
# Copy source code
COPY go/ .
# Generate sqlc code
RUN sqlc generate
# Copy Air config
COPY go/.air.toml .air.toml
EXPOSE 8080
CMD ["air", "-c", ".air.toml"]

View file

@ -1,12 +0,0 @@
# Database configuration
DB_HOST=db
DB_PORT=3306
DB_USER=cmc
DB_PASSWORD=xVRQI&cA?7AU=hqJ!%au
DB_NAME=cmc
# Root database password (for dbshell-root)
DB_ROOT_PASSWORD=secureRootPassword
# Server configuration
PORT=8080

40
go/.gitignore vendored
View file

@ -1,40 +0,0 @@
# Binaries
bin/
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool
*.out
# Go vendor directory
vendor/
# Environment files
.env
# Generated sqlc files (optional - you may want to commit these)
# internal/cmc/db/*.go
# IDE specific files
.idea/
.vscode/
*.swp
*.swo
*~
# OS specific files
.DS_Store
Thumbs.db
# Goose database migration config
goose.env
# Gmail OAuth credentials - NEVER commit these!
credentials.json
token.json

View file

@ -1,23 +0,0 @@
# Dev Dockerfile for Go hot reload with Air and sqlc
FROM golang:1.24.0
WORKDIR /app
# Install Air for hot reload
RUN go install github.com/air-verse/air@latest
# Install sqlc for SQL code generation
RUN go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
# Copy source code
COPY go-app/ .
# Generate sqlc code
RUN sqlc generate
# Copy Air config
COPY go-app/.air.toml .air.toml
COPY go-app/.env.example .env
EXPOSE 8080
CMD ["air", "-c", ".air.toml"]

View file

@ -83,7 +83,7 @@ else
echo -e "${YELLOW}🏥 Checking service health...${NC}" echo -e "${YELLOW}🏥 Checking service health...${NC}"
# Check database # Check database
if docker compose exec -T db mysqladmin ping -h localhost -u cmc -p'xVRQI&cA?7AU=hqJ!%au' --silent; then if docker compose exec -T db mariadb-admin ping -h localhost -u cmc -p'xVRQI&cA?7AU=hqJ!%au' --silent; then
echo -e "${GREEN}✅ Database is ready${NC}" echo -e "${GREEN}✅ Database is ready${NC}"
else else
echo -e "${RED}❌ Database is not ready${NC}" echo -e "${RED}❌ Database is not ready${NC}"