Sha256: 65e24e22a99358dd08782835071bd5a3e65a1b711346a0c1039c9e17ec0b85c2

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

#!/bin/bash

echo -n "defining ambassador service '$1'... "

service_name=$1; shift

remote_host=$1; shift
remote_port=$1; shift

cat >"/etc/init/${service_name}.conf" <<EOF
stop on stopping docker

env HOME=/root

respawn
respawn limit 5 20

pre-start script
  . /etc/environment.local

  mkdir -p /run/docker/upstart-service-containers
  run_id=\$(docker-utils make-ref 5)
  echo "${service_name}" > '/run/docker/upstart-service-containers/${service_name}'
end script

post-stop script
  container_name="\$(cat '/run/docker/upstart-service-containers/${service_name}')"
  docker stop "\${container_name}" || :
  docker rm "\${container_name}" || :
  rm '/run/docker/upstart-service-containers/${service_name}'
end script

script
  . /etc/environment.local

  container_name="\$(cat '/run/docker/upstart-service-containers/${service_name}')"

  echo "starting container: \${container_name} (from bexio/amb:latest)..."

  running_container_id=\$(docker run -d \
    --name="\${container_name}" \
    "bexio/amb:latest" \
    '${remote_host}' '${remote_port}'
  )

  exec docker attach --sig-proxy=true "\${running_container_id}"
end script
EOF

echo "defined."

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
docker-utils-0.1.21 ./share/scripts/define-ambassador-service
docker-utils-0.1.20 ./share/scripts/define-ambassador-service