Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stack-installer

Bootstrapper Debian/Ubuntu qui installe Ansible en premier, installe une CLI locale stack-installer, puis lance un panneau interactif pour installer ou mettre à jour les composants choisis sur la machine locale.

License: MIT Shell Debian Ubuntu Ansible Node.js


Quick install

curl -fsSL https://github.com/dev-toolings/stack-installer/raw/refs/heads/main/install.sh | sudo bash

or with wget:

wget -qO- https://github.com/dev-toolings/stack-installer/raw/refs/heads/main/install.sh | sudo bash

The bootstrap installs Ansible first, installs the real local command /usr/local/bin/stack-installer, then launches the CLI automatically. When installed through curl ... | sudo bash, the menu is attached back to /dev/tty so it remains interactive.

The bootstrap is idempotent: it always update-or-creates /opt/stack-installer (existing install is refreshed, non-git directories are safely replaced), so rerunning it is safe.

On Ubuntu releases where the Ansible PPA is not published yet, the bootstrap uses the distribution package and removes stale ansible/ansible PPA source files that would otherwise break apt update.


What it does

install.sh is only the bootstrap layer:

  1. Detect Debian/Ubuntu.
  2. Install bootstrap dependencies.
  3. Install Ansible first.
  4. Update-or-create this project into /opt/stack-installer.
  5. Install the local CLI at /usr/local/bin/stack-installer.
  6. Launch the CLI.

stack-installer is the day-to-day command. The interactive menu shows a component tree and lets you choose groups or individual items by number instead of answering a long y/n wizard:

sudo stack-installer

Example selection:

1,3          # Docker + Node.js
2.1,2.2,4.2 # PHP + Composer + Zsh syntax highlighting + autosuggest
all         # everything

It runs Ansible locally with:

ansible-playbook -i localhost, -c local /opt/stack-installer/ansible/site.yml

Component Panel

The interactive panel can install/update everything or only selected components:

Component Behavior
docker Installs Docker CE from Docker's official apt repo
php Installs PHP 8.x CLI/extensions without nginx/apache2
composer Installs/updates Composer and pulls PHP when needed
nodejs Installs/updates current NodeSource LTS and bundled npm
zsh Installs Zsh + Oh My Zsh and manages .zshrc
zsh_plugins Installs/updates autosuggestions and syntax highlighting

Zsh setup disables the default OMZ theme and installs a compact prompt using native Zsh prompt escapes, so completion redraws remain stable. The prompt shows:

  • Current time
  • Full current path
  • Git segment ([git:<branch>], in color) when inside a Git repository
    • Appending * to [git:<branch>] means the repo has uncommitted/untracked changes.

Examples:

  • 23:12:34 * ~/Documents/lab/tools/stack-installer * [git:main] $
  • 23:12:34 ~ $
  • In non-git directories, /home/kev is displayed as ~.

Zsh plugins come from the official GitHub repositories:

The managed .zshrc enables zsh-autosuggestions automatically when the plugin is installed. zsh-syntax-highlighting is installed by zsh_plugins but not enabled by default to avoid redraw conflicts with completion-heavy sessions.

Apache2 and Nginx are never installed. If they already exist, the playbook stops/disables them unless KEEP_WEBSERVERS=1 is set.

On Ubuntu, PHP is installed from the distribution repositories to avoid release-specific PPA failures. On Debian, the Sury PHP repository is used.


Node.js LTS Policy

By default, Node.js follows the current LTS channel dynamically through NodeSource:

https://deb.nodesource.com/setup_lts.x

That means rerunning the CLI later can move Node.js to the then-current LTS line. NODE_MAJOR is only an explicit override:

sudo NODE_MAJOR=22 stack-installer --components nodejs

npm is not upgraded with npm@latest; it remains the npm version bundled with Node.js LTS.

References:


CLI Usage

Interactive mode:

sudo stack-installer

Install/update everything:

sudo stack-installer --all

Install/update selected components:

sudo stack-installer --components php,nodejs,zsh,zsh_plugins

Show installed versions/status:

sudo stack-installer --status

Bootstrap without launching the CLI:

curl -fsSL https://github.com/dev-toolings/stack-installer/raw/refs/heads/main/install.sh \
  | sudo STACK_INSTALLER_NO_RUN=1 bash

Configuration

Variable Default Effect
STACK_INSTALLER_REPO https://github.com/dev-toolings/stack-installer.git Git repo cloned by the bootstrap
STACK_INSTALLER_REF main Branch/tag cloned by the bootstrap
STACK_INSTALLER_DIR /opt/stack-installer Local project install directory
STACK_INSTALLER_NO_RUN unset Install the CLI without launching it
PHP_VERSION latest detected 8.x Pin PHP, for example 8.3
NODE_MAJOR unset Override dynamic LTS with a major line
KEEP_WEBSERVERS unset Do not stop/disable existing apache2/nginx

Safety

  • Ansible is installed before the component panel runs.
  • The CLI is relaunchable for full updates or selective updates.
  • Component tasks are idempotent.
  • PHP is installed without Apache2/Nginx packages.
  • Existing ~/.zshrc is backed up before replacement when it does not match the current managed schema.
  • Docker group changes and default-shell changes require a new login shell or SSH reconnect.

Local development

Syntax checks:

bash -n install.sh
bash -n bin/stack-installer

Ansible syntax check:

ansible-playbook -i localhost, -c local ansible/site.yml --syntax-check

ShellCheck, when Docker is available:

docker run --rm -v "$PWD:/mnt" koalaman/shellcheck:stable /mnt/install.sh /mnt/bin/stack-installer

Installer state note

git pull in any other clone (for example ~/Documents/.../stack-installer) does not automatically update the active installer copy.
The CLI uses /opt/stack-installer by default (copied by install.sh as root), so keep that path updated too when testing changes. Running curl ... | sudo bash now performs an update-or-create on /opt/stack-installer automatically.

To apply local file changes without waiting for another full bootstrap, from this repo run:

sudo STACK_INSTALLER_DIR="$PWD" stack-installer --components zsh,zsh_plugins

Then refresh your shell:

source ~/.zshrc
exec zsh

Post-install checks

stack-installer --status
ansible --version
docker --version && docker compose version
php -v
composer --version
node --version && npm --version
zsh --version

License

MIT - © 2026 MakFly

About

Bash installer for Debian/Ubuntu: Ansible + Docker CE + PHP 8.x latest, auto-disables Apache2 and Nginx.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages