I recently added infrastructure code to Syn to start multiple instances of the app on a remote server. Sharing here as some of this is likely useful for other apps as well.
The above script:
- starts however many servers you specify via
hc sandbox ...
- start hc nodes on ports 8000, 8001, 8002…
- and since hc binds to localhost only, we expose these servers via socat on 9000, 9001, 9002…
Bonus: We add a systemd syn.service startup file, so that we can run the script in the background, restart on crash, etc: