Moving php and go into separate dirs, moving scripts into a central dir, updating files as necessary

This commit is contained in:
Finley Ghosh 2025-11-23 12:30:24 +11:00
parent 702186000d
commit 88ffe7bcd9
2723 changed files with 1138 additions and 271 deletions

View file

@ -6,8 +6,8 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
CMC Sales is a B2B sales management system for CMC Technologies. The codebase consists of:
- **Legacy CakePHP 1.2.5 application** (2008-era) - Primary business logic
- **Modern Go API** (in `/go-app/`) - New development using sqlc and Gorilla Mux
- **Legacy CakePHP 1.2.5 application** (in `/php/`) - Primary business logic
- **Modern Go API** (in `/go/`) - New development using sqlc and Gorilla Mux
**Note**: Documentation also references a Django application that is not present in the current codebase.
@ -42,7 +42,7 @@ gunzip < backups/backup_*.sql.gz | mariadb -h 127.0.0.1 -u cmc -p cmc
### Go Application Development
```bash
# Navigate to Go app directory
cd go-app
cd go
# Configure private module access (first time only)
go env -w GOPRIVATE=code.springupsoftware.com
@ -80,7 +80,7 @@ make build
### Go Application (Modern)
- **Framework**: Gorilla Mux (HTTP router)
- **Database**: sqlc for type-safe SQL queries
- **Location**: `/go-app/`
- **Location**: `/go/`
- **Structure**:
- `cmd/server/` - Main application entry point
- `internal/cmc/handlers/` - HTTP request handlers

View file

@ -2,9 +2,9 @@ FROM golang:1.24-alpine AS builder
RUN apk add --no-cache git
WORKDIR /app
COPY go-app/go.mod go-app/go.sum ./
COPY go/go.mod go/go.sum ./
RUN go mod download
COPY go-app/ .
COPY go/ .
RUN go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
RUN sqlc generate
RUN go mod tidy
@ -16,8 +16,8 @@ RUN apk --no-cache add ca-certificates tzdata
WORKDIR /root/
COPY --from=builder /app/server .
COPY --from=builder /app/vault .
COPY go-app/templates ./templates
COPY go-app/static ./static
COPY go-app/.env.example .env
COPY go/templates ./templates
COPY go/static ./static
COPY go/.env.example .env
EXPOSE 8082
CMD ["./server"]

View file

@ -35,8 +35,8 @@ RUN chmod +x /bin/ripmime \
&& a2enmod headers
# Copy site into place.
ADD . /var/www/cmc-sales
ADD app/config/database.php /var/www/cmc-sales/app/config/database.php
ADD php/ /var/www/cmc-sales
ADD php/app/config/database.php /var/www/cmc-sales/app/config/database.php
RUN mkdir /var/www/cmc-sales/app/tmp
RUN mkdir /var/www/cmc-sales/app/tmp/logs
RUN chmod -R 755 /var/www/cmc-sales/app/tmp

View file

@ -2,9 +2,9 @@ FROM golang:1.24-alpine AS builder
RUN apk add --no-cache git
WORKDIR /app
COPY go-app/go.mod go-app/go.sum ./
COPY go/go.mod go/go.sum ./
RUN go mod download
COPY go-app/ .
COPY go/ .
RUN go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
RUN sqlc generate
RUN go mod tidy
@ -14,8 +14,8 @@ FROM alpine:latest
RUN apk --no-cache add ca-certificates tzdata
WORKDIR /root/
COPY --from=builder /app/server .
COPY go-app/templates ./templates
COPY go-app/static ./static
COPY go-app/.env.example .env
COPY go/templates ./templates
COPY go/static ./static
COPY go/.env.example .env
EXPOSE 8082
CMD ["./server"]

View file

@ -54,8 +54,8 @@ RUN chmod +x /bin/ripmime \
&& a2enmod headers
# Copy site into place.
ADD . /var/www/cmc-sales
ADD app/config/database_stg.php /var/www/cmc-sales/app/config/database.php
ADD php/ /var/www/cmc-sales
ADD php/app/config/database_stg.php /var/www/cmc-sales/app/config/database.php
RUN mkdir -p /var/www/cmc-sales/app/tmp
RUN mkdir -p /var/www/cmc-sales/app/tmp/logs
RUN chmod -R 755 /var/www/cmc-sales/app/tmp

View file

@ -22,24 +22,24 @@ services:
depends_on:
- db
volumes:
- ./app/webroot/pdf:/var/www/cmc-sales/app/webroot/pdf
- ./app/webroot/attachments_files:/var/www/cmc-sales/app/webroot/attachments_files
- ./php/app/webroot/pdf:/var/www/cmc-sales/app/webroot/pdf
- ./php/app/webroot/attachments_files:/var/www/cmc-sales/app/webroot/attachments_files
networks:
- cmc-network
restart: unless-stopped
develop:
watch:
- action: rebuild
path: ./app
path: ./php/app
ignore:
- ./app/webroot/pdf
- ./app/webroot/attachments_files
- ./app/tmp
- ./php/app/webroot/pdf
- ./php/app/webroot/attachments_files
- ./php/app/tmp
- action: sync
path: ./app/webroot/css
path: ./php/app/webroot/css
target: /var/www/cmc-sales/app/webroot/css
- action: sync
path: ./app/webroot/js
path: ./php/app/webroot/js
target: /var/www/cmc-sales/app/webroot/js
db:
@ -75,9 +75,9 @@ services:
ports:
- "8080:8080"
volumes:
- ./go-app:/app
- ./go-app/.air.toml:/root/.air.toml
- ./go-app/.env.example:/root/.env
- ./go:/app
- ./go/.air.toml:/root/.air.toml
- ./go/.env.example:/root/.env
networks:
- cmc-network
restart: unless-stopped

View file

View file

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Some files were not shown because too many files have changed in this diff Show more