Setup Backend Hexaflate
Menjalankan backend (termasuk Redis dan S3 opsional)
Backend Hexaflate Setup
Menjalankan backend Hexaflate.
Prasyarat
- SQL Server dengan database Otomax
- Token dari portal.hexaflate.com
- Redis server 6+ (cache dan session management)
Konfigurasi Server
Login ke portal.hexaflate.com dan atur di menu Server Config:
SQL Server
Koneksi database Otomax dan Hexaflate menggunakan connection string:
SQL_SERVER_OTOMAX=Server=localhost,1433;Database=otomax;User Id=sa;Password=YourStrong@Passw0rd;Encrypt=false;TrustServerCertificate=true;Application Name=hexcate;
SQL_SERVER_HEXAFLATE=Server=localhost,1433;Database=hexaflate;User Id=sa;Password=YourStrong@Passw0rd;Encrypt=false;TrustServerCertificate=true;Application Name=hexcate;
Sesuaikan Server, Database, User Id, dan Password dengan environment masing-masing.
Redis
REDIS_URL=redis://your-redis-host:6379
| Skenario | Contoh REDIS_URL |
|---|---|
| Redis di server yang sama (Linux) | redis://172.17.0.1:6379 |
| Redis di server yang sama (Windows Docker Desktop) | redis://host.docker.internal:6379 |
| Redis dengan password | redis://:password@host:6379 |
| Redis server eksternal | redis://host:6379 |
Server
PORT=7630
REST_HTTP_ADDRESSES=https://web.example.com
CORS_ALLOWED_ORIGINS=https://web.example.com
S3 Storage (Opsional — untuk multi-cluster)
Hanya diperlukan jika menjalankan banyak instance backend. Single instance bisa lewati.
S3_ENABLED=false
S3_BUCKET=hexaflate
S3_REGION=us-east-1
S3_ACCESS_KEY_ID=your-access-key
S3_SECRET_ACCESS_KEY=your-secret-key
S3_ENDPOINT=http://192.168.1.100:9000
Catatan: Kosongkan S3_ENDPOINT jika menggunakan AWS S3. Bucket harus sudah dibuat sebelumnya.
Opsi 1: Binary Release
Download binary dari GitHub Releases.
Jalankan via terminal console atau powershell:
Linux:
chmod +x hexdial-api
./hexdial-api --token YOUR_AUTH_TOKEN
Windows:
.\hexdial-api.exe --token YOUR_AUTH_TOKEN
Catatan: untuk selanjutnya, tidak perlu jalankan dengan flag --token.
Multiple Instance
Jalankan beberapa instance dengan port berbeda:
./hexdial-api --token YOUR_TOKEN --port 3000 &
./hexdial-api --token YOUR_TOKEN --port 3001 &
./hexdial-api --token YOUR_TOKEN --port 3002 &
Leader election otomatis via Redis — instance pertama jadi leader.
Opsi 2: Docker
Linux:
docker run -d --name hexaflate --restart unless-stopped -p 7630:7630 -v $HOME/hexdial:/home/appuser hexaflate/hexaflate:latest --token YOUR_AUTH_TOKEN
Windows:
docker run -d --name hexaflate --restart unless-stopped -p 7630:7630 -v "${env:USERPROFILE}\hexdial:/home/appuser" hexaflate/hexaflate:latest --token YOUR_AUTH_TOKEN
Ganti YOUR_AUTH_TOKEN dengan token dari portal.
Contoh dengan custom port:
docker run -d --name hexaflate -p 3000:3000 hexaflate/hexaflate:latest --token YOUR_TOKEN --port 3000
Flags & Environment Variables
| Flag | ENV | Default | Keterangan |
|---|---|---|---|
--token <value> | TOKEN | — | Authentication token (wajib) |
--bind <address> | BIND | 0.0.0.0 | Bind address |
--port <port> | PORT | dari config | Port number |
--ping | — | — | Test Redis dan exit |
Prioritas: Flag > ENV > Firestore config.
Login Web Report
Buka http://localhost:7630 di browser untuk inisiasi akun admin.
Firewall
Pastikan port yang digunakan (default: 7630) terbuka di firewall:
sudo ufw allow 7630/tcp