fork 0k-charms
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.

51 lines
1.4 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. rm -fv "$SERVICE_CONFIGSTORE/etc/apache2/sites-enabled/"*".conf"
  20. cat <<EOF | file_put "$SERVICE_CONFIGSTORE/etc/apache2/sites-enabled/000-default.conf"
  21. <VirtualHost *:80>
  22. ServerAdmin webmaster@localhost
  23. DocumentRoot /var/www/html
  24. <Directory />
  25. Options FollowSymLinks
  26. AllowOverride None
  27. </Directory>
  28. <Directory /var/www/html>
  29. Options Indexes FollowSymLinks MultiViews
  30. AllowOverride all
  31. Order allow,deny
  32. allow from all
  33. </Directory>
  34. ErrorLog ${APACHE_LOG_DIR}/error.log
  35. CustomLog ${APACHE_LOG_DIR}/access.log combined
  36. </VirtualHost>
  37. EOF