start.sh 837 B

123456789101112131415161718192021222324252627
  1. #!/bin/bash
  2. set -eu
  3. mkdir -p /app/data/public /run/app /run/apache2
  4. if [ ! -f "/app/data/public/index.html" ]; then
  5. cp /app/code/index.html /app/data/public/index.html
  6. fi
  7. if [ ! -f "/app/data/apache2-app.conf" ]; then
  8. cp /app/code/apache2-app.conf /app/data/apache2-app.conf
  9. fi
  10. sed -e "s@AuthLDAPURL .*@AuthLDAPURL ${LDAP_URL}/${LDAP_USERS_BASE_DN}?username??(objectclass=user)@" \
  11. -e "s@AuthLDAPBindDN .*@AuthLDAPBindDN ${LDAP_BIND_DN}@" \
  12. -e "s@AuthLDAPBindPassword .*@AuthLDAPBindPassword ${LDAP_BIND_PASSWORD}@" \
  13. -i /app/data/apache2-app.conf
  14. chown -R www-data:www-data /app/data /run
  15. echo "Cleanup apache pid"
  16. APACHE_CONFDIR="" source /etc/apache2/envvars
  17. rm -f "${APACHE_PID_FILE}"
  18. echo "Starting supervisor"
  19. exec /usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon -i lamp