setup-proxy-containers.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/bash
  2. function fail {
  3. msg=$1
  4. echo
  5. echo $msg
  6. echo
  7. exit 5
  8. }
  9. NUM_DATA_CTR=$(docker ps -a | grep -c proxy-shared-data-1)
  10. [ "$NUM_DATA_CTR" -ne 0 ] && fail "ERROR: proxy-shared-data-1 exists"
  11. # pre-cache the container images
  12. echo
  13. timeout --signal TERM --kill-after 30 600 docker pull busybox:latest || fail "ERROR: docker pull of busybox failed"
  14. echo
  15. # WORKAROUND: Setup the shared data container
  16. /usr/bin/docker run --name "proxy-shared-data-1" \
  17. -v /shared/etc/haproxy \
  18. -v /shared/etc/httpd \
  19. -v /shared/etc/openshift \
  20. -v /shared/etc/pki \
  21. -v /shared/var/run/ctr-ipc \
  22. -v /shared/var/lib/haproxy \
  23. -v /shared/usr/local \
  24. "busybox:latest" true
  25. # WORKAROUND: These are because we're not using a pod yet
  26. cp /usr/local/etc/ctr-proxy-1.service /usr/local/etc/ctr-proxy-puppet-1.service /usr/local/etc/ctr-proxy-monitoring-1.service /etc/systemd/system/
  27. systemctl daemon-reload
  28. echo
  29. echo -n "sleeping 10 seconds for systemd reload to take affect..."
  30. sleep 10
  31. echo " Done."
  32. # Start the services
  33. systemctl start ctr-proxy-puppet-1 ctr-proxy-1 ctr-proxy-monitoring-1