Znuny-Dev

Znuny Multi-Instance Development Environment

Znuny Dev Logo

A comprehensive Docker-based development environment for Znuny that enables working on multiple Znuny Framework instances simultaneously, each with its own database and configuration.

RepositoryGitHub
ReleaseGitHub release (latest by date)
IssuesGitHub open issues GitHub closed issues
PRsGitHub pull requests GitHub closed pull requests
LanguagesGitHub language count GitHub contributors
Code sizeGitHub code size in bytes GitHub downloads
LicenseGitHub license
VersionsStatus
GitHub label versionGitHub commits since tagged version GitHub Workflow Lint GitHub Workflow UnitTest GitHub Workflow Pages

πŸš€ 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.

PathPurpose
configs/instance/my.envLoaded 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.pmOptional 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

  1. Template-based .env: Global .env generated from templates, each instance has its own configuration
  2. Automatic generation: docker-compose.yml is automatically updated when changes occur
  3. Port conflicts: The system automatically assigns free ports for each instance (see instance .env)
  4. Volumes: Each instance has separate Docker volumes for data and logs
  5. Isolation: Complete separation between instances
  6. Apache: CGI mode by default (ZNUNY_USE_MOD_PERL=false in instance .env). Znuny’s apache2-httpd.include.conf is used, but mod_perl stays disabled so each request runs fresh Perl (stable after git checkout). Set ZNUNY_USE_MOD_PERL=true only 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.