#!/usr/bin/env ssm

# Example application that depends on PostgreSQL.
#
# service_depends_ready makes ssm start the postgres service and wait
# for it to report ready before starting this one.

service_respawn = always
service_depends_ready = postgres
service_command = /usr/bin/webapp --config /etc/webapp/config.toml

# Wait for the app to answer on its HTTP port. ssm polls this hook until
# the ready timeout expires.
ready() {
    (exec 3<>/dev/tcp/127.0.0.1/8080) 2>/dev/null
}
