This repository provisions a common infrastructure stack (Docker, Nginx, MariaDB, PostgreSQL, Redis, developer languages, Uptime-Kuma, and firewall hardening) across multiple Linux distributions with a single non-interactive script.
- Debian 12 (primary target)
- Debian 11
- Ubuntu 20.04 LTS
- Ubuntu 22.04 LTS
- Ubuntu 24.04 LTS
- AlmaLinux 9
Clone the repository and run the master script with elevated privileges:
sudo ./infra-setup.shThe script automatically detects the host operating system, installs each module only when required, and logs all actions. No user prompts are shown during execution.
infra-setup/
infra-setup.sh # Master automation script
logs/ # Aggregated and per-module logs
modules/ # Self-contained module installers
os-detect.sh # OS detection and exports
docker.sh # Docker Engine + plugins
nginx.sh # Nginx web server
mysql.sh # MariaDB server
postgres.sh # PostgreSQL database
redis.sh # Redis cache
languages.sh # Node.js, Python, Go, PHP toolchain
uptime-kuma.sh # Uptime-Kuma container deployment
firewall.sh # UFW/Firewalld configuration
Each module is sourced by infra-setup.sh, logs to logs/infra.log and its own file in logs/modules/, and performs idempotent installation:
| Module | Description |
|---|---|
| os-detect | Exports OS_FAMILY and OS_VERSION for downstream modules. |
| docker | Installs Docker Engine, Buildx, Compose plugin, and starts the daemon. |
| nginx | Installs and starts Nginx. |
| mysql | Installs MariaDB (or MySQL if present) and enables the service. |
| postgres | Installs PostgreSQL and initializes the service. |
| redis | Installs Redis and ensures it is running. |
| languages | Installs Node.js/npm, Python3/pip, Go (tarball), and PHP 8.3. |
| uptime-kuma | Deploys the Uptime-Kuma Docker container with persistent data under /opt/uptime-kuma. |
| firewall | Configures UFW (Debian/Ubuntu) or firewalld (AlmaLinux) with the required ports. |
Every module first checks whether its component already exists. When it is already present, the module prints [SKIP] and exits without changes.
logs/infra.logaggregates the combined output from all modules.logs/modules/<module>.logcontains the detailed log for each individual module.- Logs are appended on every run. Remove the files if you need a clean slate before re-running the installer.
The execution order is defined inside infra-setup.sh in the modules array. To disable a module temporarily, remove it from the list or comment it out:
modules=(
"os-detect"
"docker"
# "nginx" # Example: disable Nginx
"mysql"
...
)Ensure that os-detect remains first so that other modules receive OS_FAMILY and OS_VERSION exports.
- Script exits immediately: Confirm you are running with
sudoso that package managers and systemd can make changes. - Package installation fails: Check the relevant log file under
logs/modules/for detailed error output. Re-run after resolving repository or network issues. - Firewall configuration errors: Ensure no other firewall service is conflicting (e.g., disable third-party firewalls before running the script).
- Docker commands fail: Verify that the Docker service is active (
systemctl status docker) and re-run the module if needed. - Uptime-Kuma already running: The module prints
[SKIP]when the Docker container nameduptime-kumaalready exists.
- Pull the latest changes:
git pull. - Review updates in
infra-setup.shand themodules/directory. - Run
sudo ./infra-setup.shagain to apply enhancements. All modules remain idempotent and will skip components that are already present.