2 Commits
Author SHA1 Message Date
shadowdao 152dd413ef adding claude infor
Cloud Apache Container / Build-and-Push (74) (push) Successful in 3m12s
Cloud Apache Container / Build-and-Push (80) (push) Successful in 1m37s
Cloud Apache Container / Build-and-Push (81) (push) Successful in 1m54s
Cloud Apache Container / Build-and-Push (82) (push) Successful in 2m23s
Cloud Apache Container / Build-and-Push (83) (push) Successful in 2m8s
Cloud Apache Container / Build-and-Push (84) (push) Successful in 3m21s
2025-07-28 07:29:03 -07:00
shadowdaoandClaude 617fdbcd21 Add PostgreSQL support for all PHP versions
- Added postgresql-devel package to Dockerfile for client libraries
- Added php-pgsql extension to all PHP versions (7.4, 8.0, 8.1, 8.2, 8.3, 8.4)
- Enables PHP applications to connect to PostgreSQL databases

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-28 07:27:39 -07:00
8 changed files with 93 additions and 7 deletions
+86
View File
@@ -0,0 +1,86 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
Cloud Apache Container (CAC) is a Docker-based PHP web hosting environment that supports multiple PHP versions (7.4 through 8.4) with Apache, designed for both local development and production deployment.
## Common Development Commands
### Local Development Setup
```bash
# Quick start with automated setup (creates helper scripts)
./local-dev.sh -n local-dev
# With specific PHP version
./local-dev.sh -n myproject -a 84 # PHP 8.4
# Helper scripts created by local-dev.sh:
./instance_start # Start container
./instance_stop # Stop container
./instance_logs # Tail Apache logs
./instance_db_info # Show MySQL credentials
```
### Building and Testing
```bash
# Build container locally
docker build -t cac:latest .
# Build with specific PHP version
docker build --build-arg PHP_VER=83 -t cac:php83 .
# Run container manually
docker run -d -p 80:80 -p 443:443 \
-e PHPVER=83 -e environment=DEV \
-e uid=$(id -u) -e user=$(whoami) -e domain=localhost \
-v"$(pwd)/user":/home/$(whoami) \
--name test-container cac:latest
```
### Server Deployment
- Production git directory: `/root/whp`
- After `git pull`, sync web files: `rsync -av web-files/ /docker/whp/web/`
## Architecture and Key Components
### Directory Structure
- `/scripts/` - Container setup scripts (entrypoint, PHP installers, vhost creation)
- `/config/` - Apache and PHP configuration files
- `/web-files/` - Default web content (ping endpoint)
- `/.gitea/workflows/` - CI/CD pipeline for multi-PHP version builds
### Container Behavior
1. **Entrypoint Flow** (`scripts/entrypoint.sh`):
- Creates user with specified UID
- Sets up directory structure
- Configures Apache vhost based on environment variables
- In DEV mode: starts MariaDB and Memcached
- Starts Apache and PHP-FPM
2. **Environment Modes**:
- **DEV** (`environment=DEV`): Local database, memcached, automatic backups
- **PROD** (default): Expects external database/cache services
3. **PHP Version Management**:
- Controlled via `PHPVER` environment variable (74, 80, 81, 82, 83, 84)
- Each version has dedicated install script in `/scripts/`
- PHP-FPM configuration dynamically created based on version
### Key Environment Variables
- `uid` (required): User ID for file permissions
- `user` (required): Username for container user
- `domain` (required): Primary domain for Apache vhost
- `serveralias`: Additional domains (comma-separated)
- `PHPVER`: PHP version to use (default: 83)
- `environment`: DEV or PROD mode
## Important Technical Details
1. **Health Check**: Available at `/ping` endpoint
2. **Logs Location**: `/home/$user/logs/apache/` and `/home/$user/logs/php-fpm/`
3. **Database Backups** (DEV mode): Every 15 minutes to `/home/$user/_db_backups/`
4. **Log Rotation**: Compress after 3 days, delete after 7 days
5. **SSL**: Self-signed certificate auto-generated, proper SSL configured
6. **WordPress**: WP-CLI pre-installed for WordPress development
+1 -1
View File
@@ -6,7 +6,7 @@ RUN dnf install -y \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm \ https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm \
https://rpms.remirepo.net/enterprise/remi-release-9.rpm && \ https://rpms.remirepo.net/enterprise/remi-release-9.rpm && \
dnf update -y && \ dnf update -y && \
dnf install -y httpd mod_ssl wget procps cronie iproute && \ dnf install -y httpd mod_ssl wget procps cronie iproute postgresql-devel && \
dnf clean all && \ dnf clean all && \
rm -rf /var/cache/dnf /usr/share/doc /usr/share/man /usr/share/locale/* rm -rf /var/cache/dnf /usr/share/doc /usr/share/man /usr/share/locale/*
+1 -1
View File
@@ -2,5 +2,5 @@
dnf module enable php:remi-7.4 -y dnf module enable php:remi-7.4 -y
dnf install -y php php-fpm php-mysqlnd php-xml php-pecl-zip php-sodium php-soap php-xmlrpc \ dnf install -y php php-fpm php-mysqlnd php-xml php-pecl-zip php-sodium php-soap php-xmlrpc \
php-pecl-redis5 php-pecl-memcached php-pecl-memcache php-pecl-ip2location php-pecl-imagick php-pecl-geoip \ php-pecl-redis5 php-pecl-memcached php-pecl-memcache php-pecl-ip2location php-pecl-imagick php-pecl-geoip \
php-mysqlnd php-mbstring php-ioncube-loader php-intl php-gd libzip php-cli php-mysqlnd php-mbstring php-ioncube-loader php-intl php-gd php-pgsql libzip php-cli
exit 0 exit 0
+1 -1
View File
@@ -2,5 +2,5 @@
dnf module enable php:remi-8.0 -y dnf module enable php:remi-8.0 -y
dnf install -y php php-fpm php-mysqlnd php-xml php-pecl-zip php-sodium php-soap php-pecl-xmlrpc \ dnf install -y php php-fpm php-mysqlnd php-xml php-pecl-zip php-sodium php-soap php-pecl-xmlrpc \
php-pecl-redis5 php-pecl-memcached php-pecl-memcache php-pecl-ip2location php-pecl-imagick php-pecl-geoip \ php-pecl-redis5 php-pecl-memcached php-pecl-memcache php-pecl-ip2location php-pecl-imagick php-pecl-geoip \
php-mysqlnd php-mbstring php-intl php-gd libzip php-cli php-mysqlnd php-mbstring php-intl php-gd php-pgsql libzip php-cli
exit 0 exit 0
+1 -1
View File
@@ -2,5 +2,5 @@
dnf module enable php:remi-8.1 -y dnf module enable php:remi-8.1 -y
dnf install -y php php-fpm php-mysqlnd php-xml php-pecl-zip php-sodium php-soap php-pecl-xmlrpc \ dnf install -y php php-fpm php-mysqlnd php-xml php-pecl-zip php-sodium php-soap php-pecl-xmlrpc \
php-pecl-redis5 php-pecl-memcached php-pecl-memcache php-pecl-ip2location php-pecl-imagick php-pecl-geoip \ php-pecl-redis5 php-pecl-memcached php-pecl-memcache php-pecl-ip2location php-pecl-imagick php-pecl-geoip \
php-mysqlnd php-mbstring php-ioncube-loader php-intl php-gd libzip php-cli php-mysqlnd php-mbstring php-ioncube-loader php-intl php-gd php-pgsql libzip php-cli
exit 0 exit 0
+1 -1
View File
@@ -2,5 +2,5 @@
dnf module enable php:remi-8.2 -y dnf module enable php:remi-8.2 -y
dnf install -y php php-fpm php-mysqlnd php-xml php-pecl-zip php-sodium php-soap php-pecl-xmlrpc \ dnf install -y php php-fpm php-mysqlnd php-xml php-pecl-zip php-sodium php-soap php-pecl-xmlrpc \
php-pecl-redis5 php-pecl-memcached php-pecl-memcache php-pecl-ip2location php-pecl-imagick php-pecl-geoip \ php-pecl-redis5 php-pecl-memcached php-pecl-memcache php-pecl-ip2location php-pecl-imagick php-pecl-geoip \
php-mysqlnd php-mbstring php-intl php-gd libzip php-cli php-mysqlnd php-mbstring php-intl php-gd php-pgsql libzip php-cli
exit 0 exit 0
+1 -1
View File
@@ -2,5 +2,5 @@
dnf module enable php:remi-8.3 -y dnf module enable php:remi-8.3 -y
dnf install -y php php-fpm php-mysqlnd php-xml php-pecl-zip php-sodium php-soap php-pecl-xmlrpc \ dnf install -y php php-fpm php-mysqlnd php-xml php-pecl-zip php-sodium php-soap php-pecl-xmlrpc \
php-pecl-redis5 php-pecl-memcached php-pecl-memcache php-pecl-ip2location php-pecl-imagick php-pecl-geoip \ php-pecl-redis5 php-pecl-memcached php-pecl-memcache php-pecl-ip2location php-pecl-imagick php-pecl-geoip \
php-mysqlnd php-mbstring php-intl php-gd libzip php-cli php-mysqlnd php-mbstring php-intl php-gd php-pgsql libzip php-cli
exit 0 exit 0
+1 -1
View File
@@ -2,5 +2,5 @@
dnf module enable php:remi-8.4 -y dnf module enable php:remi-8.4 -y
dnf install -y php php-fpm php-mysqlnd php-xml php-pecl-zip php-sodium php-soap php-pecl-xmlrpc \ dnf install -y php php-fpm php-mysqlnd php-xml php-pecl-zip php-sodium php-soap php-pecl-xmlrpc \
php-pecl-redis5 php-pecl-memcached php-pecl-memcache php-pecl-ip2location php-pecl-imagick php-pecl-geoip \ php-pecl-redis5 php-pecl-memcached php-pecl-memcache php-pecl-ip2location php-pecl-imagick php-pecl-geoip \
php-mysqlnd php-mbstring php-intl php-gd libzip php-cli php-mysqlnd php-mbstring php-intl php-gd php-pgsql libzip php-cli
exit 0 exit 0