
Introduction
Self-hosted partner sales require reliable operational processes: trustworthy tracking, secure data retention and planned updates without interruption. Affilentra supplies the software foundation as a PHP/MySQL application. This guide demonstrates in practical terms how to operate Affilentra as a containerized application — with Docker‑Compose for simple setups and Kubernetes for scalable, fault-tolerant production environments. Focus: persistence for MySQL, backups, secrets management and zero-downtime updates for the PRO & NETWORK editions.
Architecture Overview
Typical components of an Affilentra installation:
- PHP application (Affilentra): web frontend, API, scheduler/jobs
- Web server (Nginx/Apache) or reverse proxy (Traefik/Ingress)
- MySQL database (persistent storage)
- Optional: Redis for sessions/cache, SMTP for mail delivery, object storage for assets
- Monitoring, logging, backup jobs
Role-based separation keeps operators, merchants and partners logically distinct — the platform provides the technical framework.
Docker-Compose: Pragmatic Production Setup
For small to medium installations, Docker‑Compose is often sufficient. Important components:
- Service "app": PHP‑FPM or PHP with embedded web server. Mount the application code read-only, configure a persistent uploads folder.
- Service "db": MySQL 8, with a persistent volume for /var/lib/mysql.
- Reverse proxy: Traefik or an Nginx container, external TLS certificates.
- Optional: redis, mailer, backup container.
Environment variables (DB_HOST, DB_NAME, DB_USER, DB_PASSWORD) should not be exposed in the Compose file. Use a .env file with restrictive permissions or Docker Secrets in Swarm setups. Persistence: use named volumes or host mounts on dedicated storage devices.
Backup & restore: plan a separate backup container or cron job that regularly creates a consistent mysqldump and writes the encrypted dumps to an external target (S3-compatible). Test restore processes regularly.
Kubernetes: Production-Ready Manifests
Kubernetes offers better scaling, fault tolerance and integrations. Recommended resources:
- Deployment for the Affilentra app with readiness/liveness probes (e.g. the application's health endpoint).
- StatefulSet for MySQL with PersistentVolumeClaims (PV/PVC) and a suitable StorageClass (CSI plugin for cloud/on-prem).
- Service (ClusterIP) for internal communication; Ingress (or an Ingress Controller) for external access with TLS.
- ConfigMap for non-sensitive configuration; Secrets for database credentials, API keys, SMTP passwords.
- Job/CronJob for database migrations, backups and routine maintenance tasks.
StatefulSet ensures MySQL pods remain stably bound to persistent volumes. Use VolumeSnapshots (if your storage provider supports them) in addition to mysqldump for faster recovery.
Persistence for MySQL & Backup Strategies
Basic rules for data integrity:
- Use dedicated PersistentVolumes with a reliable StorageClass. Avoid ephemeral storage for databases.
- Perform regular logical backups (mysqldump or mydumper) to meet audit and migration requirements.
- Augment with physical backups when needed (e.g., Percona XtraBackup) or storage snapshots for large datasets.
- Store backups encrypted and redundantly (at least offsite). Test restores in an isolated environment.
- Plan backup retention and retention policies according to compliance requirements.
Practical approach: A CronJob creates daily dumps, a weekly snapshot provides fast restore points; automated verify jobs ensure dumps are readable.
Secrets Management
Secrets are critical for security and operational reliability:
- Docker Compose: use Docker Secrets or an encrypted .env; restrict file permissions.
- Kubernetes: store sensitive values in Secrets and use tools like Sealed‑Secrets or External‑Secrets to enable GitOps workflows securely.
- For centralized management in larger environments, consider a secret store such as HashiCorp Vault or a cloud KMS.
Rotate secrets periodically and document access controls per role (operators vs. merchants vs. partners).
Zero‑Downtime Updates
Updates without interruption are crucial in partner networks. Procedure:
- Configure rolling updates for app deployments and use readiness probes so only healthy pods receive traffic.
- For database schemas: rely on backward‑compatible migration steps. Execute migrations in two phases (write‑compatible, read‑compatible) or use feature flags.
- Run migration‑critical steps as Kubernetes Jobs outside production paths, or use blue‑green/canary patterns at the ingress level to shift traffic gradually.
- Sessions and caches: externalize session state (e.g., Redis) so pods can be replaced at will.
- Prepare a short fallback scenario (rollback image, database snapshot) instead of long maintenance windows.
This reduces outage risks during updates for PRO & NETWORK editions, even under high user loads.
Monitoring, Logging, Operations
A stable deployment relies on monitoring and visible metrics:
- Collect logs centrally (ELK/EFK, Loki) and instrument application metrics (Prometheus, Grafana).
- Set up alerts for error rates, latencies, disk utilization and backup failures.
- Document runbooks for common incidents: DB restore, network outage, TLS renewal.
Practical checklist for production launch
Short, manageable steps:
- 1) Provision environment: host, Kubernetes cluster or Docker host with sufficient storage.
- 2) Create storage and secrets: configure PV/PVC, StorageClass, secret store.
- 3) Base deployment: start app + MySQL, run migration job, perform smoke tests.
- 4) Enable backup and monitoring and test restore.
- 5) Define update strategy: rolling/blue‑green, plan migration jobs and feature flags.
- 6) Publish an operations manual with roles and responsibilities.
Conclusion and next step
Affilentra can be containerized flexibly — from simple Docker‑Compose setups to scalable Kubernetes deployments. Critical elements are persistent storage for MySQL, tested backup and restore processes, secure handling of secrets and an update strategy that minimizes downtime. Rely on readiness probes, external session stores and migration‑safe changes to operate PRO & NETWORK Editionen stably.
Next step
Try Affilentra yourself
A unified platform that transparently brings together product provisioning, tracking, conversion validation, commission calculation and payout across clearly separated roles; option for a self-hosted installation with a perpetual license and no revenue sharing; merchants retain control over products, terms and promotional materials; partners receive personal tracking links and a traceable payout history.
