From cc028550176d3cb7c3480a543cd9568a5019787f Mon Sep 17 00:00:00 2001 From: Marko Korhonen Date: Wed, 8 May 2024 11:36:26 +0300 Subject: [PATCH 1/4] Add local Docker setup for Stonehenge --- .env | 19 +++ Makefile | 17 +++ compose.yaml | 36 ++++++ tools/make/Makefile | 48 ++++++++ tools/make/ansible.mk | 35 ++++++ tools/make/common.mk | 75 ++++++++++++ tools/make/composer.mk | 32 ++++++ tools/make/docker.mk | 85 ++++++++++++++ tools/make/drupal.mk | 204 +++++++++++++++++++++++++++++++++ tools/make/include.mk | 63 ++++++++++ tools/make/javascript.mk | 44 +++++++ tools/make/kubectl.mk | 56 +++++++++ tools/make/lagoon.mk | 38 ++++++ tools/make/override.mk | 6 + tools/make/project/starshot.mk | 7 ++ tools/make/qa.mk | 73 ++++++++++++ tools/make/symfony.mk | 78 +++++++++++++ tools/make/utils.mk | 74 ++++++++++++ 18 files changed, 990 insertions(+) create mode 100644 .env create mode 100644 Makefile create mode 100644 compose.yaml create mode 100644 tools/make/Makefile create mode 100644 tools/make/ansible.mk create mode 100644 tools/make/common.mk create mode 100644 tools/make/composer.mk create mode 100644 tools/make/docker.mk create mode 100644 tools/make/drupal.mk create mode 100644 tools/make/include.mk create mode 100644 tools/make/javascript.mk create mode 100644 tools/make/kubectl.mk create mode 100644 tools/make/lagoon.mk create mode 100644 tools/make/override.mk create mode 100644 tools/make/project/starshot.mk create mode 100644 tools/make/qa.mk create mode 100644 tools/make/symfony.mk create mode 100644 tools/make/utils.mk diff --git a/.env b/.env new file mode 100644 index 00000000..64bf21ee --- /dev/null +++ b/.env @@ -0,0 +1,19 @@ +# +# Enviromental values for Makefiles and for Docker Compose +# + +# Local hostname +DRUPAL_HOSTNAME=starshot.docker.so + +IS_DRUPAL=yes + +# Default source @alias where to sync database and files from +DRUPAL_SYNC_SOURCE=dev + +# Use stage_file_proxy +DRUPAL_SYNC_FILES=no + +# Download dump from repo artifacts +GH_DUMP_ARTIFACT=no + +WEBROOT=web diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..27392cb1 --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ +PHONY := +PROJECT_DIR := $(dir $(lastword $(MAKEFILE_LIST))) + +# Include project env vars (if exists) +-include .env +-include .env.local + +# Include druidfi/tools config +include $(PROJECT_DIR)/tools/make/Makefile + +# Include project specific make files (if they exist) +-include $(PROJECT_DIR)/tools/make/project/*.mk + +# Project specific overrides for variables (if they exist) +-include $(PROJECT_DIR)/tools/make/override.mk + +.PHONY: $(PHONY) diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 00000000..4b2f6f1f --- /dev/null +++ b/compose.yaml @@ -0,0 +1,36 @@ +services: + + app: + container_name: ${COMPOSE_PROJECT_NAME}-app + hostname: ${COMPOSE_PROJECT_NAME} + image: druidfi/drupal-web:v8.3.6 + volumes: + - .:/app:delegated + environment: + APP_ENV: ${APP_ENV:-dev} + DRUSH_OPTIONS_URI: https://${DRUPAL_HOSTNAME} + PHP_SENDMAIL_PATH: /usr/sbin/sendmail -S host.docker.internal:1025 -t + SIMPLETEST_BASE_URL: http://app:8080 + SIMPLETEST_DB: mysql://drupal:drupal@db:3306/drupal + XDEBUG_ENABLE: ${XDEBUG_ENABLE:-false} + WEBROOT: web + labels: + - traefik.enable=true + - traefik.http.routers.${COMPOSE_PROJECT_NAME}-app.entrypoints=https + - traefik.http.routers.${COMPOSE_PROJECT_NAME}-app.rule=Host(`${DRUPAL_HOSTNAME}`) + - traefik.http.routers.${COMPOSE_PROJECT_NAME}-app.tls=true + - traefik.http.services.${COMPOSE_PROJECT_NAME}-app.loadbalancer.server.port=8080 + - traefik.docker.network=stonehenge-network + networks: + - default + - stonehenge-network + + db: + container_name: ${COMPOSE_PROJECT_NAME}-db + image: druidfi/mysql:8.0-drupal-lts + ports: + - 3306 + +networks: + stonehenge-network: + external: true diff --git a/tools/make/Makefile b/tools/make/Makefile new file mode 100644 index 00000000..740dd607 --- /dev/null +++ b/tools/make/Makefile @@ -0,0 +1,48 @@ +.DEFAULT_GOAL := help + +BUILD_TARGETS := +COMPOSER_JSON_PATH ?= . +DRUIDFI_TOOLS_MAKE_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +ENV := dev +PACKAGE_JSON_PATH ?= . +RUN_ON := host +UNAME_S := $(shell uname -s) +# Shorten with https://git.io/ : https://raw.githubusercontent.com/druidfi/tools/main/update.sh +UPDATE_SCRIPT_URL := https://git.io/JP10q +WEBROOT ?= public + +include $(DRUIDFI_TOOLS_MAKE_DIR)utils.mk + +# Include druidfi/tools make files +include $(DRUIDFI_TOOLS_MAKE_DIR)include.mk + +PHONY += debug +debug: ## Show debug information + @printf "\n$(YELLOW)Debug starts:$(NO_COLOR)\n\n" + $(call dbg,DOCKER,$(call has,docker)) + $(call dbg,DOCKER_PROJECT_ROOT,$(DOCKER_PROJECT_ROOT)) + $(call dbg,DOCKER_COMPOSE_YML_EXISTS,$(DOCKER_COMPOSE_YML_EXISTS)) + $(call dbg,CLI_SERVICE,$(CLI_SERVICE)) + $(call dbg,CLI_USER,$(if $(CLI_USER),$(CLI_USER),default user from CLI image)) + $(call dbg,CLI_SHELL,${CLI_SHELL}) + $(call dbg,ENV,${ENV}) + $(call dbg,PHP on host,$(call has,php)) + $(call dbg,PHP_BIN,$(shell command -v php || echo no)) + $(call dbg,RUN_ON,${RUN_ON}) + $(call dbg,Composer on host,$(call has,composer)) + $(call dbg,COMPOSER_BIN,$(shell command -v composer || echo no)) + $(call dbg,COMPOSER_JSON_EXISTS,${COMPOSER_JSON_EXISTS}) + $(call dbg,IS_DRUPAL,${IS_DRUPAL}) + $(call dbg,IS_SYMFONY,${IS_SYMFONY}) + $(call dbg,IS_WP,${IS_WP}) + $(call dbg,LAGOON,${LAGOON}) + $(call dbg,WODBY,${WODBY}) + $(call dbg,SYSTEM,${SYSTEM}) + $(call dbg,WEBROOT,${WEBROOT}) + $(call dbg,UNAME_S,${UNAME_S}) +ifeq ($(RUN_ON),docker) + @printf "\n${YELLOW}Assumption: We should run on Docker and not on host${NO_COLOR}\n" +else + @printf "\n${YELLOW}Assumption: We should run on host and not on Docker${NO_COLOR}\n" +endif + @printf "\n${GREEN}End of debug.${NO_COLOR}\n" diff --git a/tools/make/ansible.mk b/tools/make/ansible.mk new file mode 100644 index 00000000..f5947df8 --- /dev/null +++ b/tools/make/ansible.mk @@ -0,0 +1,35 @@ +ANSIBLE_INVENTORY_PATH ?= ansible/inventory +ANSIBLE_ROLES_PATH ?= ansible/roles +ANSIBLE_CHECK_ROLE ?= geerlingguy.docker +ANSIBLE_PLAYBOOK ?= ansible-playbook +ANSIBLE_PROVISION ?= ansible/provision.yml +ANSIBLE_REQUIREMENTS ?= ansible/requirements.yml + +PHONY += provision +provision: $(ANSIBLE_ROLES_PATH)/$(ANSIBLE_CHECK_ROLE) ## Make provisioning + $(call step,Ansible: Make dry run on provisioning...\n) + @$(ANSIBLE_PLAYBOOK) $(ANSIBLE_PROVISION) + +PHONY += provision-% +provision-%: $(ANSIBLE_ROLES_PATH)/$(ANSIBLE_CHECK_ROLE) ## Make provisioning by tag + $(call step,Ansible: Make provisioning by tag "$*"...\n) + @$(ANSIBLE_PLAYBOOK) $(ANSIBLE_PROVISION) --tags="$*" + +PHONY += provision-dry-run +provision-dry-run: $(ANSIBLE_ROLES_PATH)/$(ANSIBLE_CHECK_ROLE) ## Make dry run on provisioning + $(call step,Ansible: Make dry run on provisioning...\n) + @$(ANSIBLE_PLAYBOOK) $(ANSIBLE_PROVISION) --check + +PHONY += ansible-install-roles +ansible-install-roles: ## Install Ansible roles + $(call step,Ansible: Install Ansible roles...\n) + @ansible-galaxy install -r $(ANSIBLE_REQUIREMENTS) -p $(ANSIBLE_ROLES_PATH) + +PHONY += ansible-update-roles +ansible-update-roles: ## Update Ansible roles + $(call step,Ansible: Update Ansible roles...\n) + @ansible-galaxy remove --roles-path=$(ANSIBLE_ROLES_PATH) $(shell find $(ANSIBLE_ROLES_PATH) -mindepth 1 -maxdepth 1 -type d -exec basename {} \;) || true + @ansible-galaxy install --force-with-deps --role-file=$(ANSIBLE_REQUIREMENTS) --roles-path=$(ANSIBLE_ROLES_PATH) + +$(ANSIBLE_ROLES_PATH)/$(ANSIBLE_CHECK_ROLE): + @$(MAKE) ansible-install-roles diff --git a/tools/make/common.mk b/tools/make/common.mk new file mode 100644 index 00000000..0ede4457 --- /dev/null +++ b/tools/make/common.mk @@ -0,0 +1,75 @@ +ARTIFACT_INCLUDE_EXISTS := $(shell test -f conf/artifact/include && echo yes || echo no) +ARTIFACT_EXCLUDE_EXISTS := $(shell test -f conf/artifact/exclude && echo yes || echo no) +ARTIFACT_CMD := tar -hczf artifact.tar.gz +DUMP_SQL_FILENAME ?= dump.sql +DUMP_SQL_EXISTS := $(shell test -f $(DUMP_SQL_FILENAME) && echo yes || echo no) +SSH_OPTS ?= -o LogLevel=ERROR -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no +CLEAN_EXCLUDE := .idea $(DUMP_SQL_FILENAME) .env.local + +ifeq ($(ARTIFACT_EXCLUDE_EXISTS),yes) + ARTIFACT_CMD := $(ARTIFACT_CMD) --exclude-from=conf/artifact/exclude +endif + +ifeq ($(ARTIFACT_INCLUDE_EXISTS),yes) + ARTIFACT_CMD := $(ARTIFACT_CMD) --files-from=conf/artifact/include +else + ARTIFACT_CMD := $(ARTIFACT_CMD) * +endif + +PHONY += artifact +# This command can always be run on host +artifact: RUN_ON := host +artifact: ## Make tar.gz package from the current build + $(call step,Create artifact...\n) + @$(ARTIFACT_CMD) + +PHONY += build +build: ## Build codebase(s) + $(call group_step,Build ($(ENV)):${NO_COLOR} $(BUILD_TARGETS)) + @$(MAKE) $(BUILD_TARGETS) ENV=$(ENV) + +PHONY += build-dev +build-dev: build + +PHONY += build-testing +build-testing: + @$(MAKE) build ENV=testing + +PHONY += build-production +build-production: + @$(MAKE) build ENV=production + +PHONY += clean +clean: ## Cleanup + $(call step,Cleanup loaded files...\n) + @rm -rf vendor + @git clean -fdx $(foreach item,$(CLEAN_EXCLUDE),-e $(item)) + +PHONY += self-update +self-update: ## Self-update makefiles from druidfi/tools + $(call step,Update makefiles from druidfi/tools\n) + @bash -c "$$(curl -fsSL $(UPDATE_SCRIPT_URL))" + +PHONY += shell-% +shell-%: OPTS = $(INSTANCE_$*_OPTS) +shell-%: USER = $(INSTANCE_$*_USER) +shell-%: HOST = $(INSTANCE_$*_HOST) +shell-%: EXTRA = $(INSTANCE_$*_EXTRA) +shell-%: ## Login to remote instance + ssh $(OPTS) $(USER)@$(HOST) $(EXTRA) + +PHONY += sync +sync: ## Sync data from other environments + $(call group_step,Sync:$(NO_COLOR) $(SYNC_TARGETS)) + @$(MAKE) $(SYNC_TARGETS) ENV=$(ENV) + +PHONY += gh-download-dump +gh-download-dump: GH_FLAGS += $(if $(GH_ARTIFACT),-n $(GH_ARTIFACT),-n latest-dump) +gh-download-dump: GH_FLAGS += $(if $(GH_REPO),-R $(GH_REPO),) +gh-download-dump: ## Download database dump from repository artifacts + $(call step,Download database dump from repository artifacts\n) +ifeq ($(DUMP_SQL_EXISTS),no) + $(call run,gh run download $(strip $(GH_FLAGS)),Downloaded $(DUMP_SQL_FILENAME),Failed) +else + @echo "There is already $(DUMP_SQL_FILENAME)" +endif diff --git a/tools/make/composer.mk b/tools/make/composer.mk new file mode 100644 index 00000000..4dd21954 --- /dev/null +++ b/tools/make/composer.mk @@ -0,0 +1,32 @@ +BUILD_TARGETS += composer-install +COMPOSER_PROD_FLAGS := --no-dev --optimize-autoloader --prefer-dist + +PHONY += composer-info +composer-info: ## Composer info + $(call step,Do Composer info...\n) + $(call composer,info) + +PHONY += composer-update +composer-update: ## Update Composer packages + $(call step,Do Composer update...\n) + $(call composer,update) + +PHONY += composer-install +composer-install: ## Install Composer packages + $(call step,Do Composer install...\n) + $(call composer,install$(if $(filter production,$(ENV)), $(COMPOSER_PROD_FLAGS),)) + +PHONY += composer-outdated +composer-outdated: ## Show outdated Composer packages + $(call step,Show outdated Composer packages...\n) + $(call composer,outdated --direct) + +ifeq ($(RUN_ON),docker) +define composer + $(call docker_compose_exec,composer --ansi$(if $(filter $(COMPOSER_JSON_PATH),.),, --working-dir=$(COMPOSER_JSON_PATH)) $(1)) +endef +else +define composer + @composer --ansi$(if $(filter $(COMPOSER_JSON_PATH),.),, --working-dir=$(COMPOSER_JSON_PATH)) $(1) +endef +endif diff --git a/tools/make/docker.mk b/tools/make/docker.mk new file mode 100644 index 00000000..96e47cbd --- /dev/null +++ b/tools/make/docker.mk @@ -0,0 +1,85 @@ +CLI_SERVICE := app +CLI_SHELL := sh +# Note: specification says this file would be compose.yaml +DOCKER_COMPOSE_YML_PATH ?= compose.yaml +DOCKER_COMPOSE_YML_EXISTS := $(shell test -f $(DOCKER_COMPOSE_YML_PATH) && echo yes || echo no) +DOCKER_PROJECT_ROOT ?= /app +DOCKER_WARNING_INSIDE := You are inside the Docker container! + +# If docker-compose.yml exists +ifeq ($(DOCKER_COMPOSE_YML_EXISTS),yes) + RUN_ON := docker +endif + +PHONY += config +config: ## Show docker-compose config + $(call step,Show Docker Compose config...\n) + $(call docker_compose,config) + +PHONY += pull +pull: ## Pull docker images + $(call step,Pull the latest docker images...\n) + $(call docker_compose,pull) + +PHONY += down +down: ## Tear down the environment + $(call step,Tear down the environment...\n) + $(call docker_compose,down -v --remove-orphans --rmi local) + +PHONY += ps +ps: ## List containers + $(call step,List container(s)...\n) + $(call docker_compose,ps) + +PHONY += stop +stop: ## Stop the environment + $(call step,Stop the container(s)...\n) + $(call docker_compose,stop) + +PHONY += up +up: ## Launch the environment + $(call step,Start up the container(s)...\n) + $(call docker_compose,up --wait --remove-orphans) + +PHONY += shell +shell: ## Login to CLI container +ifeq ($(RUN_ON),docker) + $(call docker_compose,exec $(CLI_SERVICE) $(CLI_SHELL)) +else + $(call warn,$(DOCKER_WARNING_INSIDE)) +endif + +PHONY += ssh-check +ssh-check: ## Check SSH keys on CLI container + $(call docker_compose_exec,ssh-add -L) + +ifeq ($(RUN_ON),docker) +define docker + @docker $(1) > /dev/null 2>&1 && $(if $(2),echo "$(2)",) +endef +else +define docker + $(call sub_step,$(DOCKER_WARNING_INSIDE)) +endef +endif + +ifeq ($(RUN_ON),docker) +define docker_compose_exec + $(call docker_compose,exec$(if $(CLI_USER), -u $(CLI_USER),) $(CLI_SERVICE) $(CLI_SHELL) -c "$(1)") + $(if $(2),@echo "$(2)",) +endef +else +define docker_compose_exec + @$(1) && echo $(2) +endef +endif + +ifeq ($(RUN_ON),docker) +define docker_compose + @docker compose$(if $(filter $(DOCKER_COMPOSE_YML_PATH),$(DOCKER_COMPOSE_YML_PATH)),, -f $(DOCKER_COMPOSE_YML_PATH)) $(1) +endef +else +define docker_compose + $(call sub_step,$(DOCKER_WARNING_INSIDE)) +endef +endif diff --git a/tools/make/drupal.mk b/tools/make/drupal.mk new file mode 100644 index 00000000..5f81548c --- /dev/null +++ b/tools/make/drupal.mk @@ -0,0 +1,204 @@ +BUILD_TARGETS += drupal-create-folders +DRUPAL_CONF_EXISTS := $(shell test -f conf/cmi/core.extension.yml && echo yes || echo no) +DRUPAL_FRESH_TARGETS := up build sync post-install +DRUPAL_NEW_TARGETS := up build drush-si drush-uli +DRUPAL_POST_INSTALL_TARGETS := drush-deploy +CLEAN_EXCLUDE += $(WEBROOT)/sites/default/files +DRUPAL_DISABLE_MODULES ?= no +DRUPAL_ENABLE_MODULES ?= no +DRUPAL_PROFILE ?= minimal +DRUPAL_SYNC_FILES ?= yes +DRUPAL_SYNC_SOURCE ?= main +DRUSH_RSYNC_MODE ?= Pakzu +DRUSH_RSYNC_OPTS ?= -- --omit-dir-times --no-perms --no-group --no-owner --chmod=ugo=rwX +DRUSH_RSYNC_EXCLUDE ?= css:ctools:js:php:tmp:tmp_php +SYNC_TARGETS += drush-sync +CS_EXTS := inc,php,module,install,profile,theme +CS_STANDARD_PATHS := vendor/drupal/coder/coder_sniffer,vendor/slevomat/coding-standard +CS_STANDARDS := Drupal,DrupalPractice +LINT_PATHS_JS += ./$(WEBROOT)/modules/custom/*/js +LINT_PATHS_JS += ./$(WEBROOT)/themes/custom/*/js +LINT_PATHS_PHP += drush +LINT_PATHS_PHP += $(WEBROOT)/modules/custom +LINT_PATHS_PHP += $(WEBROOT)/themes/custom +LINT_PHP_TARGETS += lint-drupal +FIX_TARGETS += fix-drupal +DRUPAL_CREATE_FOLDERS := $(WEBROOT)/sites/default/files/private +DRUPAL_CREATE_FOLDERS += $(WEBROOT)/sites/default/files/translations + +ifeq ($(GH_DUMP_ARTIFACT),yes) + DRUPAL_FRESH_TARGETS := gh-download-dump $(DRUPAL_FRESH_TARGETS) +endif + +ifneq ($(DRUPAL_DISABLE_MODULES),no) + SYNC_TARGETS += drush-disable-modules +endif + +ifneq ($(DRUPAL_ENABLE_MODULES),no) + DRUPAL_POST_INSTALL_TARGETS += drush-enable-modules +endif + +PHONY += drupal-create-folders +drupal-create-folders: + $(call step,Create folders for Drupal...\n) + $(call docker_compose_exec,mkdir -v -p $(DRUPAL_CREATE_FOLDERS)) + +PHONY += drupal-update +drupal-update: ## Update Drupal core with Composer + $(call step,Update Drupal core with Composer...\n) + $(call composer,update -W "drupal/core-*") + +PHONY += drush-cex +drush-cex: ## Export configuration + $(call step,Export configuration...\n) + $(call drush,cex -y) + +PHONY += drush-cim +drush-cim: ## Import configuration + $(call step,Import configuration...\n) + $(call drush,cim -y) + +PHONY += drush-cr +drush-cr: ## Clear caches + $(call step,Clearing caches...\n) + $(call drush,cr) + +PHONY += drush-status +drush-status: ## Show Drupal status information + $(call drush,status) + +PHONY += drush-uli +drush-uli: DRUPAL_UID ?= +drush-uli: DRUPAL_DESTINATION ?= admin/reports/status +drush-uli: ## Get login link + $(call step,Login to your site with:\n) + $(call drush,uli$(if $(DRUPAL_UID), --uid=$(DRUPAL_UID),) $(DRUPAL_DESTINATION)) + +PHONY += drush-uli-% +drush-uli-%: ## Get login link for provided uid + $(call step,Login to your site as user $* with:\n) + $(call drush,uli --uid=$*) + +PHONY += drush-si +ifeq ($(DRUPAL_CONF_EXISTS),yes) + drush-si: DRUSH_SI := -y --existing-config +else + drush-si: DRUSH_SI := -y $(DRUPAL_PROFILE) +endif +drush-si: ## Site install + $(call step,Do Drush site:install...\n) + $(call drush,si ${DRUSH_SI}) + +PHONY += drush-deploy +drush-deploy: ## Run Drush deploy + $(call step,Run Drush deploy...\n) + $(call drush,deploy) + +PHONY += drush-updb +drush-updb: ## Run database updates + $(call step,Run database updates...\n) + $(call drush,updb -y) + +PHONY += drush-reset-local +drush-reset-local: ## Reset local configuration (cim, cr, updb, cr) + $(call step,Reset local configuration...\n) + $(call drush,cim -y) + $(call drush,cr) + $(call drush,updb -y --no-cache-clear) + $(call drush,cr) + +PHONY += fresh +fresh: ## Build fresh development environment and sync + @$(MAKE) $(DRUPAL_FRESH_TARGETS) + +PHONY += new +new: ## Create a new empty Drupal installation from configuration + @$(MAKE) $(DRUPAL_NEW_TARGETS) + +PHONY += post-install +post-install: ## Run post-install Drush actions + @$(MAKE) $(DRUPAL_POST_INSTALL_TARGETS) drush-uli + +PHONY += drush-disable-modules +drush-disable-modules: ## Disable Drupal modules + $(call step,Disable Drupal modules...\n) +ifneq ($(DRUPAL_DISABLE_MODULES),no) + $(call drush,pmu -y $(subst ",,$(DRUPAL_DISABLE_MODULES))) +else + $(call sub_step,No modules to disable) +endif + +PHONY += drush-enable-modules +drush-enable-modules: ## Enable Drupal modules + $(call step,Enable Drupal modules...\n) +ifneq ($(DRUPAL_ENABLE_MODULES),no) + $(call drush,en -y $(subst ",,$(DRUPAL_ENABLE_MODULES))) +else + $(call sub_step,No modules to enable) +endif + +PHONY += drush-sync +drush-sync: drush-sync-db drush-sync-files ## Sync database and files + +PHONY += drush-sync-db +drush-sync-db: ## Sync database + $(call drush,sql-drop --quiet -y) +ifeq ($(DUMP_SQL_EXISTS),yes) + $(call step,Import local SQL dump...) + $(call drush,sql-query --file=${DOCKER_PROJECT_ROOT}/$(DUMP_SQL_FILENAME) && echo 'SQL dump imported') +else + $(call step,Sync database from @$(DRUPAL_SYNC_SOURCE)...) + $(call drush,sql-sync -y --structure-tables-key=common @$(DRUPAL_SYNC_SOURCE) @self) +endif + +PHONY += drush-sync-files +drush-sync-files: ## Sync files +ifeq ($(DRUPAL_SYNC_FILES),yes) + $(call step,Sync files from @$(DRUPAL_SYNC_SOURCE)...) + $(call drush,-y rsync --exclude-paths=$(DRUSH_RSYNC_EXCLUDE) --mode=$(DRUSH_RSYNC_MODE) @$(DRUPAL_SYNC_SOURCE):%files @self:%files $(DRUSH_RSYNC_OPTS)) +endif + +PHONY += drush-create-dump +drush-create-dump: FLAGS := --structure-tables-key=common --extra-dump=--no-tablespaces +drush-create-dump: ## Create database dump to dump.sql + $(call drush,sql-dump $(FLAGS) --result-file=${DOCKER_PROJECT_ROOT}/$(DUMP_SQL_FILENAME)) + +PHONY += drush-download-dump +drush-download-dump: ## Download database dump to dump.sql + $(call drush,@$(DRUPAL_SYNC_SOURCE) sql-dump --structure-tables-key=common > ${DOCKER_PROJECT_ROOT}/$(DUMP_SQL_FILENAME)) + +PHONY += open-db-gui +open-db-gui: ## Open database with GUI tool + $(eval DB_SERVICE ?= db) + $(eval DB_NAME ?= drupal) + $(eval DB_USER ?= drupal) + $(eval DB_PASS ?= drupal) + @open mysql://$(DB_USER):$(DB_PASS)@$(shell docker compose port $(DB_SERVICE) 3306 | grep -v ::)/$(DB_NAME) + +PHONY += fix-drupal +fix-drupal: PATHS := $(subst $(space),,$(LINT_PATHS_PHP)) +fix-drupal: ## Fix Drupal code style + $(call step,Fix Drupal code style with phpcbf...\n) + $(call cs,phpcbf,$(PATHS)) + +PHONY += lint-drupal +lint-drupal: PATHS := $(subst $(space),,$(LINT_PATHS_PHP)) +lint-drupal: ## Lint Drupal code style + $(call step,Lint Drupal code style with phpcs...\n) + $(call cs,phpcs,$(PATHS)) + +PHONY += mmfix +mmfix: MODULE := MISSING_MODULE +mmfix: + $(call step,Remove missing module '$(MODULE)'\n) + $(call drush,sql-query \"DELETE FROM key_value WHERE collection='system.schema' AND name='$(MODULE)';\",Module was removed) + +ifeq ($(RUN_ON),docker) +define drush + $(call docker_compose_exec,drush $(1),$(2)) +endef +else +define drush + @drush $(1) +endef +endif diff --git a/tools/make/include.mk b/tools/make/include.mk new file mode 100644 index 00000000..3f469ae6 --- /dev/null +++ b/tools/make/include.mk @@ -0,0 +1,63 @@ +include $(DRUIDFI_TOOLS_MAKE_DIR)common.mk + +ifeq ($(call has,docker),yes) +include $(DRUIDFI_TOOLS_MAKE_DIR)docker.mk +endif + +include $(DRUIDFI_TOOLS_MAKE_DIR)qa.mk + +# +# Apps +# + +IS_DRUPAL ?= $(shell test -f $(WEBROOT)/sites/default/settings.php && echo yes || echo no) +IS_SYMFONY ?= $(shell test -f config/bundles.php && echo yes || echo no) + +ifeq ($(IS_DRUPAL),yes) +include $(DRUIDFI_TOOLS_MAKE_DIR)drupal.mk +endif + +ifeq ($(IS_SYMFONY),yes) +include $(DRUIDFI_TOOLS_MAKE_DIR)symfony.mk +endif + +# +# Other tools +# + +HAS_ANSIBLE ?= $(shell test -d ansible && echo yes || echo no) + +ifeq ($(HAS_ANSIBLE),yes) +include $(DRUIDFI_TOOLS_MAKE_DIR)ansible.mk +endif + +# +# Hosting systems +# + +LAGOON := $(shell test -f .lagoon.yml && echo yes || echo no) +WODBY := $(shell test -f wodby.yml && echo yes || echo no) + +ifeq ($(LAGOON),yes) + SYSTEM := LAGOON +else ifeq ($(WODBY),yes) + SYSTEM := WODBY +else + SYSTEM := WHOKNOWS +endif + +ifeq ($(SYSTEM),LAGOON) +include $(DRUIDFI_TOOLS_MAKE_DIR)lagoon.mk +endif + +COMPOSER_JSON_EXISTS := $(shell test -f $(COMPOSER_JSON_PATH)/composer.json && echo yes || echo no) + +ifeq ($(COMPOSER_JSON_EXISTS),yes) +include $(DRUIDFI_TOOLS_MAKE_DIR)composer.mk +endif + +PACKAGE_JSON_EXISTS := $(shell test -f $(PACKAGE_JSON_PATH)/package.json && echo yes || echo no) + +ifeq ($(PACKAGE_JSON_EXISTS),yes) +include $(DRUIDFI_TOOLS_MAKE_DIR)javascript.mk +endif diff --git a/tools/make/javascript.mk b/tools/make/javascript.mk new file mode 100644 index 00000000..9b8c2fcf --- /dev/null +++ b/tools/make/javascript.mk @@ -0,0 +1,44 @@ +BUILD_TARGETS += js-install +JS_PACKAGE_MANAGER ?= yarn +JS_PACKAGE_MANAGER_CWD_FLAG_NPM ?= --prefix +JS_PACKAGE_MANAGER_CWD_FLAG_YARN ?= --cwd +INSTALLED_NODE_VERSION := $(shell command -v node > /dev/null && node --version | cut -c2-3 || echo no) +NVM_SH := $(HOME)/.nvm/nvm.sh +NVM := $(shell test -f "$(NVM_SH)" && echo yes || echo no) +NODE_BIN := $(shell command -v node || echo no) +NPM_BIN := $(shell command -v npm || echo no) +YARN_BIN := $(shell command -v yarn || echo no) +NODE_VERSION ?= 16 + +PHONY += js-install +js-install: ## Install JS packages +ifeq ($(JS_PACKAGE_MANAGER),yarn) + $(call node_run,install --frozen-lockfile) +else + $(call node_run,install --no-audit --no-fund --engine-strict true) +endif + +PHONY += js-outdated +js-outdated: ## Show outdated JS packages + $(call step,Show outdated JS packages with $(JS_PACKAGE_MANAGER)...) + $(call node_run,outdated) + +ifeq ($(NVM),no) +define node_run + $(call error,$(NVM_REQUIRED)) +endef +else +define node_run + $(call step,Run '$(JS_PACKAGE_MANAGER) $(1)' with Node $(NODE_VERSION)...\n) + @. $(NVM_SH) && (nvm which $(NODE_VERSION) > /dev/null 2>&1 || nvm install $(NODE_VERSION)) && \ + nvm exec $(NODE_VERSION) $(JS_PACKAGE_MANAGER) $(if $(filter $(JS_PACKAGE_MANAGER),yarn),$(JS_PACKAGE_MANAGER_CWD_FLAG_YARN),$(JS_PACKAGE_MANAGER_CWD_FLAG_NPM)) $(PACKAGE_JSON_PATH) $(1) +endef +endif + +define NVM_REQUIRED + + +🚫 NVM is required to run $(JS_PACKAGE_MANAGER) commands and control Node versions! + + +endef diff --git a/tools/make/kubectl.mk b/tools/make/kubectl.mk new file mode 100644 index 00000000..60f5003e --- /dev/null +++ b/tools/make/kubectl.mk @@ -0,0 +1,56 @@ +KUBECTL_BIN := $(shell command -v kubectl || echo no) +KUBECTL_NAMESPACE ?= foobar-namespace +KUBECTL_SHELL ?= sh +KUBECTL_EXEC_FLAGS ?= -n $(KUBECTL_NAMESPACE) -c $(KUBECTL_CONTAINER) +KUBECTL_POD_SELECTOR ?= appName=foobar-app +KUBECTL_WORKDIR ?= /app + +PHONY += kubectl-sync-db +kubectl-sync-db: ## Sync database from Kubernetes + $(call drush,sql-drop --quiet -y) +ifeq ($(DUMP_SQL_EXISTS),no) + $(eval POD := $(call kubectl_get_pod)) + $(call step,Get database dump from $(POD)...\n) + $(KUBECTL_BIN) exec $(KUBECTL_EXEC_FLAGS) $(POD) -- drush sql-dump --structure-tables-key=common --extra-dump=--no-tablespaces --result-file=/tmp/$(DUMP_SQL_FILENAME) --gzip + $(KUBECTL_BIN) cp $(KUBECTL_EXEC_FLAGS) --retries=-1 $(POD):/tmp/$(DUMP_SQL_FILENAME).gz ./$(DUMP_SQL_FILENAME).gz + $(KUBECTL_BIN) exec $(KUBECTL_EXEC_FLAGS) $(POD) -- rm -f /tmp/$(DUMP_SQL_FILENAME).gz + @gzip -d $(DUMP_SQL_FILENAME).gz +endif + $(call step,Import local SQL dump...\n) + $(call drush,sql-query --file=${DOCKER_PROJECT_ROOT}/$(DUMP_SQL_FILENAME)) + +PHONY += kubectl-sync-files-tar +kubectl-sync-files-tar: ## Sync files from Kubernetes using tar + $(call step,Copy files from remote...\n) + $(eval POD := $(call kubectl_get_pod)) + $(KUBECTL_BIN) exec $(KUBECTL_EXEC_FLAGS) $(POD) -- tar cf - $(SYNC_FILES_EXCLUDE) $(SYNC_FILES_PATH) | tar xfv - -C . + +PHONY += kubectl-rsync-files +kubectl-rsync-files: FLAGS := -aurP --blocking-io +kubectl-rsync-files: REMOTE_PATH := $(KUBECTL_WORKDIR)/$(SYNC_FILES_PATH)/ +kubectl-rsync-files: LOCAL_PATH := ./$(SYNC_FILES_PATH)/ +kubectl-rsync-files: ## Sync files from Kubernetes using rsync + $(call step,Sync files from remote...\n) + $(eval POD := $(call kubectl_get_pod)) + rsync $(FLAGS) $(SYNC_FILES_EXCLUDE) --rsync-path=$(REMOTE_PATH) -e '$(KUBECTL_BIN) exec -i $(KUBECTL_EXEC_FLAGS) $(POD) -- env ' rsync: $(LOCAL_PATH) + +PHONY += kubectl-shell +kubectl-shell: ## Open shell to Pod in Kubernetes + $(eval POD := $(call kubectl_get_pod)) + $(KUBECTL_BIN) exec $(KUBECTL_EXEC_FLAGS) -ti $(POD) -- $(KUBECTL_SHELL) + +define kubectl_exec + $(KUBECTL_BIN) exec $(KUBECTL_EXEC_FLAGS) $(1) -- $(KUBECTL_SHELL) -c '$(2)' +endef + +define kubectl_exec_to_file + $(KUBECTL_BIN) exec $(KUBECTL_EXEC_FLAGS) $(1) -- $(KUBECTL_SHELL) -c '$(2)' > $(3) +endef + +define kubectl_cp + $(KUBECTL_BIN) cp $(KUBECTL_EXEC_FLAGS) $(1) $(2) +endef + +define kubectl_get_pod + $(shell $(KUBECTL_BIN) get pods -n $(KUBECTL_NAMESPACE) --selector=$(KUBECTL_POD_SELECTOR) --template '{{range .items}}{{ if not .metadata.deletionTimestamp }}{{.metadata.name}}{{"\n"}}{{end}}{{end}}') +endef diff --git a/tools/make/lagoon.mk b/tools/make/lagoon.mk new file mode 100644 index 00000000..e6baebad --- /dev/null +++ b/tools/make/lagoon.mk @@ -0,0 +1,38 @@ +CLI_SERVICE := cli +CLI_SHELL := bash +DB_SERVICE := mariadb + +INSTANCE_prod_USER ?= project-name-branch +INSTANCE_prod_HOST ?= ssh.lagoon.amazeeio.cloud +INSTANCE_prod_OPTS ?= $(SSH_OPTS) -p 32222 -t +INSTANCE_test_USER ?= project-name-branch +INSTANCE_test_HOST ?= $(INSTANCE_prod_HOST) +INSTANCE_test_OPTS ?= $(INSTANCE_prod_OPTS) + +ifeq ($(MAKECMDGOALS),set-lagoon-secrets) +include .env.local.lagoon +endif + +PHONY += lagoon-env +lagoon-env: ## Print Lagoon env variables + $(call docker_compose_exec,printenv | grep LAGOON_) + +PHONY += deploy-lagoon-% +deploy-lagoon-%: ## Deploy lagoon branch + $(call step,Deploy Lagoon branch $*...\n) + @lagoon -p $(LAGOON_PROJECT) deploy branch -b $* + +PHONY += set-lagoon-secrets-% +set-lagoon-secrets-%: ## Set Lagoon secrets + $(call step,Set Lagoon secrets on $*...\n) + @$(foreach secret,$(LAGOON_SECRETS),$(call set_lagoon_secret,$(secret),$*)) + +PHONY += list-lagoon-vars-% +list-lagoon-vars-%: ## List variables from Lagoon + $(call step,List variables from Lagoon on $*...\n) + @lagoon -p $(LAGOON_PROJECT) list v --reveal -e $* + +define set_lagoon_secret +printf "Setting secret on ${2}: %s = %s \n" "${1}" "${${1}}"; +lagoon -p $(LAGOON_PROJECT) a v -N "${1}" -V "${${1}}" -S runtime -e ${2} --force || true; +endef diff --git a/tools/make/override.mk b/tools/make/override.mk new file mode 100644 index 00000000..9d7eabb2 --- /dev/null +++ b/tools/make/override.mk @@ -0,0 +1,6 @@ +# Docker CLI container +CLI_SERVICE := app +CLI_SHELL := bash + +INSTANCE_prod_USER := deployment +INSTANCE_prod_HOST ?= $(SSH_HOST) diff --git a/tools/make/project/starshot.mk b/tools/make/project/starshot.mk new file mode 100644 index 00000000..f7577361 --- /dev/null +++ b/tools/make/project/starshot.mk @@ -0,0 +1,7 @@ +BUILD_TARGETS := composer-install +DRUPAL_FRESH_TARGETS := up build drupal-install + +PHONY += drupal-install +drupal-install: + $(call step,Run Composer drupal:install script...\n) + $(call composer,drupal:install) diff --git a/tools/make/qa.mk b/tools/make/qa.mk new file mode 100644 index 00000000..f4988fbe --- /dev/null +++ b/tools/make/qa.mk @@ -0,0 +1,73 @@ +TEST_TARGETS += test-phpunit +FIX_TARGETS := +LINT_PHP_TARGETS := +CS_INSTALLED := $(shell test -f $(COMPOSER_JSON_PATH)/vendor/bin/phpcs && echo yes || echo no) +CS_CONF_EXISTS := $(shell test -f phpcs.xml.dist && echo yes || echo no) +TESTSUITES ?= unit,kernel,functional + +PHONY += fix +fix: ## Fix code style + $(call step,Fix code...) + $(call sub_step,Following targets will be run: $(FIX_TARGETS)) + @$(MAKE) $(FIX_TARGETS) + +PHONY += lint +lint: lint-php lint-js ## Check code style + +PHONY += lint-js +lint-js: DOCKER_NODE_IMG ?= node:$(NODE_VERSION)-alpine +lint-js: WD := /app +lint-js: ## Check code style for JS files + $(call step,Install linters...) + @docker run --rm -v "$(CURDIR)":$(WD):cached -w $(WD) $(DOCKER_NODE_IMG) yarn --cwd $(WEBROOT)/core install + $(call step,Check code style for JS files: $(DRUPAL_LINT_PATHS)) + @docker run --rm -v "$(CURDIR)":$(WD):cached -w $(WD) $(DOCKER_NODE_IMG) \ + $(WEBROOT)/core/node_modules/eslint/bin/eslint.js --color --ignore-pattern '**/vendor/*' \ + --c ./$(WEBROOT)/core/.eslintrc.json --global nav,moment,responsiveNav:true $(LINT_PATHS_JS) + +PHONY += lint-php +lint-php: ## Check code style for PHP files + $(call step,Check code style for PHP files...) + $(call sub_step,Following targets will be run: $(LINT_PHP_TARGETS)) + @$(MAKE) $(LINT_PHP_TARGETS) + $(call test_result,lint-php,"[OK]") + +PHONY += test +test: ## Run tests + $(call group_step,Run test targets:${NO_COLOR} $(TEST_TARGETS)\n) + @$(MAKE) $(TEST_TARGETS) + $(call step,Tests completed.) + +PHONY += test-phpunit +test-phpunit: ## Run PHPUnit tests + $(call step,Run PHPUnit tests...) +ifeq ($(CI),true) + vendor/bin/phpunit -c phpunit.xml.dist --testsuite $(TESTSUITES) +else + $(call docker_compose_exec,${DOCKER_PROJECT_ROOT}/vendor/bin/phpunit -c $(DOCKER_PROJECT_ROOT)/phpunit.xml.dist \ + --testsuite $(TESTSUITES)) +endif + $(call test_result,test-phpunit,"[OK]") + +PHONY += test-phpunit-locally +test-phpunit-locally: + @SIMPLETEST_BASE_URL=https://$(DRUPAL_HOSTNAME) SIMPLETEST_DB=mysql://$(DB_URL) \ + vendor/bin/phpunit -c $(CURDIR)/phpunit.xml.dist --testsuite $(TESTSUITES) + +define test_result + @echo "\n${YELLOW}${1}:${NO_COLOR} ${GREEN}${2}${NO_COLOR}" +endef + +ifeq ($(CS_INSTALLED)-$(CS_CONF_EXISTS),yes-yes) +define cs +$(call docker_compose_exec,vendor/bin/$(1)) +endef +else ifeq ($(CS_INSTALLED)-$(CS_CONF_EXISTS),yes-no) +define cs +$(call docker_compose_exec,vendor/bin/$(1) --standard=$(CS_STANDARDS) --extensions=$(CS_EXTS) --ignore=node_modules $(2)) +endef +else +define cs +$(call warn,CodeSniffer is not installed!) +endef +endif diff --git a/tools/make/symfony.mk b/tools/make/symfony.mk new file mode 100644 index 00000000..73672075 --- /dev/null +++ b/tools/make/symfony.mk @@ -0,0 +1,78 @@ +SF_FRESH_TARGETS := up build sf-cw sf-about sf-open +FIX_TARGETS += fix-symfony +LINT_PHP_TARGETS += lint-symfony +CS_FIXER_INSTALLED := $(shell test -f $(COMPOSER_JSON_PATH)/vendor/bin/php-cs-fixer && echo yes || echo no) + +PHONY += encore-dev +encore-dev: ## Do Encore development build + $(call step,Do Encore development build...) + $(call node_run,dev) + +PHONY += encore-watch +encore-watch: ## Run Encore watch + $(call step,Do Encore watch...) + $(call node_run,watch) + +PHONY += sf-about +sf-about: ## Displays information about the current project + $(call sf_console,about) + +PHONY += sf-cc +sf-cc: ## Clear Symfony caches + $(call step,Clear Symfony caches...) + $(call sf_console,cache:clear) + +PHONY += sf-cw +sf-cw: ## Warm Symfony caches + $(call step,Warm Symfony caches...) + $(call sf_console,cache:warmup) + +PHONY += sf-db-init +sf-db-init: ## Setup database schema and load fixtures + $(call step,Setup database schema...) + $(call sf_console,doctrine:schema:update --force) + $(call sf_console,doctrine:fixtures:load -n) + +PHONY += sf-open +sf-open: ## Warm Symfony caches + $(call step,See your Symfony application with:\n) + $(call output,https://$(APP_HOST)) + +PHONY += sf-update +sf-update: ## Update Symfony packages with Composer + $(call step,Update Symfony packages with Composer...\n) + $(call composer,update -W "doctrine/*" "symfony/*" "twig/*" --no-scripts) + +PHONY += fresh +fresh: ## Build fresh development environment + @$(MAKE) $(SF_FRESH_TARGETS) + +PHONY += fix-symfony +fix-symfony: ## Fix Symfony code style + $(call step,Fix Symfony code style...\n) + $(call cs_symfony,fix --ansi src) + +PHONY += lint-symfony +lint-symfony: ## Lint Symfony code style + $(call step,Lint Symfony code style...\n) + $(call cs_symfony,fix --dry-run --diff --ansi --verbose src) + +ifeq ($(RUN_ON),docker) +define sf_console + $(call docker_compose_exec,bin/console $(1)) +endef +else +define sf_console + @bin/console $(1) +endef +endif + +ifeq ($(CS_FIXER_INSTALLED),yes) +define cs_symfony +$(call docker_compose_exec,vendor/bin/php-cs-fixer $(1)) +endef +else +define cs_symfony +$(call warn,PHP CS Fixer is not installed!) +endef +endif diff --git a/tools/make/utils.mk b/tools/make/utils.mk new file mode 100644 index 00000000..5411160c --- /dev/null +++ b/tools/make/utils.mk @@ -0,0 +1,74 @@ +# Colors +NO_COLOR=\033[0m +CYAN=\033[36m +GREEN=\033[0;32m +RED=\033[0;31m +YELLOW=\033[0;33m + +PHONY += help +help: ## List all make commands + $(call step,Available make commands:\n) + @cat $(MAKEFILE_LIST) | grep -e "^[a-zA-Z_\-]*: *.*## *" | awk 'BEGIN {FS = ":.*?## "}; {printf "${CYAN}%-30s${NO_COLOR} %s\n", $$1, $$2}' | sort + +PHONY += lt +lt: ## Open localtunnel +ifeq ($(shell command -v lt || echo no),no) + $(call warn,Install localtunnel with: ${YELLOW}npm install -g localtunnel${NO_COLOR}) +else + $(call step,Open localtunnel. Use CTRL+C to close localtunnel.\n) + @lt --port 443 --subdomain $(COMPOSE_PROJECT_NAME) --local-https --allow-invalid-cert +endif + +define dbg + @printf "${GREEN}${1}:${NO_COLOR} ${2}\n" +endef + +define group_step + @printf "\n🌟 ${YELLOW}${1}${NO_COLOR}\n" +endef + +define has +$(shell command -v ${1} > /dev/null 2>&1 && echo yes || echo no) +endef + +define step + @printf "\n⭐ ${YELLOW}${1}${NO_COLOR}\n" +endef + +define sub_step + @printf "\n ${YELLOW}${1}${NO_COLOR}\n" +endef + +define output + @echo "${1}" +endef + +define warn + @printf "\n⚠️ ${1}\n\n" +endef + +define copy + $(call output,Copy $(1) >> $(2)) + @cp $(1) $(2) +endef + +SED_Darwin := sed -i '' +SED_Linux := sed -i + +define get_port +$(shell netstat -aln|awk '$$6=="LISTEN"{if($$4~"[.:][0-9]+$$"){split($$4,a,/[:.]/);p2=a[length(a)];p[p2]=1;}}END{for(i=3000;i<3999&&p[i];i++){};if(i==3999){exit 1};print i}') +endef + +define replace_string + $(call output,Replace $(1) >> $(2) in $(3)) + @$(SED_$(UNAME_S)) 's/$(1)/$(2)/g' $(3) +endef + +define remove_string + $(call output,Remove $(1) from $(2)) + @$(SED_$(UNAME_S)) '/$(1)/d' $(2) +endef + +define run + @${1} && printf "${2}\n" || printf "${RED}${3}${NO_COLOR}\n" +endef From 7cca782ffe86a0215a32cfde88817ed96b80f405 Mon Sep 17 00:00:00 2001 From: Marko Korhonen Date: Wed, 8 May 2024 11:36:42 +0300 Subject: [PATCH 2/4] Change .gitignore a bit --- .gitignore | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 87cee6bc..1cc2f985 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,12 @@ /composer.lock /patches.lock.json /vendor -/web +/web/*.* +/web/core +/web/modules +/web/profiles +/web/sites/*.* +/web/sites/default/*.* +/web/sites/default/files +!/web/sites/default/default.settings.php +/web/themes From 154690f0879c5bd323e277b5ff5754cbf04a3cd5 Mon Sep 17 00:00:00 2001 From: Marko Korhonen Date: Wed, 8 May 2024 11:37:32 +0300 Subject: [PATCH 3/4] Add druidfi/omen and own default.settings.php which is used for as template for recipe install --- composer.json | 6 +++++- web/sites/default/default.settings.php | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 web/sites/default/default.settings.php diff --git a/composer.json b/composer.json index 296c9242..19dfea2d 100644 --- a/composer.json +++ b/composer.json @@ -15,9 +15,10 @@ } }, "require": { - "ext-pdo_sqlite": "*", + "php": "^8.3", "composer/installers": "^2.0", "cweagans/composer-patches": "^2", + "druidfi/omen": "^0.8.0", "drupal/address": "^2.0", "drupal/antibot": "^2.0", "drupal/coffee": "^1.4", @@ -71,6 +72,9 @@ }, "extra": { "drupal-scaffold": { + "file-mapping": { + "[web-root]/sites/default/default.settings.php": false + }, "locations": { "web-root": "web/" } diff --git a/web/sites/default/default.settings.php b/web/sites/default/default.settings.php new file mode 100644 index 00000000..272f1b1c --- /dev/null +++ b/web/sites/default/default.settings.php @@ -0,0 +1,15 @@ + Date: Mon, 8 Jul 2024 11:53:20 +0300 Subject: [PATCH 4/4] Create uli link at the end of make fresh --- tools/make/project/starshot.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/make/project/starshot.mk b/tools/make/project/starshot.mk index f7577361..93af50cb 100644 --- a/tools/make/project/starshot.mk +++ b/tools/make/project/starshot.mk @@ -1,5 +1,5 @@ BUILD_TARGETS := composer-install -DRUPAL_FRESH_TARGETS := up build drupal-install +DRUPAL_FRESH_TARGETS := up build drupal-install drush-uli PHONY += drupal-install drupal-install: