Skip to content

pqpxo/swaps

Repository files navigation

SWAPS Logo

SWAPS

SWAKES Automated Provisioning System

Generate, configure and deploy Linux provisioning scripts to remote hosts all from your browser.

License Docker Node React

SWAKES.co.uk


What is SWAPS?

SWAPS is a self-hosted web application that takes the pain out of setting up new Linux servers. Pick the software and configuration you want, fill in your host details, and SWAPS generates a ready-to-run bash script — then deploys it over SSH directly from the browser.

No Ansible control node. No manual scripting. Just point, click, deploy.


Features

🖥️ Script Generation

  • Generates clean, idempotent bash scripts for Ubuntu (amd64) and Raspberry Pi OS
  • Live syntax-highlighted script preview
  • Diff view to compare changes between generations
  • Ansible playbook export
  • One-liner cURL export
  • Rollback script generation

📦 Software Provisioning

Category Packages
Containers Docker + Docker Compose, Portainer CE
Version Control Git
Monitoring Netdata, Prometheus Node Exporter, htop, duf, ncdu
Networking curl, nmap, rsync
Terminal tmux, vim, unzip
Security Wazuh Agent
System Info Neofetch (custom config + image)

⚙️ Configuration

  • .bashrc builder — aliases, PS1 colour picker, SSH login menu, environment variables
  • SSH hardening — disable password auth, change port, restrict root login
  • UFW firewall presets (Web Server, Docker Host, Minimal, Custom)
  • fail2ban setup
  • Custom APT repositories
  • Cron jobs
  • DNS / hosts entries
  • Environment variables
  • Portainer stack deploy
  • SSH authorised keys
  • Custom scripts

🚀 Deployment

  • Deploy over SSH directly from the browser (password or private key auth)
  • Multi-host deploy tabs — manage several servers simultaneously
  • Dry Run mode — echo commands without executing
  • Live terminal output with progress tracking
  • Post-deploy verification checks
  • Deploy history log

🔐 Credential Vault

  • AES-GCM encrypted credential storage in the browser (Web Crypto API)
  • Master password protected — credentials never leave the browser unencrypted
  • Per-host save/load from vault

💾 Profiles & Sharing

  • Save and load named host profiles
  • Shareable config URLs (encodes settings, never passwords)
  • Import settings from a live host via SSH scan
  • Ansible export for CI/CD integration

Getting Started

Prerequisites

  • Docker + Docker Compose

Installation

git clone https://github.com/pqpxo/swaps.git
cd swaps
docker compose up -d --build

Then open http://your-server-ip:8080 in your browser.

Project Structure

swaps/
├── src/
│   ├── index.html      # Source (JSX) — edit this
│   └── logo.png
├── public/             # Compiled output — generated by build
├── build.js            # JSX pre-compiler (runs at Docker build time)
├── server.js           # Express + SSH + WebSocket backend
├── Dockerfile          # Multi-stage build
└── docker-compose.yml

Note: Always edit src/index.html. The Docker build compiles it to public/index.html automatically via Babel. Never edit public/ directly.

Hot Reload (Development)

To update the running container without a full rebuild:

node build.js
docker cp public/index.html swaps:/app/public/index.html && docker restart swaps

Architecture

Browser  ──HTTP──▶  Express (server.js)  ──SSH──▶  Remote Linux Host
         ◀──WS───  WebSocket              ◀──────   (stdout stream)
  • Frontend: React 18 (pre-compiled, no runtime Babel)
  • Backend: Node.js + Express, ssh2, ws
  • Auth: SSH password or private key, passed at deploy time
  • Credential storage: Browser-side AES-GCM (Web Crypto API)

docker-compose.yml

services:
  swaps:
    image: swaps:2.0.0
    build: .
    container_name: swaps
    ports:
      - "8080:8080"
    restart: unless-stopped

Security Notes

  • SSH credentials are never stored server-side. They live only in the browser's encrypted vault or in memory during a session.
  • The app has no authentication layer of its own — run it on a private network or behind a reverse proxy with auth (e.g. Nginx + Basic Auth, Authelia, Authentik).
  • Dry Run mode is recommended for first-time deploys on production systems.

Contributing

Pull requests welcome. For major changes please open an issue first.


License

MIT

About

A full provisioner web frontend application to deploy and install applications/configurations on Linux based hosts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors