feat: SuiteCRM Docker + compose + CI/CD
Some checks failed
Docker Build & Push / build-and-push (push) Has been cancelled
Some checks failed
Docker Build & Push / build-and-push (push) Has been cancelled
This commit is contained in:
7
.dockerignore
Normal file
7
.dockerignore
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
.env
|
||||||
|
upload/
|
||||||
|
cache/
|
||||||
|
*.log
|
||||||
|
vendor/
|
||||||
|
.env.local
|
||||||
|
.env.*.local
|
||||||
16
.env
Normal file
16
.env
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# SuiteCRM Docker Compose Configuration
|
||||||
|
# Copy to .env and customize
|
||||||
|
|
||||||
|
# SuiteCRM
|
||||||
|
SUITECRM_PORT=8080
|
||||||
|
SUITECRM_SITE_URL=http://localhost:8080
|
||||||
|
|
||||||
|
# MariaDB
|
||||||
|
MYSQL_PORT=3307
|
||||||
|
MYSQL_ROOT_PASSWORD=change_this_root_password
|
||||||
|
MYSQL_DATABASE=suitecrm
|
||||||
|
MYSQL_USER=suitecrm
|
||||||
|
MYSQL_PASSWORD=change_this_db_password
|
||||||
|
|
||||||
|
# Redis (only with --profile full or --profile redis)
|
||||||
|
REDIS_PORT=6379
|
||||||
38
.gitea/workflows/docker-build.yml
Normal file
38
.gitea/workflows/docker-build.yml
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
name: Docker Build & Push
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: docker:27-dind
|
||||||
|
options: --privileged
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to Gitea Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: git.kgessner.de
|
||||||
|
username: ${{ secrets.REGISTRY_USER }}
|
||||||
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and Push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
git.kgessner.de/luiicode/sugar-crm:latest
|
||||||
|
git.kgessner.de/luiicode/sugar-crm:7.15.1
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
96
Dockerfile
Normal file
96
Dockerfile
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
# SuiteCRM 7.15.1 - PHP 8.1 + Apache
|
||||||
|
FROM php:8.1-apache
|
||||||
|
|
||||||
|
LABEL maintainer="Kevin Gessner"
|
||||||
|
LABEL description="SuiteCRM 7.15.1 containerized with PHP 8.1 and Apache"
|
||||||
|
|
||||||
|
# Install system dependencies and PHP extensions
|
||||||
|
RUN set -eux; \
|
||||||
|
apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
# Core
|
||||||
|
libzip-dev \
|
||||||
|
libpng-dev \
|
||||||
|
libjpeg-dev \
|
||||||
|
libfreetype6-dev \
|
||||||
|
libonig-dev \
|
||||||
|
libxml2-dev \
|
||||||
|
libldap2-dev \
|
||||||
|
libc-client-dev \
|
||||||
|
libkrb5-dev \
|
||||||
|
libcurl4-openssl-dev \
|
||||||
|
libicu-dev \
|
||||||
|
# Utils
|
||||||
|
unzip \
|
||||||
|
wget \
|
||||||
|
curl \
|
||||||
|
cron \
|
||||||
|
msmtp \
|
||||||
|
# Cleanup
|
||||||
|
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
|
||||||
|
&& docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
|
||||||
|
&& docker-php-ext-install -j$(nproc) \
|
||||||
|
pdo \
|
||||||
|
pdo_mysql \
|
||||||
|
mysqli \
|
||||||
|
gd \
|
||||||
|
mbstring \
|
||||||
|
zip \
|
||||||
|
xml \
|
||||||
|
curl \
|
||||||
|
ldap \
|
||||||
|
imap \
|
||||||
|
intl \
|
||||||
|
calendar \
|
||||||
|
opcache \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Configure PHP for SuiteCRM
|
||||||
|
RUN { \
|
||||||
|
echo 'memory_limit = 512M'; \
|
||||||
|
echo 'upload_max_filesize = 64M'; \
|
||||||
|
echo 'post_max_size = 64M'; \
|
||||||
|
echo 'max_execution_time = 600'; \
|
||||||
|
echo 'max_input_time = 600'; \
|
||||||
|
echo 'display_errors = Off'; \
|
||||||
|
echo 'log_errors = On'; \
|
||||||
|
echo 'date.timezone = Europe/Berlin'; \
|
||||||
|
} > /usr/local/etc/php/conf.d/suitecrm.ini
|
||||||
|
|
||||||
|
# Configure OPcache
|
||||||
|
RUN { \
|
||||||
|
echo 'opcache.memory_consumption=256'; \
|
||||||
|
echo 'opcache.interned_strings_buffer=16'; \
|
||||||
|
echo 'opcache.max_accelerated_files=20000'; \
|
||||||
|
echo 'opcache.revalidate_freq=2'; \
|
||||||
|
echo 'opcache.fast_shutdown=1'; \
|
||||||
|
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
|
||||||
|
|
||||||
|
# SuiteCRM version
|
||||||
|
ENV SUITECRM_VERSION=7.15.1
|
||||||
|
ENV SUITECRM_SHA256=468b811addd21dfb29d411ee6e815dbdf7099f912347e88cd3e8d010d829db7a
|
||||||
|
|
||||||
|
# Download and extract SuiteCRM
|
||||||
|
RUN set -eux; \
|
||||||
|
wget -q "https://github.com/salesagility/SuiteCRM/releases/download/v${SUITECRM_VERSION}/SuiteCRM-${SUITECRM_VERSION}.zip" \
|
||||||
|
-O /tmp/suitecrm.zip; \
|
||||||
|
echo "${SUITECRM_SHA256} /tmp/suitecrm.zip" | sha256sum -c -; \
|
||||||
|
unzip -q /tmp/suitecrm.zip -d /var/www/html/; \
|
||||||
|
rm /tmp/suitecrm.zip; \
|
||||||
|
chown -R www-data:www-data /var/www/html
|
||||||
|
|
||||||
|
# Apache configuration
|
||||||
|
RUN a2enmod rewrite expires headers
|
||||||
|
|
||||||
|
COPY apache-suitecrm.conf /etc/apache2/sites-available/000-default.conf
|
||||||
|
COPY docker-entrypoint.sh /usr/local/bin/
|
||||||
|
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||||
|
|
||||||
|
WORKDIR /var/www/html
|
||||||
|
|
||||||
|
VOLUME ["/var/www/html/upload", "/var/www/html/custom", "/var/www/html/config_override.php"]
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||||
|
CMD ["apache2-foreground"]
|
||||||
155
README.md
155
README.md
@@ -1,3 +1,154 @@
|
|||||||
# sugar-crm
|
# SuiteCRM Docker — Containerized CRM Environment
|
||||||
|
|
||||||
Containerized SugarCRM/SuiteCRM environment with Docker Compose
|
**SuiteCRM 7.15.1** — vollständig containerisiert mit Docker Compose.
|
||||||
|
Ein Befehl, alles läuft: SuiteCRM + MariaDB + (optional) Redis.
|
||||||
|
|
||||||
|
## Systemanforderungen
|
||||||
|
|
||||||
|
- Docker 20.10+ und Docker Compose v2
|
||||||
|
- 2 GB RAM empfohlen (MariaDB Puffer)
|
||||||
|
|
||||||
|
## Schnellstart
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Repository klonen
|
||||||
|
git clone https://git.kgessner.de/LuiiCode/sugar-crm.git
|
||||||
|
cd sugar-crm
|
||||||
|
|
||||||
|
# 2. Umgebungsvariablen anpassen
|
||||||
|
cp .env.example .env
|
||||||
|
nano .env # Passwörter ändern!
|
||||||
|
|
||||||
|
# 3. Starten
|
||||||
|
docker compose up -d
|
||||||
|
|
||||||
|
# 4. SuiteCRM Installation im Browser abschließen:
|
||||||
|
# http://localhost:8080
|
||||||
|
```
|
||||||
|
|
||||||
|
## Architektur
|
||||||
|
|
||||||
|
```
|
||||||
|
┌──────────────────────────────────────┐
|
||||||
|
│ Docker Compose │
|
||||||
|
│ │
|
||||||
|
│ ┌──────────┐ ┌──────────┐ │
|
||||||
|
│ │ SuiteCRM │ │ MariaDB │ Redis? │
|
||||||
|
│ │ :8080 │ │ :3307 │ :6379 │
|
||||||
|
│ │ PHP 8.1 │ │ 10.11 │ (opt.) │
|
||||||
|
│ │ Apache │ │ │ │
|
||||||
|
│ └──────────┘ └──────────┘ │
|
||||||
|
│ │ │ │
|
||||||
|
│ Volumes: Volumes: │
|
||||||
|
│ - upload - /var/lib/mysql │
|
||||||
|
│ - custom │
|
||||||
|
│ - config │
|
||||||
|
└──────────────────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
## Services
|
||||||
|
|
||||||
|
| Service | Image | Port | Profil |
|
||||||
|
|-----------|------------------|-------|---------------|
|
||||||
|
| suitecrm | Custom (PHP 8.1) | 8080 | standard |
|
||||||
|
| mariadb | mariadb:10.11 | 3307 | standard |
|
||||||
|
| redis | redis:7-alpine | 6379 | `redis`/`full`|
|
||||||
|
|
||||||
|
## Konfiguration
|
||||||
|
|
||||||
|
### Umgebungsvariablen (`.env`)
|
||||||
|
|
||||||
|
| Variable | Default | Beschreibung |
|
||||||
|
|-----------------------|-----------------------------|-------------------------|
|
||||||
|
| `SUITECRM_PORT` | 8080 | Webinterface-Port |
|
||||||
|
| `SUITECRM_SITE_URL` | http://localhost:8080 | Öffentliche URL |
|
||||||
|
| `MYSQL_PORT` | 3307 | DB-Port (Host) |
|
||||||
|
| `MYSQL_ROOT_PASSWORD` | change_this… | Root-Passwort |
|
||||||
|
| `MYSQL_DATABASE` | suitecrm | Datenbank-Name |
|
||||||
|
| `MYSQL_USER` | suitecrm | Datenbank-Nutzer |
|
||||||
|
| `MYSQL_PASSWORD` | change_this… | Nutzer-Passwort |
|
||||||
|
|
||||||
|
> ⚠️ **Sicherheit**: Immer `.env` Passwörter ändern vor erstem Start!
|
||||||
|
|
||||||
|
## Kommandos
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Grundbefehle
|
||||||
|
docker compose up -d # Alle Services starten
|
||||||
|
docker compose up -d redis # + Redis-Cache starten
|
||||||
|
docker compose down # Stoppen
|
||||||
|
docker compose down -v # Stoppen + ALLE DATEN LÖSCHEN
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
docker compose logs -f suitecrm # SuiteCRM-Logs verfolgen
|
||||||
|
docker compose logs mariadb # DB-Logs
|
||||||
|
|
||||||
|
# Backup
|
||||||
|
docker compose exec mariadb mysqldump -u suitecrm -p suitecrm > backup.sql
|
||||||
|
tar -czf upload-backup.tar.gz -C /var/lib/docker/volumes/sugarcrmreponame_suitecrm_data/_data .
|
||||||
|
```
|
||||||
|
|
||||||
|
## SuiteCRM Installation (Erst-Start)
|
||||||
|
|
||||||
|
Nach `docker compose up -d` im Browser `http://localhost:8080` öffnen:
|
||||||
|
|
||||||
|
1. **License Agreement** → Akzeptieren
|
||||||
|
2. **System Check** → Alle Checks sollten grün sein
|
||||||
|
3. **Database Configuration**:
|
||||||
|
- Host: `mariadb`
|
||||||
|
- Database: `suitecrm`
|
||||||
|
- User: `suitecrm`
|
||||||
|
- Password: (aus `.env`)
|
||||||
|
4. **Site Configuration** → Admin-Nutzer anlegen
|
||||||
|
5. **Fertig!** SuiteCRM ist einsatzbereit.
|
||||||
|
|
||||||
|
## Redis aktivieren
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Mit Redis-Profil starten
|
||||||
|
docker compose --profile redis up -d
|
||||||
|
|
||||||
|
# Oder Full-Stack (alles inkl. Redis)
|
||||||
|
docker compose --profile full up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
Redis-Konfiguration in SuiteCRM Admin → System → Redis:
|
||||||
|
- Host: `redis`
|
||||||
|
- Port: `6379`
|
||||||
|
|
||||||
|
## Elasticsearch (optional)
|
||||||
|
|
||||||
|
Für Volltextsuche kann Elasticsearch ergänzt werden. Dazu in `docker-compose.yml` einfügen:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
elasticsearch:
|
||||||
|
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.24
|
||||||
|
container_name: suitecrm-es
|
||||||
|
environment:
|
||||||
|
- discovery.type=single-node
|
||||||
|
- xpack.security.enabled=false
|
||||||
|
volumes:
|
||||||
|
- es_data:/usr/share/elasticsearch/data
|
||||||
|
networks:
|
||||||
|
- suitecrm-net
|
||||||
|
```
|
||||||
|
|
||||||
|
## Docker Image bauen & pushen
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Lokal bauen
|
||||||
|
docker build -t suitecrm:7.15.1 .
|
||||||
|
|
||||||
|
# In Gitea Registry pushen
|
||||||
|
docker tag suitecrm:7.15.1 git.kgessner.de/luiicode/sugar-crm:7.15.1
|
||||||
|
docker login git.kgessner.de
|
||||||
|
docker push git.kgessner.de/luiicode/sugar-crm:7.15.1
|
||||||
|
```
|
||||||
|
|
||||||
|
## CI/CD
|
||||||
|
|
||||||
|
Bei jedem Push auf `main` baut Gitea Actions das Image automatisch und pusht es in die Gitea Container Registry. Workflow: `.gitea/workflows/docker-build.yml`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Version**: SuiteCRM 7.15.1 | **PHP**: 8.1 | **MariaDB**: 10.11
|
||||||
|
|||||||
23
apache-suitecrm.conf
Normal file
23
apache-suitecrm.conf
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<VirtualHost *:80>
|
||||||
|
ServerAdmin webmaster@localhost
|
||||||
|
DocumentRoot /var/www/html
|
||||||
|
|
||||||
|
<Directory /var/www/html>
|
||||||
|
Options Indexes FollowSymLinks
|
||||||
|
AllowOverride All
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
# Protect sensitive files
|
||||||
|
<FilesMatch "\.(log|ini|git|sh|yml|yaml|md)$">
|
||||||
|
Require all denied
|
||||||
|
</FilesMatch>
|
||||||
|
|
||||||
|
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||||
|
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||||
|
|
||||||
|
# Security headers
|
||||||
|
Header always set X-Content-Type-Options "nosniff"
|
||||||
|
Header always set X-Frame-Options "SAMEORIGIN"
|
||||||
|
Header always set X-XSS-Protection "1; mode=block"
|
||||||
|
</VirtualHost>
|
||||||
87
docker-compose.yml
Normal file
87
docker-compose.yml
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
# SuiteCRM Docker Compose Environment
|
||||||
|
# ====================================
|
||||||
|
# Start: docker compose up -d
|
||||||
|
# Stop: docker compose down
|
||||||
|
# Data persists in Docker volumes unless you run: docker compose down -v
|
||||||
|
|
||||||
|
services:
|
||||||
|
# --- SuiteCRM Application ---
|
||||||
|
suitecrm:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
image: suitecrm:7.15.1
|
||||||
|
container_name: suitecrm-app
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "${SUITECRM_PORT:-8080}:80"
|
||||||
|
environment:
|
||||||
|
- DATABASE_HOST=mariadb
|
||||||
|
- DATABASE_PORT=3306
|
||||||
|
- DATABASE_NAME=${MYSQL_DATABASE:-suitecrm}
|
||||||
|
- DATABASE_USER=${MYSQL_USER:-suitecrm}
|
||||||
|
- DATABASE_PASSWORD=${MYSQL_PASSWORD:-suitecrm_secret}
|
||||||
|
- SUITECRM_SITE_URL=${SUITECRM_SITE_URL:-http://localhost:8080}
|
||||||
|
volumes:
|
||||||
|
- suitecrm_data:/var/www/html/upload
|
||||||
|
- suitecrm_custom:/var/www/html/custom
|
||||||
|
- suitecrm_config:/var/www/html/config_override.php
|
||||||
|
depends_on:
|
||||||
|
mariadb:
|
||||||
|
condition: service_healthy
|
||||||
|
networks:
|
||||||
|
- suitecrm-net
|
||||||
|
|
||||||
|
# --- MariaDB Database ---
|
||||||
|
mariadb:
|
||||||
|
image: mariadb:10.11
|
||||||
|
container_name: suitecrm-db
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "${MYSQL_PORT:-3307}:3306"
|
||||||
|
environment:
|
||||||
|
- MARIADB_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root_secret}
|
||||||
|
- MARIADB_DATABASE=${MYSQL_DATABASE:-suitecrm}
|
||||||
|
- MARIADB_USER=${MYSQL_USER:-suitecrm}
|
||||||
|
- MARIADB_PASSWORD=${MYSQL_PASSWORD:-suitecrm_secret}
|
||||||
|
volumes:
|
||||||
|
- mariadb_data:/var/lib/mysql
|
||||||
|
command:
|
||||||
|
- --character-set-server=utf8mb4
|
||||||
|
- --collation-server=utf8mb4_unicode_ci
|
||||||
|
- --max-allowed-packet=64M
|
||||||
|
- --innodb-buffer-pool-size=256M
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
networks:
|
||||||
|
- suitecrm-net
|
||||||
|
|
||||||
|
# --- Redis Cache (optional) ---
|
||||||
|
redis:
|
||||||
|
image: redis:7-alpine
|
||||||
|
container_name: suitecrm-redis
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "${REDIS_PORT:-6379}:6379"
|
||||||
|
volumes:
|
||||||
|
- redis_data:/data
|
||||||
|
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
|
||||||
|
networks:
|
||||||
|
- suitecrm-net
|
||||||
|
profiles:
|
||||||
|
- full
|
||||||
|
- redis
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
suitecrm_data:
|
||||||
|
suitecrm_custom:
|
||||||
|
suitecrm_config:
|
||||||
|
mariadb_data:
|
||||||
|
redis_data:
|
||||||
|
|
||||||
|
networks:
|
||||||
|
suitecrm-net:
|
||||||
|
driver: bridge
|
||||||
22
docker-entrypoint.sh
Normal file
22
docker-entrypoint.sh
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Fix permissions
|
||||||
|
chown -R www-data:www-data /var/www/html/cache /var/www/html/upload /var/www/html/custom 2>/dev/null || true
|
||||||
|
chmod -R 755 /var/www/html 2>/dev/null || true
|
||||||
|
chmod -R 775 /var/www/html/cache /var/www/html/upload /var/www/html/custom 2>/dev/null || true
|
||||||
|
|
||||||
|
# Generate SuiteCRM autoloader if missing
|
||||||
|
if [ ! -f /var/www/html/vendor/autoload.php ] && [ -f /var/www/html/composer.json ]; then
|
||||||
|
echo "Installing Composer dependencies..."
|
||||||
|
cd /var/www/html && composer install --no-dev --optimize-autoloader 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set recommended permissions
|
||||||
|
touch /var/www/html/config.php 2>/dev/null || true
|
||||||
|
chmod 640 /var/www/html/config.php 2>/dev/null || true
|
||||||
|
chown www-data:www-data /var/www/html/config.php 2>/dev/null || true
|
||||||
|
|
||||||
|
echo "SuiteCRM ready. Access http://localhost:8080 to complete installation."
|
||||||
|
|
||||||
|
exec "$@"
|
||||||
Reference in New Issue
Block a user