Skip to content

Commit

Permalink
BKDK-521 Adjustemts for os2web-subsites
Browse files Browse the repository at this point in the history
  • Loading branch information
andriyun committed Apr 6, 2022
1 parent 25f3d97 commit c4df206
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .docker/os2web-subsites/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.env
volumes/*
!volumes/.keep
logs/*
!logs/.keep
10 changes: 3 additions & 7 deletions .docker/os2web-subsites/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@ RUN set -eux; \

# Adding subsites provisioner script.
RUN set -eux; \
sed -i "s/\"installer-paths\": {/\"installer-paths\": {\"scripts\/{\$name\}\": \[\"bellcom\/os2subsites_provision\"\],/g" composer.json; \
export COMPOSER_HOME="$(mktemp -d)"; \
echo "Loading bellcom/os2subsites_provision 05042022"; \
composer require bellcom/os2subsites_provision:dev-master; \
ln -s /opt/drupal/scripts/os2subsites_provision/8.x/bc_subsites /opt/drupal/web/modules/custom/; \
# delete composer cache.
rm -rf "$COMPOSER_HOME"
git clone -n https://github.com/bellcom/os2subsite_provision.git /opt/drupal/scripts/os2subsites_provision; \
cd /opt/drupal/scripts/os2subsites_provision && git checkout e1288f4a62ca94f191c17f9d497bd9fda9a82f61; \
ln -s /opt/drupal/scripts/os2subsites_provision/8.x/bc_subsites /opt/drupal/web/modules/custom/

# Adding further site specific data to image.
RUN chown -R www-data:www-data /opt/drupal/tmp /opt/drupal/logs /opt/drupal/translations; \
Expand Down
28 changes: 28 additions & 0 deletions .docker/os2web-subsites/apache/000-default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<VirtualHost *:80>
<Directory /opt/drupal>
AllowOverride All
Options FollowSymLinks
</Directory>

ServerAdmin [email protected]
DocumentRoot /var/www/html

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

SetEnvIf X-Forwarded-Proto https HTTPS=on

php_admin_value open_basedir /opt/drupal:/usr/share/php
php_value include_path .:/opt/drupal

php_value log_errors 1
php_value html_errors 0
php_value display_errors 0
php_admin_value error_reporting 1023
php_value error_log /dev/stderr

php_value session.save_path /opt/drupal/sessions
php_admin_value upload_max_filesize 128M
php_admin_value post_max_size 128M
php_admin_value upload_tmp_dir /opt/drupal/tmp/default
</VirtualHost>
8 changes: 2 additions & 6 deletions .docker/os2web-subsites/apache/os2subsites-vhost-template
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,18 @@
<Directory [basedir]>
AllowOverride All
Options FollowSymLinks
# Uncommenting below will only allow a limited number of Bellcom IPs access to the site
#Include /etc/apache2/limit-bellcom.conf
# Below blocks access without auth if the domain ends with bellcom.dk
#Include /etc/apache2/limit-subsite-access.conf
</Directory>

ServerAdmin [email protected]
DocumentRoot [basedir]/public_html
DocumentRoot /var/www/html
ServerName [domain]

CustomLog ${APACHE_LOG_DIR}/access.log combined
ErrorLog ${APACHE_LOG_DIR}/error.log

php_admin_value open_basedir [basedir]:/usr/share/php
php_value include_path .:[basedir]
php_value error_log ${APACHE_LOG_DIR}/error.log
php_value error_log /dev/stderr
php_value session.save_path [basedir]/sessions/[domain]
php_admin_value upload_tmp_dir [basedir]/tmp/[domain]

Expand Down
6 changes: 2 additions & 4 deletions .docker/os2web-subsites/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ networks:
volumes:
mysql:
driver: local
os2web:
driver: local
services:

# General application container.
Expand All @@ -22,8 +20,8 @@ services:
- ./logs:/var/log:delegated
- ./volumes/drupal/private:/opt/drupal/private
- ./volumes/drupal/web/sites:/opt/drupal/web/sites
- ./volumes/apache/sites-availbale:/etc/apache/sites-availbale
- ./volumes/apache/sites-enabled:/etc/apache/sites-enabled
- ./volumes/apache2/sites-available:/etc/apache2/sites-available
- ./volumes/apache2/sites-enabled:/etc/apache2/sites-enabled
- ./volumes/config:/opt/drupal/config
- ./volumes/crontabs:/var/spool/cron/crontabs
- ./volumes/tmp:/opt/drupal/tmp
Expand Down
36 changes: 36 additions & 0 deletions .docker/os2web-subsites/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
# Starting cron service.
service cron start

# Check basic file structure for subsites creator
if [ ! -f "/etc/apache2/sites-available/000-default.conf" ]
then
cp -f /opt/drupal/.docker/os2web-subsites/apache/000-default.conf /etc/apache2/sites-available/000-default.conf
ln -sf /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-enabled/000-default.conf
fi

# Check basic file structure for subsites creator
if [ ! -d "/opt/drupal/web/sites/default" ]
then
Expand All @@ -16,6 +23,35 @@ then
chown -R www-data:www-data /opt/drupal/web/sites
fi

# Check basic file structure for subsites creator
if [ ! -f "/opt/drupal/web/sites/sites.php" ]
then
echo "Creating web/sites/sites.php"
echo "<?php" > /opt/drupal/web/sites/sites.php
chown www-data:www-data /opt/drupal/web/sites/sites.php
fi

# Check default config dir
if [ ! -f "/opt/drupal/config/default" ]
then
mkdir -p /opt/drupal/config/default
chown www-data:www-data -R /opt/drupal/config
fi

# Check default temp dir
if [ ! -f "/opt/drupal/tmp/default" ]
then
mkdir -p /opt/drupal/tmp/default
chown www-data:www-data -R /opt/drupal/tmp
fi

# Check default private dir
if [ ! -f "/opt/drupal/private/default" ]
then
mkdir -p /opt/drupal/private/default
chown www-data:www-data -R /opt/drupal/private
fi

# Copying shared settings file
cp -f /opt/drupal/.docker/os2web-subsites/settings/shared.settings.php /opt/drupal/web/sites/shared.settings.php

Expand Down
Binary file removed .docker/os2web-subsites/logs/apt/eipp.log.xz
Binary file not shown.
2 changes: 1 addition & 1 deletion .docker/os2web-subsites/settings/settings.local.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@

// Passing EXTERNAL_DB_PROVISIONING into Drupal settings.
if (getenv('EXTERNAL_DB_PROVISIONING')) {
$settings['external_db_provisioning'] = getenv('EXTERNAL_DB_PROVISIONING');
$config['bc_subsites.settings']['external_db_provisioning'] = getenv('EXTERNAL_DB_PROVISIONING');
}

0 comments on commit c4df206

Please sign in to comment.