Skip to content

Installation Guide

SafeCall is a comprehensive location tracking and safety system for enterprises. This guide covers installation, configuration, and management.

Overview

SafeCall consists of:

  • Server: Core application handling tracking, web interface, and API
  • Database: SQLite-based storage for beacons, users, and tracking data
  • Web Interface: Modern web application for management and monitoring
  • Supporting Services: Optional nginx (SSL), monit (monitoring), and cron (auto-updates)

Installation Architecture

The installer uses a two-phase design:

Phase 1 — install     Phase 2 — setup
────────────────      ──────────────────
Download binary       Guided wizard (6 prompts)
Copy scripts          Configure service
Write default config  Optional: nginx, cron
Print next steps      Run selftest

This separation means Phase 1 is safe to re-run (it only drops files) and Phase 2 can be re-run independently to reconfigure.

Prerequisites

  • OS: Linux (Ubuntu/Debian recommended)
  • Architecture: x86_64 or ARM64
  • Memory: 512MB+ RAM
  • Storage: 500MB free
  • Network: Internet connection for downloads
  • Root access: Required for installation

Quick Start

One-liner (install + setup with defaults)

bash
curl -fsSL https://updates.wantok.cz/download/safecall/installer | sudo bash -s -- --setup

This performs both phases automatically using sensible defaults. The service will be running when it completes.

bash
# Phase 1: Download files
curl -fsSL https://updates.wantok.cz/download/safecall/installer | sudo bash -s --

# Phase 2: Configure with guided wizard
cd /opt/safecall
sudo ./util.sh setup

The wizard asks 6 questions (service name, features, port, systemd, nginx, cron) — press Enter to accept each default.

Two-step with all defaults

bash
curl -fsSL https://updates.wantok.cz/download/safecall/installer | sudo bash -s --
cd /opt/safecall
sudo ./util.sh setup --defaults

Two-Phase Installation

Phase 1: install

Downloads the binary, scripts, and writes a default main.config.json. Does not start any services.

bash
# Default directory (/opt/safecall)
curl -fsSL https://updates.wantok.cz/download/safecall/installer | sudo bash -s --

# Custom directory
curl -fsSL https://updates.wantok.cz/download/safecall/installer | sudo bash -s -- --dir /custom/path

Files created by Phase 1:

FilePurpose
safecallMain binary
util.tsBundled TypeScript CLI
util.shBash wrapper for CLI
main.config.jsonDefault configuration
version.txtInstalled version
db/Database directory

Phase 2: setup

Configures the service with a guided wizard or --defaults.

bash
cd /opt/safecall
sudo ./util.sh setup              # interactive wizard
sudo ./util.sh setup --defaults   # accept all defaults

Wizard prompts (6 max):

#PromptDefault
1Service namesafecall
2Featuresbridge + safecall
3HTTP port8088
4Register systemd service?Yes
5Setup nginx with SSL?No
6Setup automatic updates?No

What setup does:

  1. Writes main.config.json with your choices
  2. Persists .service_name
  3. Creates and starts systemd service (if yes)
  4. Sets up nginx with self-signed SSL (if yes)
  5. Installs daily update cron job (if yes)
  6. Runs selftest to verify everything works

Commands Reference

All commands require root (sudo). If the CLI symlink is installed, use safecall <command>. Otherwise, use ./util.sh <command> from the install directory.

CommandDescription
install --dir <dir>Phase 1: download binary + scripts + default config
setup [--defaults]Phase 2: guided wizard to configure service
configShow current configuration (pretty-printed)
config editOpen config in $EDITOR (or nano), restart service
config set <key> <value>Set a single config key, restart service
config resetReset config to defaults, restart service
updateUpdate binary to latest version
repair --dir <dir>Re-download binary and scripts, recreate service
uninstallCompletely remove SafeCall (stops service, removes files)
selftestRun deployment health checks
test [--selftest|--full|--clean]Run tests (selftest, full VM suite, or cleanup)
statusShow service, monit, cron, and CLI status
service --user <user>Create/recreate systemd service
nginx --ip <ip>Setup nginx with SSL
cronSetup daily update cron job
user --createCreate a new user (interactive)
user --deleteDelete a user by email
user --reset-passwordReset default admin password
monitInstall and configure monit monitoring
generate --util-shRegenerate util.sh wrapper

Configuration

Viewing Configuration

bash
# Pretty-printed summary grouped by section
sudo safecall config

# Raw JSON
cat /opt/safecall/main.config.json

Editing Configuration

bash
# Open in editor (restarts service after save)
sudo safecall config edit

# Set a single value (restarts service)
sudo safecall config set server_http_port 9090
sudo safecall config set server_features '["safecall"]'

# Reset to defaults (restarts service)
sudo safecall config reset

Configuration Reference

The main.config.json file is organized into sections. See the Configuration page for full details.

Service Management

Systemd

bash
sudo systemctl status safecall
sudo systemctl start safecall
sudo systemctl stop safecall
sudo systemctl restart safecall

Health Checks

bash
# Quick selftest (checks files, config, DB, HTTP, service, disk)
sudo safecall selftest

# Full status overview
sudo safecall status

Updates

bash
# Manual update
sudo safecall update

# Automatic daily updates (via cron)
sudo safecall cron

User Management

bash
sudo safecall user --create          # interactive
sudo safecall user --delete          # by email
sudo safecall user --reset-password  # reset admin password

Troubleshooting

Service Won't Start

bash
sudo journalctl -u safecall -f
sudo safecall selftest
sudo safecall config

Port Conflicts

bash
ss -tlnp | grep :8088
sudo safecall config set server_http_port 9090

Permission Issues

bash
sudo chown -R root /opt/safecall
sudo safecall service --user root

Repair Installation

The repair command re-downloads the binary and scripts while preserving your config and database:

bash
sudo safecall repair --dir /opt/safecall

If the CLI itself is broken, re-run Phase 1 and then setup:

bash
curl -fsSL https://updates.wantok.cz/download/safecall/installer | sudo bash -s --
cd /opt/safecall
sudo ./util.sh setup --defaults

Complete Reinstall

bash
# Uninstall
sudo safecall uninstall

# Fresh install
curl -fsSL https://updates.wantok.cz/download/safecall/installer | sudo bash -s -- --setup

Advanced Usage

Custom Service User

bash
sudo useradd -r -s /bin/false safecall
sudo safecall service --user safecall

Nginx with Custom IP

bash
sudo safecall nginx --ip 192.168.1.100

Firewall

bash
sudo ufw allow 8088/tcp   # HTTP
sudo ufw allow 443/tcp    # HTTPS (with nginx)

File Locations

FileLocationPurpose
Binary/opt/safecall/safecallMain application
Config/opt/safecall/main.config.jsonConfiguration
Database/opt/safecall/db/safecall.dbData storage
Service/etc/systemd/system/safecall.serviceSystemd unit
CLI/usr/local/bin/safecallSymlink to util.sh
Service name/opt/safecall/.service_namePersisted service name
Version/opt/safecall/version.txtInstalled version