-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'os2subsites' into develop
- Loading branch information
Showing
15 changed files
with
1,151 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,72 @@ | |
# Copy and rename this file to .env at root of this project. | ||
# | ||
|
||
# Uncomment and populate as needed. | ||
## Subsite admin UI db creadentials | ||
MYSQL_DATABASE=os2subsites | ||
MYSQL_HOSTNAME=mariadb | ||
MYSQL_ROOT_PASSWORD=root | ||
MYSQL_PASSWORD=os2subsites | ||
MYSQL_PORT=3306 | ||
MYSQL_USER=os2subsites | ||
|
||
## Drupal salt | ||
DRUPAL_HASH_SALT=w-NR7Q2C3URQH6qdRvDPlbxVqdvyGMbsOwyXgtqkdJGNI7FBMbrD79UMx2DDNlSqvfmY-OOKLw | ||
## Domain suffix that would be used for subsites | ||
DOMAIN_SUFFIX=os2subsites.local | ||
## Path to base site config directory | ||
BASE_SUBSITE_CONFIG_DIR=/opt/drupal/config/base.${DOMAIN_SUFFIX}/sync | ||
|
||
# OS2SUBSITE common varaibles. | ||
## Flag for using environment variables | ||
## Comment this variale to use values from `config.sh file` | ||
USE_ENV_CONFIG=1 | ||
## Drupal project root directory | ||
BASEDIR=/opt/drupal | ||
SERVERIP=127.0.0.1 | ||
## Default Drupal profile for subsites. | ||
## Use `base_config` value | ||
PROFILE=base_config | ||
ALLOWED_INSTALL_PROFILES=minimal,os2web | ||
## Email used for subsite admin user. | ||
EMAIL=[email protected] | ||
## Path to | ||
SCRIPTDIR=/opt/drupal/scripts/os2subsites_provision | ||
## Path to drush | ||
DRUSH=/usr/local/bin/drush | ||
## Database creadentials for creating subsite db. | ||
DBHOST=mariadb | ||
DBUSER_HOST=mariadb | ||
## External db provisioning. NOTE: To disable external provisioning you have to JUST comment variable | ||
EXTERNAL_DB_PROVISIONING=1 | ||
PROVISIONING_SOURCES_PATH=/opt/drupal/private/subsite-credentials | ||
## For internal db provisioning you have to specify directory to mysql db files are stored. It's used for db existing check. | ||
#DBDIR=/var/lib/mysql | ||
## Subsite admin pass | ||
ADMINPASS=admin | ||
## Path to subsite vhost template | ||
VHOSTTEMPLATE=${SCRIPTDIR}/../os2subsites_provision/os2subsites-vhost-template | ||
## Drupal document root directory path | ||
MULTISITE=${BASEDIR}/web | ||
## Path to file where subsites registering. | ||
SITESFILE=${MULTISITE}/sites/sites.php | ||
## Temp directory for subsites | ||
TMPDIRBASE=${BASEDIR}/tmp | ||
## Log directory for subsites | ||
LOGDIRBASE=${BASEDIR}/logs | ||
## Session directory for subsites | ||
SESSIONDIRBASE=${BASEDIR}/sessions | ||
## Username for subsite administrator user. User will be created on subsites. | ||
SITEADMIN=subsiteadmin | ||
## Apache webserver username. | ||
APACHEUSER=www-data | ||
## Root user name. Sometimes this variable is empty. | ||
USER=root | ||
# Version of Drupal core. Accepted values 7,8 | ||
DRUPAL=8 | ||
# Additional option for site-install command | ||
INSTALL_OPTIONS= | ||
|
||
## Variable used only in docker-compose.yaml | ||
COMPOSE_PROJECT_NAME=os2web-subsites-docker-compose | ||
# TAG= | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.env | ||
volumes/* | ||
!volumes/.keep | ||
logs/* | ||
!logs/.keep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,121 @@ Example: | |
``` | ||
|
||
`--push` - when you this option build will be pushed to docker hub. | ||
|
||
## Local developemnt through docker | ||
|
||
While main OS2Web solution is using Docksal for local development. It's easier for testing purposes to use bare docker-compose environment for OS2Web sibsutes. | ||
|
||
It expects that all action would be performed on Docker subsites folder .docker/os2web-subsites | ||
|
||
|
||
### Restart docker stack | ||
|
||
docker-compose down | ||
sudo rm -rf volumes/* | ||
docker volume rm os2web-subsites-docker-compose_mysql | ||
docker-compose up -d | ||
docker-compose exec php bash | ||
|
||
|
||
|
||
### Install subsites creator | ||
sudo -E -u www-data drush si --account-pass=admin -y && drush en bc_subsites admin_toolbar_tools -y | ||
|
||
|
||
### Entironments variables | ||
|
||
Define your .env file as it stated below | ||
``` | ||
# | ||
# Copy and rename this file to .env at root of this project. | ||
# | ||
# Uncomment and populate as needed. | ||
## Subsite admin UI db creadentials | ||
MYSQL_DATABASE=os2subsites | ||
MYSQL_HOSTNAME=mariadb | ||
MYSQL_ROOT_PASSWORD=root | ||
MYSQL_PASSWORD=os2subsites | ||
MYSQL_PORT=3306 | ||
MYSQL_USER=os2subsites | ||
## Drupal salt | ||
DRUPAL_HASH_SALT=w-NR7Q2C3URQH6qdRvDPlbxVqdvyGMbsOwyXgtqkdJGNI7FBMbrD79UMx2DDNlSqvfmY-OOKLw | ||
## Domain suffix that would be used for subsites | ||
DOMAIN_SUFFIX=os2subsites.local | ||
## Path to base site config directory | ||
BASE_SUBSITE_CONFIG_DIR=/opt/drupal/config/ay-test0604-3.${DOMAIN_SUFFIX}/sync | ||
# OS2SUBSITE common varaibles. | ||
## Flag for using environment variables | ||
## Comment this variale to use values from `config.sh file` | ||
USE_ENV_CONFIG=1 | ||
## Drupal project root directory | ||
BASEDIR=/opt/drupal | ||
SERVERIP=127.0.0.1 | ||
## Default Drupal profile for subsites. | ||
## Use `base_config` value | ||
PROFILE=base_config | ||
ALLOWED_INSTALL_PROFILES=minimal,os2web | ||
## Email used for subsite admin user. | ||
[email protected] | ||
## Path to | ||
SCRIPTDIR=/opt/drupal/scripts/os2subsites_provision | ||
## Path to drush | ||
DRUSH=/usr/local/bin/drush | ||
## Database creadentials for creating subsite db. | ||
DBHOST=mariadb | ||
DBUSER_HOST=mariadb | ||
### Optional varialbles. Leave it empty to user root as user name. | ||
DB_ROOT_USER=root | ||
### Optional varialbles. Leave it empty to user root user without password from localhost. | ||
DB_ROOT_PASSWORD=root | ||
## External db provisioning. NOTE: To disable external provisioning you have to JUST comment variable | ||
EXTERNAL_DB_PROVISIONING=1 | ||
PROVISIONING_SOURCES_PATH=/opt/drupal/private/subsite-credentials | ||
## For internal db provisioning you have to specify directory to mysql db files are stored. It's used for db existing check. | ||
#DBDIR=/var/lib/mysql | ||
## Subsite admin pass | ||
ADMINPASS=admin | ||
## Path to subsite vhost template | ||
VHOSTTEMPLATE=${SCRIPTDIR}/../os2subsites_provision/os2subsites-vhost-template | ||
## Drupal document root directory path | ||
MULTISITE=${BASEDIR}/web | ||
## Path to file where subsites registering. | ||
SITESFILE=${MULTISITE}/sites/sites.php | ||
## Temp directory for subsites | ||
TMPDIRBASE=${BASEDIR}/tmp | ||
## Log directory for subsites | ||
LOGDIRBASE=${BASEDIR}/logs | ||
## Session directory for subsites | ||
SESSIONDIRBASE=${BASEDIR}/sessions | ||
## Username for subsite administrator user. User will be created on subsites. | ||
SITEADMIN=subsiteadmin | ||
## Apache webserver username. | ||
APACHEUSER=www-data | ||
## Root user name. Sometimes this variable is empty. | ||
USER=root | ||
# Version of Drupal core. Accepted values 7,8 | ||
DRUPAL=8 | ||
# Additional option for site-install command | ||
INSTALL_OPTIONS= | ||
## Variable used only in docker-compose.yaml | ||
COMPOSE_PROJECT_NAME=os2web-subsites-docker-compose | ||
TAG=2.1.5-rc-BKDK-521 # <---- This value should be one you use for testing. | ||
WEB_SERVER_PORT=8098 | ||
``` | ||
|
||
### Handling domains | ||
|
||
Main domain for subsite creator is localhost:8098 | ||
|
||
NOTE: Port could be different if you changed `WEB_SERVER_PORT` variable. | ||
|
||
Each subsites domain should be defined in your local `/etc/hosts` file like: | ||
``` | ||
127.0.0.1 new-subsite.os2subsites.local | ||
``` | ||
|
||
NOTE: Domain suffix `.os2subsites.local` could be different if you changed `DOMAIN_SUFFIX` variable. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# DO NOT EDIT THIS VHOST. IT WILL BE MODIFIED BY SCRIPTS. (The includes for access limits and ServerAliases) | ||
<VirtualHost *:80> | ||
<Directory [basedir]> | ||
AllowOverride All | ||
Options FollowSymLinks | ||
</Directory> | ||
|
||
ServerAdmin [email protected] | ||
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 /dev/stderr | ||
php_value session.save_path [basedir]/sessions/[domain] | ||
php_admin_value upload_tmp_dir [basedir]/tmp/[domain] | ||
|
||
php_value log_errors 1 | ||
php_value html_errors 0 | ||
php_value display_errors 0 | ||
php_admin_value error_reporting 2047 | ||
php_admin_value max_execution_time 180 | ||
</VirtualHost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
www-data ALL=(root) NOPASSWD:SETENV: /opt/drupal/scripts/os2subsites_provision/subsite_add_domain.sh | ||
www-data ALL=(root) NOPASSWD:SETENV: /opt/drupal/scripts/os2subsites_provision/subsite_create.sh | ||
www-data ALL=(root) NOPASSWD:SETENV: /opt/drupal/scripts/os2subsites_provision/subsite_delete.sh | ||
www-data ALL=(root) NOPASSWD:SETENV: /opt/drupal/scripts/os2subsites_provision/subsite_remove_domain.sh | ||
www-data ALL=(root) NOPASSWD:SETENV: /opt/drupal/scripts/os2subsites_provision/phase1.sh | ||
www-data ALL=(root) NOPASSWD:SETENV: /opt/drupal/scripts/os2subsites_provision/phase2.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?php | ||
include $app_root . '/sites/shared.settings.php'; |
Oops, something went wrong.