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: 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 - **Legacy CakePHP 1.2.5 application** (in `/php/`) - Primary business logic
- **Modern Go API** (in `/go-app/`) - New development using sqlc and Gorilla Mux - **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. **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 ### Go Application Development
```bash ```bash
# Navigate to Go app directory # Navigate to Go app directory
cd go-app cd go
# Configure private module access (first time only) # Configure private module access (first time only)
go env -w GOPRIVATE=code.springupsoftware.com go env -w GOPRIVATE=code.springupsoftware.com
@ -80,7 +80,7 @@ make build
### Go Application (Modern) ### Go Application (Modern)
- **Framework**: Gorilla Mux (HTTP router) - **Framework**: Gorilla Mux (HTTP router)
- **Database**: sqlc for type-safe SQL queries - **Database**: sqlc for type-safe SQL queries
- **Location**: `/go-app/` - **Location**: `/go/`
- **Structure**: - **Structure**:
- `cmd/server/` - Main application entry point - `cmd/server/` - Main application entry point
- `internal/cmc/handlers/` - HTTP request handlers - `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 RUN apk add --no-cache git
WORKDIR /app WORKDIR /app
COPY go-app/go.mod go-app/go.sum ./ COPY go/go.mod go/go.sum ./
RUN go mod download RUN go mod download
COPY go-app/ . COPY go/ .
RUN go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest RUN go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
RUN sqlc generate RUN sqlc generate
RUN go mod tidy RUN go mod tidy
@ -16,8 +16,8 @@ RUN apk --no-cache add ca-certificates tzdata
WORKDIR /root/ WORKDIR /root/
COPY --from=builder /app/server . COPY --from=builder /app/server .
COPY --from=builder /app/vault . COPY --from=builder /app/vault .
COPY go-app/templates ./templates COPY go/templates ./templates
COPY go-app/static ./static COPY go/static ./static
COPY go-app/.env.example .env COPY go/.env.example .env
EXPOSE 8082 EXPOSE 8082
CMD ["./server"] CMD ["./server"]

View file

@ -35,8 +35,8 @@ RUN chmod +x /bin/ripmime \
&& a2enmod headers && a2enmod headers
# Copy site into place. # Copy site into place.
ADD . /var/www/cmc-sales ADD php/ /var/www/cmc-sales
ADD app/config/database.php /var/www/cmc-sales/app/config/database.php 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
RUN mkdir /var/www/cmc-sales/app/tmp/logs RUN mkdir /var/www/cmc-sales/app/tmp/logs
RUN chmod -R 755 /var/www/cmc-sales/app/tmp 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 RUN apk add --no-cache git
WORKDIR /app WORKDIR /app
COPY go-app/go.mod go-app/go.sum ./ COPY go/go.mod go/go.sum ./
RUN go mod download RUN go mod download
COPY go-app/ . COPY go/ .
RUN go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest RUN go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
RUN sqlc generate RUN sqlc generate
RUN go mod tidy RUN go mod tidy
@ -14,8 +14,8 @@ FROM alpine:latest
RUN apk --no-cache add ca-certificates tzdata RUN apk --no-cache add ca-certificates tzdata
WORKDIR /root/ WORKDIR /root/
COPY --from=builder /app/server . COPY --from=builder /app/server .
COPY go-app/templates ./templates COPY go/templates ./templates
COPY go-app/static ./static COPY go/static ./static
COPY go-app/.env.example .env COPY go/.env.example .env
EXPOSE 8082 EXPOSE 8082
CMD ["./server"] CMD ["./server"]

View file

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

View file

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