start.sh 964 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/bash
  2. set -eu
  3. mkdir -p /app/data/public /run/app /run/apache2
  4. # check if any index file exists
  5. for f in /app/data/public/index.*; do
  6. [ -e "$f" ] && echo "Do not override existing index file" || cp /app/code/index.html /app/data/public/index.html
  7. break
  8. done
  9. if [ ! -f "/app/data/apache2-app.conf" ]; then
  10. cp /app/code/apache2-app.conf /app/data/apache2-app.conf
  11. fi
  12. sed -e "s@AuthLDAPURL .*@AuthLDAPURL ${LDAP_URL}/${LDAP_USERS_BASE_DN}?username??(objectclass=user)@" \
  13. -e "s@AuthLDAPBindDN .*@AuthLDAPBindDN ${LDAP_BIND_DN}@" \
  14. -e "s@AuthLDAPBindPassword .*@AuthLDAPBindPassword ${LDAP_BIND_PASSWORD}@" \
  15. -i /app/data/apache2-app.conf
  16. ## hook for custom start script in /app/data/run.sh
  17. if [ -f "/app/data/run.sh" ]; then
  18. /bin/bash /app/data/run.sh
  19. fi
  20. chown -R www-data:www-data /app/data /run
  21. echo "Starting apache"
  22. APACHE_CONFDIR="" source /etc/apache2/envvars
  23. rm -f "${APACHE_PID_FILE}"
  24. exec /usr/sbin/apache2 -DFOREGROUND