HUB
Sign inSign up

hoanghd/linux

By hoanghd

•Updated 8 days ago

All-in-one Debian 13 stack: Apache, PHP 5.6-8.5, MariaDB, PostgreSQL, Redis, Mail, LDAP & FortiVPN.

Image
Developer tools
Web servers
Databases & storage
0

1.5K

hoanghd/linux repository overview

⁠All-in-One Web & Development Stack Docker Image

An all-in-one, highly configurable Docker image built on Debian 13 (Trixie), designed for web development and legacy-to-modern PHP testing environments. It bundles Apache, Multi-version PHP (5.6 to 8.5), MySQL 8.4.13, MariaDB 11.8.6, PostgreSQL 17.11 (with plpython3u & aws_s3), Redis (Standalone & Cluster), Mail Server (Postfix & Dovecot), OpenLDAP, and FortiVPN into a single container.


⁠🛠 Included Services & Features

  • Base OS: Debian 13 (debian:13)
  • Web Server: Apache2 (HTTP/HTTPS) with dynamic VirtualHost & PHP-FPM version routing.
  • PHP Versions: 5.6, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5
    • Pre-installed Extensions: bcmath, cli, common, dev, fpm, gd, imap, intl, ldap, mbstring, mysql, xml, pgsql, zip, redis, mongodb, imagick, readline, igbinary, mailparse, opcache.
  • Databases:
    • MySQL: 8.4.13
    • MariaDB: 11.8.6
    • PostgreSQL: 17.11 (pre-created plpython3u and aws_s3 extensions for Amazon S3 integration)
  • Caching & In-Memory Store: Redis Standalone & Redis Cluster (Ports 7000–7005).
  • Mail Server: Postfix (SMTP) & Dovecot (IMAP/POP3) with catch-all and script-piping support.
  • Directory Service: OpenLDAP (slapd).
  • VPN Client: FortiVPN (openfortivpn) with built-in NAT & Port Forwarding support over ppp0.

⁠🚀 Service Management

Services are disabled by default to save resources. Enable the exact services you need by passing a semicolon-separated list to the SERVICES_ON environment variable.

SERVICES_ON="apache2;php8.1-fpm;mysqld;mariadb;postgresql;slapd;redis-server;redis-server-cluster;postfix;dovecot;forti-vpn"
⁠Available Service Names:
  • apache2
  • php5.6-fpm, php7.4-fpm, php8.0-fpm, php8.1-fpm, php8.2-fpm, php8.3-fpm, php8.4-fpm, php8.5-fpm
  • mysqld (MySQL v8.4.13)
  • mariadb (v11.8.6)
  • postgresql (v17.11)
  • redis-server
  • redis-server-cluster (runs on ports 7000 to 7005)
  • postfix
  • dovecot
  • slapd (OpenLDAP)
  • forti-vpn (FortiGate SSL VPN Client)

⁠⚙️ Environment Variables Configuration

⁠1. Apache
  • Default Behavior: If APACHE_VHOST is not set, Apache serves /var/www/ on ports 80 and 443.
  • APACHE_ENV: Inject custom environment variables into Apache.
    • Example: APACHE_ENV="APP_ENV=development;APP_DEBUG=true"
  • APACHE_VHOST: Configure multiple VirtualHosts mapped to specific ports, PHP versions, and document roots using the format PORT:PHP_VER:DOC_ROOT.
    • Example: APACHE_VHOST="8080:7.4:/var/www/legacy;8081:8.3:/var/www/modern"
⁠2. MySQL (8.4.13) & MariaDB (11.8.6)
VariableDescription
MYSQL_DBName of the database to create on startup.
MYSQL_USERUsername for the database.
MYSQL_PASSWORDPassword for the database user.
⁠3. PostgreSQL (17.11)
  • Pre-created Extensions: plpython3u, aws_s3 (already enabled and ready to use).
VariableDescription
POSTGRES_DBName of the database to create on startup.
POSTGRES_USERUsername for the PostgreSQL database.
POSTGRES_PASSWORDPassword for the PostgreSQL user.
AWS_ACCESS_KEY_ID(Optional) AWS Access Key ID required when using the aws_s3 extension.
AWS_SECRET_ACCESS_KEY(Optional) AWS Secret Access Key required when using the aws_s3 extension.
⁠4. Redis & Redis Cluster
  • Redis Standalone: Standard Redis instance (redis-server).
  • Redis Cluster: Pre-configured cluster nodes running on ports 7000 through 7005 (redis-server-cluster).
⁠5. Mail Server (Postfix & Dovecot)
  • MAIL_USER: Create mail accounts using username:password pairs separated by semicolons.
    • Example: MAIL_USER="admin:secret123;dev:devpass"
  • MAIL_VIRTUAL_ALIAS: Configure virtual alias routing.
    • Default: /^([^@]+)@.*/ ${1}@localhost (routes any domain to local users).
    • Catch-all Example: MAIL_VIRTUAL_ALIAS="/@.*/ username" (routes all incoming emails to username).
  • MAIL_POST_ALIAS: Pipe incoming emails for a specific user directly into a script or command.
    • Example: MAIL_POST_ALIAS='username: "|xargs -0 /var/www/html/bash.sh"'
⁠6. OpenLDAP (slapd)
VariableDescriptionDefault
LDAP_PWAdministrator password for LDAP.-
LDAP_DNBase domain name for the LDAP tree.nodomain
LDAP_USERCreate LDAP users (username:password;username1:password1).-
  • Search Base Examples:
    • With custom LDAP_DN=example.com: uid=<username>,dc=example,dc=com
    • With default nodomain: uid=<username>,dc=nodomain
⁠7. FortiVPN (forti-vpn)
VariableDescription
VPN_HOSTFortiGate VPN server hostname or IP (with port if needed, e.g., ://example.com).
VPN_USERUsername for VPN authentication.
VPN_PASSPassword for VPN authentication.
VPN_CERT(Optional) Trusted server certificate SHA256 fingerprint (trusted-cert).
PORT_FORWARD(Optional) Forward local container ports to internal VPN hosts using EXT_PORT:DEST_IP:DEST_PORT separated by semicolons (;).
  • Port Forwarding Example:
    • PORT_FORWARD="8022:192.168.2.100:22;8080:192.168.2.100:80" (forwards container port 8022 to 192.168.2.100:22 and 8080 to 192.168.2.100:80 via ppp0).
    • Security Note: Always bind forwarded ports to localhost (127.0.0.1:<PORT>:<PORT>) in your docker run or docker-compose.yml so internal VPN services are not exposed publicly. Ensure privileged: true is enabled for ppp0 and iptables NAT routing.

⁠📦 Quick Start (docker-compose.yml)

version: '3.8'

services:
  web-stack:
    image: hoanghd/linux:latest
    container_name: dev-all-in-one
    privileged: true
    stdin_open: true
    tty: true  
    ports:
      - "80:80"
      - "443:443"
      - "3306:3306"
      - "5432:5432"
      - "6379:6379"
      - "25:25"
      - "143:143"
      - "389:389"
      # Bind VPN forwarded ports strictly to 127.0.0.1 for security
      - "127.0.0.1:8022:8022"
      - "127.0.0.1:2222:2222"
    environment:
      # Use either 'mysqld' (MySQL 8.4.13) or 'mariadb' (MariaDB 11.8.6)
      SERVICES_ON: "apache2;php7.4-fpm;php8.3-fpm;mysqld;postgresql;redis-server;postfix;dovecot;slapd;forti-vpn"
      
      # Apache
      APACHE_ENV: "APP_ENV=development;APP_DEBUG=true"
      APACHE_VHOST: "80:8.3:/var/www/html;8080:7.4:/var/www/legacy"
      
      # Databases
      MYSQL_DB: "app_db"
      MYSQL_USER: "db_user"
      MYSQL_PASSWORD: "db_password"
      POSTGRES_DB: "pg_db"
      POSTGRES_USER: "pg_user"
      POSTGRES_PASSWORD: "pg_password"
      
      # Optional: AWS Credentials for PostgreSQL aws_s3 extension
      AWS_ACCESS_KEY_ID: "your-access-key-id"
      AWS_SECRET_ACCESS_KEY: "your-secret-access-key"
      
      # Mail
      MAIL_USER: "admin:admin123"
      MAIL_VIRTUAL_ALIAS: "/@.*/ admin"
      
      # LDAP
      LDAP_PW: "adminpassword"
      LDAP_DN: "example.com"
      LDAP_USER: "jdoe:password123"

      # FortiVPN
      VPN_HOST: "://example.com"
      VPN_USER: "vpn_user"
      VPN_PASS: "vpn_password"
      VPN_CERT: "your-trusted-cert-sha256"
      PORT_FORWARD: "8022:192.168.2.100:22"
    volumes:
      - ./www:/var/www
      - mysql:/var/lib/mysql:cached
      - postgresql:/var/lib/postgresql/17/main:cached

volumes:
  mysql:
  postgresql:
Tag summary
Recent tags
Content type
Image
Digest
sha256:d0b773160…
Size
568.9 MB
Last updated
8 days ago
docker pull hoanghd/linux:latest