Skip to content

Deployment Guide

Deploying iond - Complete guide for deploying to production.


iond can be deployed as:

  1. Standalone Backend - Full application with WebSocket support
  2. Server Microservice - Lightweight REST API
  3. Docker Container - Containerized deployment

RequirementNotes
Linux serverUbuntu 22.04+ recommended
PostgreSQL 14+For backend database
NginxOptional, for reverse proxy
DockerOptional, for containerized deployment

Terminal window
# Update system
sudo apt update && sudo apt upgrade -y
# Install dependencies
sudo apt install -y postgresql postgresql-contrib nginx
# Create app user
sudo useradd -m -s /bin/bash iond
Terminal window
# Create PostgreSQL user and database
sudo -u postgres psql
CREATE USER iond WITH PASSWORD 'secure_password';
CREATE DATABASE iond OWNER iond;
GRANT ALL PRIVILEGES ON DATABASE iond TO iond;
\q
Terminal window
# Copy binary
sudo mkdir -p /opt/iond
sudo cp bin/iond /opt/iond/
sudo chown -R iond:iond /opt/iond
# Create storage directories
sudo mkdir -p /opt/iond/storage/{dbs,store,repos}
sudo chown -R iond:iond /opt/iond/storage
# Create environment file
sudo nano /opt/iond/.env
/opt/iond/.env
PORT=8000
DATABASE_URL=postgres://iond:secure_password@localhost:5432/iond?sslmode=disable
ENVIRONMENT=production
FLOW_DB_PATH=/opt/iond/storage/dbs
STORE_DB_PATH=/opt/iond/storage/store
REPO_PATH=/opt/iond/storage/repos
/etc/systemd/system/iond.service
[Unit]
Description=iond Backend
After=network.target postgresql.service
[Service]
Type=simple
User=iond
WorkingDirectory=/opt/iond
EnvironmentFile=/opt/iond/.env
ExecStart=/opt/iond/iond
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
Terminal window
# Enable and start service
sudo systemctl daemon-reload
sudo systemctl enable iond
sudo systemctl start iond
# Check status
sudo systemctl status iond
/etc/nginx/sites-available/iond
upstream iond {
server 127.0.0.1:8000;
}
server {
listen 80;
server_name flow.example.com;
location / {
proxy_pass http://iond;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Terminal window
# Enable site
sudo ln -s /etc/nginx/sites-available/iond /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx

docker-compose.yml
version: '3.8'
services:
iond:
image: iond:latest
build: .
ports:
- "8000:8000"
environment:
- PORT=8000
- DATABASE_URL=postgres://iond:password@db:5432/iond?sslmode=disable
- ENVIRONMENT=production
volumes:
- ./storage:/app/storage
depends_on:
- db
restart: unless-stopped
db:
image: postgres:14-alpine
environment:
- POSTGRES_USER=iond
- POSTGRES_PASSWORD=password
- POSTGRES_DB=iond
volumes:
- postgres_data:/var/lib/postgresql/data
restart: unless-stopped
volumes:
postgres_data:
Terminal window
# Deploy
docker-compose up -d
# View logs
docker-compose logs -f iond

For lightweight deployments:

Terminal window
# Deploy server only
sudo mkdir -p /opt/flow-server
sudo cp bin/flow-server /opt/flow-server/
sudo mkdir -p /opt/flow-server/storage
# Systemd service
# /etc/systemd/system/flow-server.service
[Unit]
Description=iond Server
After=network.target
[Service]
Type=simple
ExecStart=/opt/flow-server/flow-server -port 8080 -path /opt/flow-server/storage
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target

Terminal window
# Install certbot
sudo apt install certbot python3-certbot-nginx
# Get certificate
sudo certbot --nginx -d flow.example.com
# Auto-renewal
sudo systemctl enable certbot.timer

Terminal window
# Add health endpoint check
curl http://localhost:8000/health
Terminal window
# View logs
sudo journalctl -u iond -f
# Docker logs
docker logs -f iond
Terminal window
# Using htop
htop -p $(pgrep iond)
# Memory usage
ps aux | grep iond

/opt/iond/scripts/backup.sh
#!/bin/bash
DATE=$(date +%Y%m%d_%H%M%S)
BACKUP_DIR=/opt/iond/backups
# PostgreSQL backup
pg_dump -U iond iond > ${BACKUP_DIR}/db_${DATE}.sql
# SQLite backups
cp -r /opt/iond/storage/dbs ${BACKUP_DIR}/dbs_${DATE}
# Cleanup old backups (keep 7 days)
find ${BACKUP_DIR} -mtime +7 -delete
Terminal window
# Daily backup at 2am
0 2 * * * /opt/iond/scripts/backup.sh

For multiple instances:

  • Use PostgreSQL for shared state
  • Use Redis for session management
  • Use load balancer for distribution
upstream iond_cluster {
server 10.0.0.1:8000;
server 10.0.0.2:8000;
server 10.0.0.3:8000;
}
server {
listen 80;
server_name flow.example.com;
location / {
proxy_pass http://iond_cluster;
# ... other proxy settings
}
}

  • Use HTTPS with valid SSL certificate
  • Configure firewall (UFW/iptables)
  • Use strong database passwords
  • Restrict database access to localhost
  • Regular security updates
  • Log monitoring
  • Backup verification

Terminal window
# Check logs
sudo journalctl -u iond -n 50
# Check permissions
ls -la /opt/iond/
# Test manually
sudo -u iond /opt/iond/iond
Terminal window
# Test PostgreSQL connection
psql -h localhost -U iond -d iond
# Check PostgreSQL status
sudo systemctl status postgresql
Terminal window
# Check port usage
sudo lsof -i :8000
sudo netstat -tlnp | grep 8000