Skip to content

Adityasiig/Opensips-Deploy

Repository files navigation

Opensips-Deploy

CI License: MIT PHP Docker OpenSIPS

Status: initial public release - v0.1.0. Docker build and CI are green. See the Releases page for changelog.

Docker-wrapped opensips-deploy UI. The repo ships with a real working OpenSIPS snapshot in bundle/, so a clone is deploy-ready - no source server SSH, no manual file copying.

Architecture

Rough shape of it:

    laptop / docker
    +------------------------------+
    |                              |
    |  web UI --triggers--> deploy*.sh
    |  (php+apache :80)      |
    |                        v
    |                    bundle/
    |                    (opensips.cfg,
    |                     opensips_dump.sql,
    |                     opensips-cp.tar.gz)
    |                              |
    +-----------+------------------+
                | ssh + scp
                v
          target server
          (fresh or existing OpenSIPS)

The bundle/ directory is the snapshot of a working OpenSIPS source, so there is no live SSH to a remote source server at deploy time. On first container start an entrypoint seeds bundle/ from the demo templates in examples/. For real deploys you replace bundle/* with a real snapshot.

What's inside

Opensips-Deploy/
├── Dockerfile              # PHP 8.2 + Apache + sshpass + mysql-client
├── docker-compose.yml      # one-command stand-up
├── docker-entrypoint.sh    # safety-net: reseeds bundle from examples if empty
├── .dockerignore
├── .editorconfig
├── .env.example            # overridable env vars for the deploy scripts
├── .gitignore
├── .gitattributes          # forces LF on shell scripts
├── .github/
│   ├── ISSUE_TEMPLATE/
│   ├── pull_request_template.md
│   └── workflows/ci.yml    # shellcheck + hadolint + php -l + docker build
├── CONTRIBUTING.md
├── SECURITY.md
├── LICENSE
├── app/                    # the PHP/bash deploy UI
│   ├── index.php           # dashboard
│   ├── deploy.php
│   ├── deploy.sh           # upgrade flow
│   ├── deploy-fresh.sh     # fresh install
│   ├── deploy-standalone.sh# direct on-target run, no UI
│   ├── icon.svg
│   ├── manifest.json
│   ├── servers.json        # empty starter
│   ├── users.json          # empty starter (admin/admin123 auto-seed)
│   └── logs/
├── bundle/                 # READY-TO-DEPLOY snapshot - committed
│   ├── opensips.cfg
│   ├── opensips-cli.cfg
│   ├── scenario_callcenter.xml
│   ├── getip.sh
│   ├── opensips-cp.tar.gz
│   ├── opensips_dump.sql
│   └── README.md
└── examples/               # backup templates if you ever wipe bundle/
    ├── opensips.cfg.example
    ├── opensips-cli.cfg.example
    ├── scenario_callcenter.xml.example
    ├── getip.sh.example
    └── opensips_dump.sql.example

The bundle/ directory now ships with a real working OpenSIPS snapshot captured from production. Anyone who clones can run docker compose up -d --build and get a deploy-ready UI in one go.

If you wipe bundle/ for any reason (testing, sanitization), the docker entrypoint reseeds it from examples/ so the UI still loads.

Quick start

git clone https://github.com/Adityasiig/Opensips-Deploy.git
cd Opensips-Deploy
docker compose up -d --build

Open http://localhost:8080/opensips-deploy/ in a browser.

That's it. The entrypoint seeds bundle/ from examples/ the first time, so the UI loads immediately and the container becomes clickable.

Windows-specific notes

Works on Windows via Docker Desktop (WSL2 backend). No need to install sshpass, mysql-client, sed, etc. on Windows itself - all of that runs inside the Linux container.

Refreshing the bundle

Replace the demo seed with a real snapshot captured from a working OpenSIPS server. The entrypoint never overwrites existing files, so your real data stays put across restarts. The full list of expected artifacts lives in bundle/README.md; short version:

# on the reference OpenSIPS server
sudo cp /etc/opensips/opensips.cfg              ./bundle/
sudo cp /etc/opensips/opensips-cli.cfg          ./bundle/  2>/dev/null || true
sudo cp /etc/opensips/scenario_callcenter.xml   ./bundle/  2>/dev/null || true
sudo cp /etc/opensips/getip.sh                  ./bundle/  2>/dev/null || true
sudo tar czf ./bundle/opensips-cp.tar.gz -C /var/www/html opensips-cp
mysqldump -uroot -p<password> opensips > ./bundle/opensips_dump.sql

# optional: clear the demo-seed marker so it's obviously real data
rm -f ./bundle/.demo-seed

# on the machine running docker
docker compose restart

To force a fresh reseed from templates, empty the bundle/ directory (keep README.md) before restarting:

find ./bundle -mindepth 1 -not -name README.md -delete
docker compose restart

Deploy-standalone mode

If you don't want the UI and just want to run the deploy directly on a fresh target server:

# on the target (as root, with the bundle/ dir copied alongside)
BUNDLE_DIR=/path/to/bundle bash deploy-standalone.sh

Security notes

  • app/users.json and app/servers.json ship empty. Add your own admin account through the UI's first-run flow.
  • Demo content in examples/ is public and safe - no real credentials.
  • A populated bundle/ contains real credentials (MySQL in opensips.cfg, subscriber/accounting data in opensips_dump.sql). Treat the directory as sensitive; the repo's .gitignore keeps its contents out of git.
  • The deploy scripts still use sshpass for target access. That's fine for a lab / internal tool; for production consider key-based auth.
  • See SECURITY.md for vulnerability reporting.

Troubleshooting

Symptom Fix
UI loads but deploys fail with "no subscribers" / "no gateways" You're running on the demo seed. Populate bundle/ with real data (see Refreshing the bundle).
I want a fresh demo seed Delete bundle/* (keep bundle/README.md) and restart the container.
Port 8080 already in use Change 8080:80 in docker-compose.yml to another host port.
Deploy logs empty Check the host logs/ directory - that is where .log / .status / .pid files land.
MySQL import fails on target Target must have MySQL reachable with credentials that match the DB_USER / DB_PASS in the scripts; override via env vars in docker-compose.yml.
Entrypoint says "bundle/ looks empty" every time The volume mount path is wrong or not writable. Check docker-compose.yml has - ./bundle:/var/www/html/opensips-deploy/bundle (no :ro).
CI failing on your fork Shellcheck and hadolint are strict; run them locally (shellcheck app/*.sh, hadolint Dockerfile) before pushing.

Contributing

See CONTRIBUTING.md. Bugs / feature requests go through the issue templates in .github/ISSUE_TEMPLATE/.

About

Local, Docker-packaged OpenSIPS deployment UI. Bundle-driven - no source server required.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors