| app | ||
| archive | ||
| cake | ||
| conf | ||
| deploy | ||
| go-app | ||
| scripts | ||
| sql | ||
| vendors | ||
| .gitignore | ||
| .htaccess | ||
| CLAUDE.md | ||
| docker-compose.prod.yml | ||
| docker-compose.stg.yml | ||
| docker-compose.yml | ||
| Dockerfile.prod.db | ||
| Dockerfile.prod.go | ||
| Dockerfile.prod.php | ||
| Dockerfile.stg.db | ||
| Dockerfile.stg.go | ||
| Dockerfile.stg.php | ||
| index.php | ||
| README.md | ||
| stagingpasswd | ||
| start-development.sh | ||
| userpasswd | ||
cmc-sales
CMC Sales is a business management system with two applications:
- PHP Application: CakePHP 1.2.5 (currently the primary application)
- Go Application: Go + HTMX (used for select features, growing)
Future development should be done in the Go application wherever possible.
Architecture
Both applications:
- Share the same MariaDB database
- Run behind a shared Caddy reverse proxy with basic authentication
- Support staging and production environments on the same server
The PHP application currently handles most functionality, while the Go application is used for select screens and new features as they're developed.
Development Setup
Quick Start
git clone git@code.springupsoftware.com:cmc/cmc-sales.git
cd cmc-sales
# Easy way - use the setup script
./start-development.sh
# Manual way
rsync -avz --progress cmc@sales.cmctechnologies.com.au:~/backups .
docker compose up --build
gunzip < backups/backup_*.sql.gz | mariadb -h 127.0.0.1 -u cmc -p cmc
Access Applications
Add to /etc/hosts:
127.0.0.1 cmclocal
Application URLs:
- CakePHP (Legacy): http://cmclocal - Original CakePHP 1.2.5 application
- Go (Modern): http://localhost:8080 - New Go application with HTMX frontend
- Database: localhost:3306 (user:
cmc, password: seeapp/config/database.php)
Architecture
- cmc-php: Legacy CakePHP application (nginx proxied)
- cmc-go: Modern Go application (direct access on port 8080)
- db: Shared MariaDB database
- nginx: Reverse proxy for CakePHP app
Both applications share the same database, allowing for gradual migration.
Requirements
- Go Application: Requires Go 1.23+ (for latest sqlc)
- Alternative: Use
Dockerfile.go.legacywith Go 1.21 and sqlc v1.26.0
- Alternative: Use
Deployment
Prerequisites
The deployment scripts use SSH to connect to the server. Configure your SSH config (~/.ssh/config) with a host entry named cmc pointing to the correct server:
Host cmc
HostName node0.prd.springupsoftware.com
User cmc
IdentityFile ~/.ssh/cmc
Deployment Procedures
Deploy to staging or production using the scripts in the deploy/ directory:
Deploy to Staging:
./deploy/deploy-stg.sh
Deploy to Production:
./deploy/deploy-prod.sh
Rebuild without cache (useful after dependency changes):
./deploy/deploy-prod.sh --no-cache
./deploy/deploy-stg.sh --no-cache
How Deployment Works
- The deploy script connects to the server via the
cmcSSH host - Clones or updates the appropriate git branch (
stgorprod) - Creates environment configuration for the Go application
- Builds and starts Docker containers using the appropriate compose file
- Applications are accessible through Caddy reverse proxy with basic auth
Deployment Environments
- Staging: Branch
stg→ https://stg.cmctechnologies.com.au - Production: Branch
prod→ https://sales.cmctechnologies.com.au or https://prod.cmctechnologies.com.au
Both environments run on the same server and share:
- A single Caddy reverse proxy (handles HTTPS and basic authentication for both environments)
- Separate Docker containers for each environment's PHP and Go applications
- Separate MariaDB database instances