diff --git a/.env.default b/.env.default index 6156614..751b2cb 100644 --- a/.env.default +++ b/.env.default @@ -1,7 +1,44 @@ +# docker4drupal variables. +PROJECT_NAME=falcon +PROJECT_BASE_URL=flc.local + +DB_NAME=drupal +DB_USER=drupal +DB_PASSWORD=drupal +DB_ROOT_PASSWORD=password +DB_DRIVER=mysql + +DB_HOST_GIFTS=be_gifts_mariadb +DB_HOST_DONATIONS=be_donations_mariadb + +MARIADB_TAG=10.1-3.1.3 +PHP_TAG=7.1-dev-4.4.2 +# MacOS. +# PHP_TAG=7.1-dev-macos-4.4.2 +NGINX_TAG=8-1.13-4.1.0 + # Docker-compose environment variables - see https://docs.docker.com/compose/reference/envvars/ COMPOSE_FILE=./docker/docker-compose.yml:./docker/docker-compose.override.yml COMPOSE_PROJECT_NAME=falcon -# Base URL for local development. -# All microservices are subdomains to this one. -PROJECT_BASE_URL=flc.local +MODULES_GIFTS=falcon_demo_content default_content better_normalizers hal +MODULES_DONATIONS=falcon_demo_content default_content better_normalizers hal + +# Platform.sh related variables. +PLATFORM_PROJECT_ID=kkgqvmy5atnt2 +PLATFORM_ENVIRONMENT=master +PLATFORM_APPLICATION_GIFTS=backend-gifts +PLATFORM_APPLICATION_DONATIONS=backend-donations +PLATFORM_RELATIONSHIP_GIFTS=database +PLATFORM_RELATIONSHIP_DONATIONS=database + +# Local environment variables. +ENV=local-dev +BACKUP_DIR=backup +DB_DUMP_NAME_GIFTS=dump-gifts +DB_DUMP_NAME_DONATIONS=dump-donations +# On Linux machines you can put DB into memory - /dev/shm +# Possible values: ./mysql | /dev/shm +MYSQL_DATA_DIR=./mysql +MYSQL_DATA_DIR_GIFTS=gifts +MYSQL_DATA_DIR_DONATIONS=donations diff --git a/.gitignore b/.gitignore index 8a5d9c4..5a969d9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,17 @@ -# PHPStorm folder. +# PHPStorm directory. .idea -# Mac artifacts. +# MacOS Desktop Services Store files. .DS_Store -# Locally generated env file. -.env +# Docker mysql storage. +/docker/mysql/* +!/docker/mysql/.gitkeep -# Locally generated docker file with overrides. -docker/docker-compose.override.yml +# DB dumps/backups. +/backup/* +!/backup/.gitkeep + +# Environment overrides. +/.env +/docker/docker-compose.override.yml diff --git a/Makefile b/Makefile index dc4ad2e..391cca5 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,10 @@ -.PHONY: falcon falcon-install falcon-update drush test +.PHONY: default pull up stop down drush shell tests\:prepare tests\:run test install update # Make sure the local file with docker-compose overrides exist. -$(shell ! test -e \.\/docker\/docker-compose\.override\.yml && cat \.\/docker\/docker-compose\.override\.default\.yml > \.\/docker\/docker-compose\.override\.yml) +$(shell cp -n \.\/docker\/docker-compose\.override\.default\.yml \.\/docker\/docker-compose\.override\.yml) # Create a .env file if not exists and include default env variables. -$(shell ! test -e \.env && cat \.env.default > \.env) - -# Make all variables from the file available here. +$(shell cp -n \.env.default \.env) include .env # Define two users for with different permissions within the container. @@ -14,153 +12,240 @@ include .env docker-drupal = docker-compose exec --user=82:82 $(firstword ${1}) sh -c "$(filter-out $(firstword ${1}), ${1})" docker = docker-compose exec $(firstword ${1}) sh -c "$(filter-out $(firstword ${1}), ${1})" +cyan = `tput setaf 6` +bold = `tput bold` +reset = `tput sgr0` +message = @echo "${cyan}${bold}${1}${reset}" + +default: up + +pull: + $(call message,$(PROJECT_NAME): Updating Docker images) + docker-compose pull + +up: + $(call message,$(PROJECT_NAME): Build and run containers) + docker-compose up -d --remove-orphans + +stop: + $(call message,$(PROJECT_NAME): Stopping containers) + docker-compose stop + +down: + $(call message,$(PROJECT_NAME): Removing network & containers) + docker-compose down -v --remove-orphans + drush: # Remove the first argument from the list of make commands. $(eval ARGS := $(filter-out $@,$(MAKECMDGOALS))) - @echo Target is \"$(firstword $(ARGS))\" - @echo Executing \"drush -r /var/www/html/web $(filter-out $(firstword $(ARGS)), $(ARGS)) --yes\" - $(call docker-drupal, $(firstword $(ARGS)) drush -r /var/www/html/web $(filter-out $(firstword $(ARGS)), $(ARGS)) --yes) + $(eval TARGET := $(firstword $(ARGS))) + $(eval COMMAND_ARGS := $(filter-out $(TARGET), $(ARGS))) + $(call message,Target is \"$(TARGET)\") + $(call message,Executing \"drush -r /var/www/html/web $(COMMAND_ARGS) --yes\") + $(call docker-drupal, $(TARGET) drush -r /var/www/html/web $(COMMAND_ARGS) --yes) shell: # Remove the first argument from the list of make commands. $(eval ARGS := $(filter-out $@,$(MAKECMDGOALS))) - @echo Target is \"$(firstword $(ARGS))\" - @echo Executing \"shell $(filter-out $(firstword $(ARGS)), $(ARGS))\" - $(call docker-drupal, $(firstword $(ARGS)) $(filter-out $(firstword $(ARGS)), $(ARGS))) - -tests\:prepare: - # Prepare codeception to run. - $(call docker, be_gifts ./vendor/bin/codecept --config=tests/codeception build) - # Run Gifts frontend with SSR support to test SSR as well. - @docker-compose stop fe_gifts - @docker-compose run fe_gifts yarn build - @docker-compose run -d fe_gifts yarn start:server - # Give node.js server several seconds to initialize. - @sleep 5 + $(eval TARGET := $(firstword $(ARGS))) + $(eval COMMAND_ARGS := $(filter-out $(TARGET), $(ARGS))) + $(call message,Target is \"$(TARGET)\") + $(call message,Executing \"shell $(COMMAND_ARGS)\") + $(call docker-drupal, $(TARGET) $(COMMAND_ARGS)) -tests\:run: - $(MAKE) -s test be_gifts acceptance +########################### +# Container preparations. # +########################### -test: - # Remove the first argument from the list of make commands. - $(eval ARGS := $(filter-out $@,$(MAKECMDGOALS))) - @echo Target is \"$(firstword $(ARGS))\" - @echo Executing \"\./vendor/bin/codecept --config=tests/codeception run $(filter-out $(firstword $(ARGS)), $(ARGS))\" - $(call docker, $(firstword $(ARGS)) ./vendor/bin/codecept --config=tests/codeception run $(filter-out $(firstword $(ARGS)), $(ARGS)) --steps) +prepare: | pull prepare\:git prepare\:frontend\:gifts prepare\:frontend\:main \ +up prepare\:apibus prepare\:backend\:gifts prepare\:backend\:donations -env\:up: - @docker-compose up -d --remove-orphans +prepare\:git: + $(call message,Setting git config to ignore local files chmod) + @git config core.fileMode false -env\:down: - @docker-compose down --remove-orphans +prepare\:frontend\:gifts: | down + $(call message,FE Gifts: Installing yarn dependencies) + @docker-compose run --no-deps fe_gifts yarn install -######################################### -## Builds the falcon from the buttom up # -######################################### +prepare\:frontend\:main: | down + $(call message,FE Main: Installing yarn dependencies) + @docker-compose run --no-deps fe_main yarn install -falcon\:install: - @echo "Installing Falcon from the bottom up..." +prepare\:apibus: + $(call message,API Bus: Installing/updating composer dependencies) + -$(call docker, api_bus composer install) + $(call message,API Bus: Copying default local config file into the adjustable local config) + @cp ./backend-api-bus/src/config/local.default.php ./backend-api-bus/src/config/local.php - @echo "Setting git config to ignore local files chmod..." - @git config core.fileMode false +prepare\:backend\:gifts: + $(call message,BE Gifts: Installing/updating composer dependencies) + -$(call docker, be_gifts composer install) - @echo "###############################" - @echo "# Preparing Docker containers #" - @echo "###############################" +prepare\:backend\:donations: + $(call message,BE Donations: Installing/updating composer dependencies) + -$(call docker, be_donations composer install) - @echo "Making sure Docker is not running..." - @docker-compose down --remove-orphans - @echo "Fetching Docker images..." - docker-compose pull --parallel +##################### +# Files operations. # +##################### - @echo "############################" - @echo "# Preparing Gifts Frontend #" - @echo "############################" +files\:sync: | files\:sync\:gifts files\:sync\:donations - @echo "Installing yarn dependencies for Gifts Frontend..." - @docker-compose run --no-deps fe_gifts yarn install +files\:sync\:gifts: + platform mount:download -y --project=${PLATFORM_PROJECT_ID} --environment=${PLATFORM_ENVIRONMENT} --app=${PLATFORM_APPLICATION_GIFTS} \ +--mount=web/sites/default/files --target=backend-gifts/web/sites/default/files \ +--exclude=css/* --exclude=js/* --exclude=php/* --exclude=styles/* - @echo "###########################" - @echo "# Preparing Main Frontend #" - @echo "###########################" +files\:sync\:donations: + platform mount:download -y --project=${PLATFORM_PROJECT_ID} --environment=${PLATFORM_ENVIRONMENT} --app=${PLATFORM_APPLICATION_DONATIONS} \ +--mount=web/sites/default/files --target=backend-donations/web/sites/default/files \ +--exclude=css/* --exclude=js/* --exclude=php/* --exclude=styles/* - @echo "Installing yarn dependencies for Main Frontend..." - @docker-compose run --no-deps fe_main yarn install +files\:chown: files\:chown\:gifts files\:chown\:donations - # Spinning up all containers now. - docker-compose up -d --remove-orphans +files\:chown\:gifts: + -$(call docker, be_gifts chown -R 82:82 web/sites/default/files) - @echo "#####################" - @echo "# Preparing API BUS #" - @echo "#####################" +files\:chown\:donations: + -$(call docker, be_donations chown -R 82:82 web/sites/default/files) - @echo "Installing composer dependencies for API Bus..." - -$(call docker, api_bus composer install) - @echo "Copying default local config file for API bus into the adjustable local config..." - @cp ./backend-api-bus/src/config/local.default.php ./backend-api-bus/src/config/local.php +##################################### +# Installation from config profile. # +##################################### - @echo "###########################" - @echo "# Preparing Gifts backend #" - @echo "###########################" +install\:config: | prepare install\:config\:gifts install\:config\:donations - @echo "Installing composer dependencies for Gifts Backend..." - -$(call docker, be_gifts composer install) - @echo "Installing Gifts site..." +install\:config\:gifts: + $(call message,BE Gifts: Creating backup of settings.php) + $(call docker, be_gifts cp web/sites/default/settings.php web/sites/default/settings.backup.php) + $(call docker, be_gifts chmod 666 web/sites/default/settings.php) + $(call message,BE Gifts: Installing site) $(MAKE) -s drush be_gifts site-install config_installer - @echo "Installing the module to import demo content..." - $(MAKE) -s drush be_gifts en falcon_demo_content - @echo "Disabling unnecessary modules after demo content import..." - $(MAKE) -s drush be_gifts pmu falcon_demo_content default_content better_normalizers hal + $(call message,BE Gifts: Restoring backup of settings.php) + $(call docker, be_gifts cp web/sites/default/settings.backup.php web/sites/default/settings.php) + $(call docker, be_gifts rm web/sites/default/settings.backup.php) + $(call message,BE Gifts: Installing the module to import demo content) + $(MAKE) -s drush be_gifts en $(MODULES_GIFTS) + $(call message,BE Gifts: Disabling unnecessary modules after demo content import) + $(MAKE) -s drush be_gifts pmu $(MODULES_GIFTS) + +install\:config\:donations: + $(call message,BE Donations: Creating backup of settings.php) + $(call docker, be_donations cp web/sites/default/settings.php web/sites/default/settings.backup.php) + $(call docker, be_donations chmod 666 web/sites/default/settings.php) + $(call message,BE Donations: Installing site) + $(MAKE) -s drush be_donations site-install config_installer + $(call message,BE Donations: Restoring backup of settings.php) + $(call docker, be_donations cp web/sites/default/settings.backup.php web/sites/default/settings.php) + $(call docker, be_donations rm web/sites/default/settings.backup.php) + $(call message,BE Donations: Installing the module to import demo content) + $(MAKE) -s drush be_donations en $(MODULES_DONATIONS) + $(call message,BE Donations: Disabling unnecessary modules after demo content import) + $(MAKE) -s drush be_donations pmu $(MODULES_DONATIONS) - @echo "###############################" - @echo "# Preparing Donations backend #" - @echo "###############################" +#################################### +# Installation from database dump. # +#################################### - @echo "Installing composer dependencies for Donations Backend..." - -$(call docker, be_donations composer install) - @echo "Installing Donations site..." - $(MAKE) -s drush be_donations site-install config_installer - @echo "Installing the module to import demo content..." - $(MAKE) -s drush be_donations en falcon_demo_content - @echo "Disabling unnecessary modules after demo content import..." - $(MAKE) -s drush be_donations pmu falcon_demo_content default_content better_normalizers hal - -###################################################### -## Brings the falcon up to date with latest changes ## -###################################################### - -falcon\:update: - @echo "Updating the code from the git remote branch..." - @git pull origin $(git rev-parse --abbrev-ref HEAD) - - # Frontend restart is not needed, because dontainers restart will - # trigger yarn install anyway. - @echo "Restarting Docker containers..." - @docker-compose down --remove-orphans - docker-compose up -d --remove-orphans +install\:db: | install\:db\:gifts install\:db\:donations - @echo "Updating composer dependencies for Donations backend..." - -$(call docker, be_donations composer install) - @echo "Updating cache on Donations backend..." - $(MAKE) -s drush be_donations cr - @echo "Applying database updates on Donations backend..." - $(MAKE) -s drush be_donations updb - @echo "Importing configs into Donations backend..." - $(MAKE) -s drush be_donations cim - @echo "Applying entity updates on Donations backend..." - $(MAKE) -s drush be_donations entup +install\:db\:gifts: | prepare files\:sync\:gifts files\:chown\:gifts db\:dump\:gifts reinstall\:db\:gifts - @echo "Updating composer dependencies for Gifts backend..." - -$(call docker, be_gifts composer install) - @echo "Updating cache on Gifts backend..." +install\:db\:donations: | prepare files\:sync\:donations files\:chown\:donations db\:dump\:donations reinstall\:db\:donations + +reinstall\:db: | reinstall\:db\:gifts reinstall\:db\:donations + +reinstall\:db\:gifts: | db\:import\:gifts update\:gifts + +reinstall\:db\:donations: | db\:import\:donations update\:donations + +######################## +# Database operations. # +######################## + +db\:dump: | db\:dump\:gifts db\:dump\:donations + +db\:dump\:gifts: + $(call message,BE Gifts: Creating DB dump) + -$(shell platform db:dump -y --project=${PLATFORM_PROJECT_ID} --environment=${PLATFORM_ENVIRONMENT} --app=${PLATFORM_APPLICATION_GIFTS} --relationship=${PLATFORM_RELATIONSHIP_GIFTS} --gzip --file=${BACKUP_DIR}/${DB_DUMP_NAME_GIFTS}.sql.gz) + +db\:dump\:donations: + $(call message,BE Donations: Creating DB dump) + -$(shell platform db:dump -y --project=${PLATFORM_PROJECT_ID} --environment=${PLATFORM_ENVIRONMENT} --app=${PLATFORM_APPLICATION_DONATIONS} --relationship=${PLATFORM_RELATIONSHIP_DONATIONS} --gzip --file=${BACKUP_DIR}/${DB_DUMP_NAME_DONATIONS}.sql.gz) + +db\:drop: | db\:drop\:gifts db\:drop\:donations + +db\:drop\:gifts: + $(call message,BE Gifts: Dropping DB) + $(MAKE) -s drush be_gifts sql-drop + +db\:drop\:donations: + $(call message,BE Donations: Dropping DB) + $(MAKE) -s drush be_donations sql-drop + +db\:import: | db\:import\:gifts db\:import\:donations + +db\:import\:gifts: | db\:drop\:gifts + sleep 30 + $(call message,BE Gifts: Importing DB) + $(call docker-drupal, be_gifts zcat ${BACKUP_DIR}/${DB_DUMP_NAME_GIFTS}.sql.gz | drush sql-cli) + +db\:import\:donations: | db\:drop\:donations + sleep 30 + $(call message,BE Donations: Importing DB) + $(call docker-drupal, be_donations zcat ${BACKUP_DIR}/${DB_DUMP_NAME_DONATIONS}.sql.gz | drush sql-cli) + +#################### +# Update backends. # +#################### + +update: | prepare update\:gifts update\:donations + +update\:gifts: + $(call message,BE Gifts: Updating cache) $(MAKE) -s drush be_gifts cr - @echo "Applying database updates on Gifts backend..." + $(call message,BE Gifts: Applying database updates) $(MAKE) -s drush be_gifts updb - @echo "Importing configs into Gifts backend..." + $(call message,BE Gifts: Importing configs) $(MAKE) -s drush be_gifts cim - @echo "Applying entity updates on Gifts backend..." + $(call message,BE Gifts: Applying entity updates) $(MAKE) -s drush be_gifts entup +update\:donations: + $(call message,BE Donations: Updating cache) + $(MAKE) -s drush be_donations cr + $(call message,BE Donations: Applying database updates) + $(MAKE) -s drush be_donations updb + $(call message,BE Donations: Importing configs) + $(MAKE) -s drush be_donations cim + $(call message,BE Donations: Applying entity updates) + $(MAKE) -s drush be_donations entup + +########## +# Tests. # +########## + +tests\:prepare: + # Prepare codeception to run. + $(call docker, be_gifts ./vendor/bin/codecept --config=tests/codeception build) + # Run Gifts frontend with SSR support to test SSR as well. + @docker-compose stop fe_gifts + @docker-compose run fe_gifts yarn build + @docker-compose run -d fe_gifts yarn start:server + # Give node.js server several seconds to initialize. + @sleep 5 + +tests\:run: + $(MAKE) -s test be_gifts acceptance + +test: + # Remove the first argument from the list of make commands. + $(eval ARGS := $(filter-out $@,$(MAKECMDGOALS))) + $(call message,Target is \"$(firstword $(ARGS))\") + $(call message,Executing \"\./vendor/bin/codecept --config=tests/codeception run $(filter-out $(firstword $(ARGS)), $(ARGS))\") + $(call docker, $(firstword $(ARGS)) ./vendor/bin/codecept --config=tests/codeception run $(filter-out $(firstword $(ARGS)), $(ARGS)) --steps) + # https://stackoverflow.com/a/6273809/1826109 %: @: diff --git a/backend-donations/.gitignore b/backend-donations/.gitignore index 12214b3..cd046a8 100644 --- a/backend-donations/.gitignore +++ b/backend-donations/.gitignore @@ -6,9 +6,6 @@ web/modules/contrib web/themes/contrib web/profiles/contrib -# Ignore mysql files. -mysql - # Ignore Drupal's file directory web/sites/*/files diff --git a/backend-donations/composer.json b/backend-donations/composer.json index a4cb9a9..041e847 100644 --- a/backend-donations/composer.json +++ b/backend-donations/composer.json @@ -50,7 +50,7 @@ "drupal/ultimate_cron": "^2.0@alpha", "drupal/metatag": "^1.2", "drupal/config_ignore": "^2.0", - "drupal/config_installer": "^1.5", + "drupal/config_installer": "^1.8", "drupal/better_normalizers": "^1.0@beta", "drupal/default_content": "^1.0@alpha", "drupal/rest_absolute_urls": "^1.0@beta", diff --git a/backend-donations/composer.lock b/backend-donations/composer.lock index 7f18863..b00b730 100644 --- a/backend-donations/composer.lock +++ b/backend-donations/composer.lock @@ -1,10 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7a6ea28d70155016407399e8663ba154", + "content-hash": "69322ca69f76121b1b044bd63845f7ef", "packages": [ { "name": "alchemy/zippy", @@ -2125,17 +2125,17 @@ }, { "name": "drupal/config_installer", - "version": "1.5.0", + "version": "1.8.0", "source": { "type": "git", "url": "https://git.drupal.org/project/config_installer", - "reference": "8.x-1.5" + "reference": "8.x-1.8" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/config_installer-8.x-1.5.zip", - "reference": "8.x-1.5", - "shasum": "ef2ea56469481c482c1ee716438a24b4ad12c6e2" + "url": "https://ftp.drupal.org/files/projects/config_installer-8.x-1.8.zip", + "reference": "8.x-1.8", + "shasum": "43d7af76a3f00d074161e242ddf94d942d256250" }, "require": { "drupal/core": "~8.0" @@ -2146,8 +2146,8 @@ "dev-1.x": "1.x-dev" }, "drupal": { - "version": "8.x-1.5", - "datestamp": "1506257944", + "version": "8.x-1.8", + "datestamp": "1524572284", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -2156,7 +2156,7 @@ }, "notification-url": "https://packages.drupal.org/8/downloads", "license": [ - "GPL-2.0+" + "GPL-2.0-or-later" ], "authors": [ { diff --git a/backend-donations/web/sites/default/settings.php b/backend-donations/web/sites/default/settings.php index 1614b04..77c95e3 100644 --- a/backend-donations/web/sites/default/settings.php +++ b/backend-donations/web/sites/default/settings.php @@ -28,13 +28,6 @@ $settings['reverse_proxy'] = TRUE; $settings['reverse_proxy_addresses'] = [$_SERVER['REMOTE_ADDR']]; -// Error logging. -$config['system.logging']['error_level'] = 'verbose'; - -// Disable CSS and JS aggregation. -$config['system.performance']['css']['preprocess'] = FALSE; -$config['system.performance']['js']['preprocess'] = FALSE; - // Custom configs for sites based on Falcon. This folder is always empty // for Falcon repo. However, if you're basing your site on top of Falcon and // there are configs different from Falcon's, then you'll want to graylist @@ -42,6 +35,13 @@ $config['config_split.config_split.customizations']['status'] = TRUE; $config['config_split.config_split.development']['status'] = TRUE; +// Error logging. +$config['system.logging']['error_level'] = 'verbose'; + +// Disable CSS and JS aggregation. +$config['system.performance']['css']['preprocess'] = FALSE; +$config['system.performance']['js']['preprocess'] = FALSE; + // Enable test mode by default for all development environments, overridden for master in settings.platform.php. $config['falcon.settings']['test_mode_enabled'] = TRUE; diff --git a/backend-gifts/.gitignore b/backend-gifts/.gitignore index 12214b3..cd046a8 100644 --- a/backend-gifts/.gitignore +++ b/backend-gifts/.gitignore @@ -6,9 +6,6 @@ web/modules/contrib web/themes/contrib web/profiles/contrib -# Ignore mysql files. -mysql - # Ignore Drupal's file directory web/sites/*/files diff --git a/backend-gifts/composer.json b/backend-gifts/composer.json index 6293fd3..8b78c79 100644 --- a/backend-gifts/composer.json +++ b/backend-gifts/composer.json @@ -44,7 +44,7 @@ "drupal/field_group": "^1.0@RC", "drupal/config_ignore": "^2.1", "drupal/metatag": "^1.2", - "drupal/config_installer": "^1.5", + "drupal/config_installer": "^1.8", "drupal/default_content": "^1.0@alpha", "drupal/better_normalizers": "^1.0@beta", "drupal/config_filter": "^1.1", diff --git a/backend-gifts/composer.lock b/backend-gifts/composer.lock index c201200..fff9ef6 100644 --- a/backend-gifts/composer.lock +++ b/backend-gifts/composer.lock @@ -1,10 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "73130d1affe2016d0a18220b80ddde84", + "content-hash": "3025ad2edaa56db2a86907cfed4eaad4", "packages": [ { "name": "alchemy/zippy", @@ -1415,17 +1415,17 @@ }, { "name": "drupal/config_installer", - "version": "1.5.0", + "version": "1.8.0", "source": { "type": "git", "url": "https://git.drupal.org/project/config_installer", - "reference": "8.x-1.5" + "reference": "8.x-1.8" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/config_installer-8.x-1.5.zip", - "reference": "8.x-1.5", - "shasum": "ef2ea56469481c482c1ee716438a24b4ad12c6e2" + "url": "https://ftp.drupal.org/files/projects/config_installer-8.x-1.8.zip", + "reference": "8.x-1.8", + "shasum": "43d7af76a3f00d074161e242ddf94d942d256250" }, "require": { "drupal/core": "~8.0" @@ -1436,8 +1436,8 @@ "dev-1.x": "1.x-dev" }, "drupal": { - "version": "8.x-1.5", - "datestamp": "1506257944", + "version": "8.x-1.8", + "datestamp": "1524572284", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -1446,7 +1446,7 @@ }, "notification-url": "https://packages.drupal.org/8/downloads", "license": [ - "GPL-2.0+" + "GPL-2.0-or-later" ], "authors": [ { diff --git a/backend-gifts/web/sites/default/settings.php b/backend-gifts/web/sites/default/settings.php index 015967c..0222ebe 100644 --- a/backend-gifts/web/sites/default/settings.php +++ b/backend-gifts/web/sites/default/settings.php @@ -21,6 +21,20 @@ $config['simple_oauth.settings']['public_key'] = DRUPAL_ROOT . '/../certificates/public.key'; $config['simple_oauth.settings']['private_key'] = DRUPAL_ROOT . '/../certificates/private.key'; +// This is defined inside the read-only "config" directory, deployed via Git. +$config_directories[CONFIG_SYNC_DIRECTORY] = '../config/sync'; + +// Enable reverse proxy to pass IP addresses from API Bus and CDN. +$settings['reverse_proxy'] = TRUE; +$settings['reverse_proxy_addresses'] = [$_SERVER['REMOTE_ADDR']]; + +// Custom configs for sites based on Falcon. This folder is always empty +// for Falcon repo. However, if you're basing your site on top of Falcon and +// there are configs different from Falcon's, then you'll want to graylist +// them and they'll appear on config export in separate folder automatically. +$config['config_split.config_split.customizations']['status'] = TRUE; +$config['config_split.config_split.development']['status'] = TRUE; + // Set Platform routes in Drupal config variables. if (!empty($_ENV['PLATFORM_ROUTES'])) { $platform_routes = json_decode(base64_decode($_ENV['PLATFORM_ROUTES']), TRUE); @@ -37,20 +51,6 @@ $config['routes']['backend-donations']['client_id'] = ''; $config['routes']['backend-donations']['client_secret'] = ''; -// This is defined inside the read-only "config" directory, deployed via Git. -$config_directories[CONFIG_SYNC_DIRECTORY] = '../config/sync'; - -// Enable reverse proxy to pass IP addresses from API Bus and CDN. -$settings['reverse_proxy'] = TRUE; -$settings['reverse_proxy_addresses'] = [$_SERVER['REMOTE_ADDR']]; - -// Custom configs for sites based on Falcon. This folder is always empty -// for Falcon repo. However, if you're basing your site on top of Falcon and -// there are configs different from Falcon's, then you'll want to graylist -// them and they'll appear on config export in separate folder automatically. -$config['config_split.config_split.customizations']['status'] = TRUE; -$config['config_split.config_split.development']['status'] = TRUE; - /** * Settings for Platform.sh environments. */ @@ -69,4 +69,3 @@ else { require_once(__DIR__ . '/settings.local.php'); } - diff --git a/backup/.gitkeep b/backup/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/docker/docker-compose.override.default.yml b/docker/docker-compose.override.default.yml index fa60fe8..9d8caad 100644 --- a/docker/docker-compose.override.default.yml +++ b/docker/docker-compose.override.default.yml @@ -6,8 +6,6 @@ services: volumes: - ../frontend-main:/app #- ../frontend-main:/app:cached - labels: - - 'traefik.frontend.rule=Host:main.${PROJECT_BASE_URL}' fe_gifts: volumes: @@ -15,29 +13,22 @@ services: #- ../frontend-gifts:/app:cached # Uncomment to make changes in package.json. #command: sh -c 'yarn install' - labels: - - 'traefik.frontend.rule=Host:gifts.${PROJECT_BASE_URL}' - # Uncomment to run app with Server Side Rendering enabled. - # Useful for debugging issues related to SSR. +## Uncomment to run app with Server Side Rendering enabled. +## Useful for debugging issues related to SSR. # fe_gifts: # command: sh -c 'yarn install && yarn run build && yarn run start:server' # volumes: -# #- ../frontend-gifts:/app -# - ../frontend-gifts:/app:cached +# - ../frontend-gifts:/app +# #- ../frontend-gifts:/app:cached # labels: # - 'traefik.port=3001' # - 'traefik.frontend.rule=Host:gifts.${PROJECT_BASE_URL}' api_bus: - image: webdevops/php-nginx:alpine-3-php7 - environment: - WEB_ALIAS_DOMAIN: api.${PROJECT_BASE_URL} volumes: - ../backend-api-bus:/app #- ../backend-api-bus:/app:cached - labels: - - 'traefik.frontend.rule=Host:api.${PROJECT_BASE_URL}' be_gifts: environment: @@ -52,22 +43,17 @@ services: volumes: - ../backend-gifts:/var/www/html #- ../backend-gifts:/var/www/html:cached + - ../backup:/var/www/html/backup be_gifts_mariadb: volumes: - - ../backend-gifts/mysql/data:/var/lib/mysql - #- ../backend-gifts/mysql/data:/var/lib/mysql:cached + - ${MYSQL_DATA_DIR}/${MYSQL_DATA_DIR_GIFTS}:/var/lib/mysql + #- ${MYSQL_DATA_DIR}/${MYSQL_DATA_DIR_GIFTS}:/var/lib/mysql:cached be_gifts_nginx: volumes: - ../backend-gifts:/var/www/html #- ../backend-gifts:/var/www/html:cached - labels: - - 'traefik.frontend.rule=Host:gifts.api.${PROJECT_BASE_URL}' - - be_gifts_pma: - labels: - - 'traefik.frontend.rule=Host:pma.gifts.api.${PROJECT_BASE_URL}' be_donations: #environment: @@ -79,25 +65,14 @@ services: volumes: - ../backend-donations:/var/www/html #- ../backend-donations:/var/www/html:cached + - ../backup:/var/www/html/backup be_donations_mariadb: volumes: - - ../backend-donations/mysql/data:/var/lib/mysql - #- ../backend-donations/mysql/data:/var/lib/mysql:cached + - ${MYSQL_DATA_DIR}/${MYSQL_DATA_DIR_DONATIONS}:/var/lib/mysql + #- ${MYSQL_DATA_DIR}/${MYSQL_DATA_DIR_DONATIONS}:/var/lib/mysql:cached be_donations_nginx: volumes: - ../backend-donations:/var/www/html #- ../backend-donations:/var/www/html:cached - labels: - - 'traefik.frontend.rule=Host:donations.api.${PROJECT_BASE_URL}' - - be_donations_pma: - labels: - - 'traefik.frontend.rule=Host:pma.donations.api.${PROJECT_BASE_URL}' - - mailhog: - labels: - - 'traefik.backend=mailhog' - - 'traefik.port=8025' - - 'traefik.frontend.rule=Host:mailhog.${PROJECT_BASE_URL}' diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index b9e088f..fadb4b1 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -7,13 +7,15 @@ services: fe_main: image: node:8.9-alpine + container_name: "${PROJECT_NAME}_fe_main" ports: - - "3001:3000" + - '3001:3000' working_dir: /app command: sh -c 'yarn install && yarn run start:dev' labels: - 'traefik.backend=fe_main' - 'traefik.port=3000' + - 'traefik.frontend.rule=Host:main.${PROJECT_BASE_URL}' ########################## ### GIFTS FRONTEND ####### @@ -21,15 +23,17 @@ services: fe_gifts: image: node:8.9-alpine + container_name: "${PROJECT_NAME}_fe_gifts" depends_on: - api_bus ports: - - "3000" + - '3000' working_dir: /app command: sh -c 'yarn install && yarn run start' labels: - 'traefik.backend=fe_gifts' - 'traefik.port=3000' + - 'traefik.frontend.rule=Host:gifts.${PROJECT_BASE_URL}' ########################## ####### API BUS ########## @@ -37,43 +41,47 @@ services: api_bus: image: webdevops/php-nginx:alpine-3-php7 + container_name: "${PROJECT_NAME}_api_bus" depends_on: - be_gifts_nginx - be_donations_nginx environment: WEB_DOCUMENT_ROOT: /app/public + WEB_ALIAS_DOMAIN: api.${PROJECT_BASE_URL} working_dir: /app labels: - 'traefik.backend=api_bus' - 'traefik.port=80' + - 'traefik.frontend.rule=Host:api.${PROJECT_BASE_URL}' ########################## ### GIFTS BACKEND ######## ########################## be_gifts: - image: wodby/drupal-php:7.1-dev-4.2.3 - depends_on: - - be_gifts_mariadb + image: wodby/drupal-php:$PHP_TAG + container_name: "${PROJECT_NAME}_be_gifts_php" environment: PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025 - DB_HOST: drupal - DB_USER: drupal - DB_PASSWORD: drupal - DB_NAME: drupal - DB_DRIVER: mysql + DB_HOST: $DB_HOST_GIFTS + DB_USER: $DB_USER + DB_PASSWORD: $DB_PASSWORD + DB_NAME: $DB_NAME + DB_DRIVER: $DB_DRIVER be_gifts_mariadb: - image: wodby/mariadb:10.1-3.1.3 + image: wodby/mariadb:$MARIADB_TAG + container_name: "${PROJECT_NAME}_be_gifts_mariadb" stop_grace_period: 30s environment: - MYSQL_ROOT_PASSWORD: drupal - MYSQL_DATABASE: drupal - MYSQL_USER: drupal - MYSQL_PASSWORD: drupal + MYSQL_ROOT_PASSWORD: $DB_ROOT_PASSWORD + MYSQL_DATABASE: $DB_NAME + MYSQL_USER: $DB_USER + MYSQL_PASSWORD: $DB_PASSWORD be_gifts_nginx: - image: wodby/drupal-nginx:8-1.13-4.0.3 + image: wodby/drupal-nginx:$NGINX_TAG + container_name: "${PROJECT_NAME}_be_gifts_nginx" depends_on: - be_gifts environment: @@ -84,47 +92,41 @@ services: labels: - 'traefik.backend=be_gifts_nginx' - 'traefik.port=80' + - 'traefik.frontend.rule=Host:gifts.api.${PROJECT_BASE_URL}' be_gifts_pma: image: phpmyadmin/phpmyadmin + container_name: "${PROJECT_NAME}_be_gifts_pma" environment: - PMA_HOST: be_gifts_mariadb - PMA_USER: drupal - PMA_PASSWORD: drupal + PMA_HOST: $DB_HOST_GIFTS + PMA_USER: $DB_USER + PMA_PASSWORD: $DB_PASSWORD PHP_UPLOAD_MAX_FILESIZE: 1G PHP_MAX_INPUT_VARS: 1G labels: - 'traefik.backend=be_gifts_pma' - 'traefik.port=80' - + - 'traefik.frontend.rule=Host:pma.gifts.api.${PROJECT_BASE_URL}' ########################## ### DONATIONS BACKEND #### ########################## be_donations: - image: wodby/drupal-php:7.1-dev-4.2.3 - depends_on: - - be_donations_mariadb + extends: + service: be_gifts + container_name: "${PROJECT_NAME}_be_donations_php" environment: - PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025 - DB_HOST: drupal - DB_USER: drupal - DB_PASSWORD: drupal - DB_NAME: drupal - DB_DRIVER: mysql + DB_HOST: $DB_HOST_DONATIONS be_donations_mariadb: - image: wodby/mariadb:10.1-3.1.3 - stop_grace_period: 30s - environment: - MYSQL_ROOT_PASSWORD: drupal - MYSQL_DATABASE: drupal - MYSQL_USER: drupal - MYSQL_PASSWORD: drupal + extends: + service: be_gifts_mariadb + container_name: "${PROJECT_NAME}_be_donations_mariadb" be_donations_nginx: - image: wodby/drupal-nginx:8-1.13-4.0.3 + image: wodby/drupal-nginx:$NGINX_TAG + container_name: "${PROJECT_NAME}_be_donations_nginx" depends_on: - be_donations environment: @@ -135,18 +137,21 @@ services: labels: - 'traefik.backend=be_donations_nginx' - 'traefik.port=80' + - 'traefik.frontend.rule=Host:donations.api.${PROJECT_BASE_URL}' be_donations_pma: image: phpmyadmin/phpmyadmin + container_name: "${PROJECT_NAME}_be_donations_pma" environment: - PMA_HOST: be_donations_mariadb - PMA_USER: drupal - PMA_PASSWORD: drupal + PMA_HOST: $DB_HOST_DONATIONS + PMA_USER: $DB_USER + PMA_PASSWORD: $DB_PASSWORD PHP_UPLOAD_MAX_FILESIZE: 1G PHP_MAX_INPUT_VARS: 1G labels: - 'traefik.backend=be_donations_pma' - 'traefik.port=80' + - 'traefik.frontend.rule=Host:pma.donations.api.${PROJECT_BASE_URL}' ######################### ###### MAILHOG ########## @@ -154,6 +159,11 @@ services: mailhog: image: mailhog/mailhog + container_name: "${PROJECT_NAME}_mailhog" + labels: + - 'traefik.backend=mailhog' + - 'traefik.port=8025' + - 'traefik.frontend.rule=Host:mailhog.${PROJECT_BASE_URL}' ######################### ### CHROME FOR TESTS #### @@ -161,6 +171,7 @@ services: chrome: image: selenium/standalone-chrome:3.11.0 + container_name: "${PROJECT_NAME}_chrome" expose: - 4444 shm_size: 2gb @@ -171,18 +182,18 @@ services: traefik: image: traefik + container_name: "${PROJECT_NAME}_traefik" command: -c /dev/null --web --docker --logLevel=INFO ports: - '80:80' + - '8080:8080' # Dashboard volumes: - /var/run/docker.sock:/var/run/docker.sock networks: default: aliases: - - gifts.$PROJECT_BASE_URL - - main.$PROJECT_BASE_URL + - gifts.$PROJECT_BASE_URL + - main.$PROJECT_BASE_URL - api.$PROJECT_BASE_URL - gifts.api.$PROJECT_BASE_URL - - pma.gifts.api.$PROJECT_BASE_URL - - donations.api.$PROJECT_BASE_URL - - pma.donations.api.$PROJECT_BASE_URL + - donations.api.$PROJECT_BASE_URL diff --git a/docker/mysql/.gitkeep b/docker/mysql/.gitkeep new file mode 100644 index 0000000..e69de29