You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.3 KiB

  1. #!/bin/bash
  2. ## Init is run on host
  3. ## For now it is run every time the script is launched, but
  4. ## it should be launched only once after build.
  5. ## Accessible variables are:
  6. ## - SERVICE_NAME Name of current service
  7. ## - DOCKER_BASE_IMAGE Base image from which this service might be built if any
  8. ## - SERVICE_DATASTORE Location on host of the DATASTORE of this service
  9. ## - SERVICE_CONFIGSTORE Location on host of the CONFIGSTORE of this service
  10. APACHE_LOG_DIR=/var/log/apache2
  11. set -u
  12. cat <<EOF | file_put "$SERVICE_DATASTORE/var/www/html/.htaccess"
  13. <IfModule mod_rewrite.c>
  14. RewriteEngine On
  15. RewriteCond %{HTTPS} off
  16. RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  17. </IfModule>
  18. EOF
  19. cat <<EOF | file_put "$SERVICE_CONFIGSTORE/etc/apache2/sites-enabled/000-default.conf"
  20. <VirtualHost *:80>
  21. ServerAdmin webmaster@localhost
  22. DocumentRoot /var/www/html
  23. <Directory />
  24. Options FollowSymLinks
  25. AllowOverride None
  26. </Directory>
  27. <Directory /var/www/html>
  28. Options Indexes FollowSymLinks MultiViews
  29. AllowOverride all
  30. Order allow,deny
  31. allow from all
  32. </Directory>
  33. ErrorLog ${APACHE_LOG_DIR}/error.log
  34. CustomLog ${APACHE_LOG_DIR}/access.log combined
  35. </VirtualHost>
  36. EOF