Znuny Multi-Instance Development Environment
A comprehensive Docker-based development environment for Znuny that enables working on multiple Znuny Framework instances simultaneously, each with its own database and configuration.
π Features
- Multi-Instance Support: Run multiple Znuny framework instances in parallel
- Dynamic Framework Creation: Automatically create new framework instances
- Multi-Database Support: MySQL, PostgreSQL, MariaDB per instance (choose one per instance)
- Automatic Port Assignment: Dynamic port allocation (default: 10000, 10001, 10002, etc.; configurable via
BASE_PORT) - Individual Configuration: Each instance has its own environment file
- Dynamic Docker Compose: Automatic generation of docker-compose.yml
- Complete Isolation: Separate volumes and containers for each instance
- Live-Linking: Module-Tools for live synchronization between framework, packages (
/opt/packages/), and developer tools (/opt/tools/) - Developer Tools: Fred for debugging, ZnunyCodePolicy for code quality
- Environment Variables Management: Template-based configuration with automatic backup system
- Bash Scripts: Cross-platform compatibility
- Optional local dashboard: instance overview at
http://127.0.0.1:9999/β see docs/dashboard.md
π Prerequisites
- Docker and Docker Compose
- Git
- Bash (available on all platforms)
π οΈ Installation
1. Clone Repository
1
2
git clone https://github.com/dennykorsukewitz/Znuny-Dev/ znuny-dev
cd znuny-dev
2. Setup-All
1
2
3
4
5
6
# Make all scripts executable
chmod -R +x dev/scripts
chmod +x znuny-dev.sh
# Setup complete environment (or: zd setup-all after alias is configured)
./znuny-dev.sh setup-all
π― Usage
All operations go through zd. Run from the project root; if the alias is missing, use ./znuny-dev.sh. Full reference: docs/usage.md (zd help / zd examples stay authoritative).
Everyday commands
1
2
3
4
5
6
7
8
9
10
11
zd status
zd create <framework>
zd start <framework>
zd stop <framework>
zd restart <framework>
zd shell <framework>
zd console <framework> Maint::Cache::Delete
zd log <framework>
zd link <framework> <package>
zd link-fred <framework>
zd dashboard start
Typical flow after install:
1
2
3
4
5
./znuny-dev.sh setup-all
zd create dev
zd start dev
zd status
zd dashboard start # optional β http://127.0.0.1:9999/
More commands (setup, Module-Tools install/uninstall, CodePolicy, tests, release): docs/usage.md. Dashboard details: docs/dashboard.md.
βοΈ Configuration
Project configs (configs/)
Optional host-side configuration lives in the configs/ directory at the project root. These files override or extend defaults and are not overwritten by setup.
| Path | Purpose |
|---|---|
configs/instance/my.env | Loaded after the global .env; overrides variables (e.g. BASE_PORT, repository URLs like REPO_SOURCE_ZNUNY, REPO_SOURCE_FRED, REPO_SOURCE_MODULE_TOOLS, REPO_SOURCE_CODE_POLICY). |
configs/framework/Config.pm | Optional Perl snippet injected into each instanceβs Kernel/Config.pm on container start. |
Load order: Global .env is loaded first, then configs/instance/my.env, so values in my.env take precedence.
configs/framework/Config.pm: Only add valid $Self->{...} = ...; lines (as in Kernel/Config/Defaults.pm). The content is inserted between the markers # insert your own config settings "here" and # end of your own config options!!! in the frameworkβs Kernel/Config.pm. Changes apply on the next container start (or when the startup script runs the config injection).
π¨ Important Notes
- Template-based .env: Global
.envgenerated from templates, each instance has its own configuration - Automatic generation: docker-compose.yml is automatically updated when changes occur
- Port conflicts: The system automatically assigns free ports for each instance (see instance
.env) - Volumes: Each instance has separate Docker volumes for data and logs
- Isolation: Complete separation between instances
- Apache: CGI mode by default (
ZNUNY_USE_MOD_PERL=falsein instance.env). Znunyβsapache2-httpd.include.confis used, butmod_perlstays disabled so each request runs fresh Perl (stable aftergit checkout). SetZNUNY_USE_MOD_PERL=trueonly if you explicitly want mod_perl.
π Directory Structure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
Znuny-Dev/
βββ znuny-dev.sh # Main script
βββ .env # Global config (from dev/templates/env/)
βββ RELEASE # Version and build information
βββ docs/ # Extra documentation
β βββ usage.md # Full zd command reference
β βββ dashboard.md # Local dashboard
βββ configs/ # Optional host overrides (see Configuration)
β βββ instance/my.env # Overrides global .env
β βββ framework/Config.pm # Snippet injected into Kernel/Config.pm
βββ instances/ # Instance configs (same level as dev/)
β βββ my_instance/ # Per-instance: .env, compose, logs/
β β βββ my_instance.env
β β βββ compose-<framework_slug>.yml # Auto-generated
β β βββ logs/
β βββ dev/
β βββ test/
βββ dev/ # Development configuration
β βββ dashboard/ # Local web UI (zd dashboard)
β β βββ public/ # HTML, CSS, JS (repo mount)
β β βββ server.mjs # API server
β β βββ Dockerfile # Dashboard container image
β βββ docker/ # Docker configuration
β β βββ compose-dashboard.yml # Dashboard compose stack
β β βββ compose/ # Optional extra compose snippets
β β βββ Dockerfile # Instance image definition
β β βββ startup-instance.sh # Instance startup script
β β βββ configs/ # Database configurations
β βββ templates/ # Templates
β β βββ env/ # Environment templates
β β βββ global.env.template # Global .env template
β β βββ instance.env.template
β β βββ docker.env.template
β βββ scripts/ # Management scripts
β β βββ common.sh # Common functions and utilities
β β βββ dashboard.sh # zd dashboard commands
β β βββ env.sh # Environment management
β β βββ repository.sh # Repository operations
β β βββ release.sh # Version & release management
β β βββ version.sh # zd version / update check
β β βββ instance.sh # Framework & instance CRUD + Lifecycle
β β βββ instance/ # Instance-specific modules
β β βββ compose.sh # Compose generation & execution
β β βββ network.sh # Port & network management
β β βββ index.sh # Framework index allocation
β β βββ status.sh # zd status (text + JSON)
β β βββ status-json.sh # JSON status entry point
β βββ test/ # Test suite
β βββ run.sh # Run all tests (entry point)
β βββ tests/ # Test scripts
β βββ utils/ # Test utilities (assertions.sh)
βββ frameworks/ # Znuny frameworks (path from .env)
β βββ my_instance/ # Custom framework repository
β βββ dev/ # Development version
β βββ test/ # Test version
β βββ prod/ # Production version
βββ packages/ # Znuny packages
β βββ [Your packages]
βββ tools/ # Developer tools
β βββ module-tools/ # Module tools CLI (not linked into framework)
β βββ Fred/ # Fred debugging tool
β βββ ZnunyCodePolicy/ # Code quality checker
βββ README.md # This file
π€ Contributing
See CONTRIBUTING.md for setup, coding guidelines, tests, and the pull request process.
π License
This project is licensed under the GNU GENERAL PUBLIC LICENSE Version 3 β see LICENSE.
Happy developing with Znuny! π
This multi-instance system provides maximum flexibility for development with different Znuny versions and configurations simultaneously.