Skip to content

Commit

Permalink
Update configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-bot authored Dec 21, 2022
1 parent 6490682 commit ae4228f
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 58 deletions.
60 changes: 30 additions & 30 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 0 additions & 17 deletions tools/make/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,6 @@ UNAME_S := $(shell uname -s)
UPDATE_SCRIPT_URL := https://git.io/JP10q
WEBROOT ?= public

# Detect app
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)
IS_WP ?= $(shell (test -f $(WEBROOT)/wp-settings.php || test -f conf/wp-config.php) && echo yes || echo no)

# Detect additional tooling
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

include $(DRUIDFI_TOOLS_MAKE_DIR)utils.mk

# Include druidfi/tools make files
Expand Down
3 changes: 2 additions & 1 deletion tools/make/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ build-production:

PHONY += clean
clean: ## Cleanup
$(call step,Do Git clean\n)
$(call step,Cleanup loaded files...\n)
@rm -rf vendor
@git clean -fdx $(foreach item,$(CLEAN_EXCLUDE),-e $(item))

PHONY += self-update
Expand Down
12 changes: 6 additions & 6 deletions tools/make/docker.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CLI_SERVICE := cli
CLI_SHELL := sh
CLI_USER := root
DOCKER_COMPOSE := docker-compose
DOCKER_COMPOSE := docker compose
DOCKER_COMPOSE_EXEC ?= $(DOCKER_COMPOSE) exec
DOCKER_COMPOSE_YML_PATH ?= docker-compose.yml
DOCKER_COMPOSE_YML_EXISTS := $(shell test -f $(DOCKER_COMPOSE_YML_PATH) && echo yes || echo no)
Expand All @@ -15,7 +15,7 @@ endif

PHONY += config
config: ## Show docker-compose config
$(call step,Show docker-compose config...\n)
$(call step,Show Docker Compose config...\n)
$(call docker_compose,config)

PHONY += pull
Expand All @@ -29,8 +29,8 @@ down: ## Tear down the environment
$(call docker_compose,down -v --remove-orphans --rmi local)

PHONY += ps
ps: ## Show docker-compose ps
$(call step,Show docker-compose ps...\n)
ps: ## List containers
$(call step,List container(s)...\n)
$(call docker_compose,ps)

PHONY += stop
Expand All @@ -39,9 +39,9 @@ stop: ## Stop the environment
$(call docker_compose,stop)

PHONY += up
up: pull ## Launch the environment
up: ## Launch the environment
$(call step,Start up the container(s)...\n)
$(call docker_compose,up -d --remove-orphans)
$(call docker_compose,up -d --pull always --wait --remove-orphans)

PHONY += shell
shell: ## Login to CLI container
Expand Down
11 changes: 9 additions & 2 deletions tools/make/drupal.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DRUPAL_DISABLE_MODULES ?= no
DRUPAL_ENABLE_MODULES ?= no
DRUPAL_PROFILE ?= minimal
DRUPAL_SYNC_FILES ?= yes
DRUPAL_SYNC_SOURCE ?= production
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
Expand Down Expand Up @@ -38,6 +38,7 @@ endif

PHONY += drupal-create-folders
drupal-create-folders:
@mkdir -p $(WEBROOT)/sites/default/files/private
@mkdir -p $(WEBROOT)/sites/default/files/translations

PHONY += drupal-update
Expand Down Expand Up @@ -157,7 +158,7 @@ drush-create-dump: ## Create database dump to dump.sql

PHONY += drush-download-dump
drush-download-dump: ## Download database dump to dump.sql
$(call drush,-Dssh.tty=0 @$(DRUPAL_SYNC_SOURCE) sql-dump --structure-tables-key=common > ${DOCKER_PROJECT_ROOT}/$(DUMP_SQL_FILENAME))
$(call drush,@$(DRUPAL_SYNC_SOURCE) sql-dump --structure-tables-key=common > ${DOCKER_PROJECT_ROOT}/$(DUMP_SQL_FILENAME))

PHONY += open-db-gui
open-db-gui: DB_CONTAINER := $(COMPOSE_PROJECT_NAME)-db
Expand All @@ -172,6 +173,12 @@ fix-drupal: ## Fix Drupal code style
$(call step,Fix Drupal code style with phpcbf...\n)
$(call cs,phpcbf,$(PATHS))

PHONY += fix-drupal-coder
fix-drupal-coder: VERSION := 8.3.16
fix-drupal-coder: ## Fix Drupal Coder loading
composer config repositories.drupal '{"type": "composer", "url": "https://packages.drupal.org/8"}'
composer config repositories.drupal/coder '{"type": "package", "package": {"name": "drupal/coder", "type": "phpcodesniffer-standard", "version": "$(VERSION)", "dist": {"type": "zip", "url": "https://ftp.drupal.org/files/projects/coder-$(VERSION).zip"}}}'

PHONY += lint-drupal
lint-drupal: PATHS := $(subst $(space),,$(LINT_PATHS_PHP))
lint-drupal: ## Lint Drupal code style
Expand Down
23 changes: 23 additions & 0 deletions tools/make/include.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ 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)
IS_WP ?= $(shell (test -f $(WEBROOT)/wp-settings.php || test -f conf/wp-config.php) && echo yes || echo no)

ifeq ($(IS_DRUPAL),yes)
include $(DRUIDFI_TOOLS_MAKE_DIR)drupal.mk
endif
Expand All @@ -18,6 +26,21 @@ ifeq ($(IS_WP),yes)
include $(DRUIDFI_TOOLS_MAKE_DIR)wordpress.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
Expand Down
3 changes: 1 addition & 2 deletions tools/make/kubectl.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ KUBECTL_NAMESPACE ?= foobar-namespace
KUBECTL_SHELL ?= sh
KUBECTL_EXEC_FLAGS ?= -n $(KUBECTL_NAMESPACE) -c $(KUBECTL_CONTAINER)
KUBECTL_WORKDIR ?= /app
KUBECTL_POD_SELECTOR ?= --field-selector=status.phase==Running

PHONY += kubectl-sync-db
kubectl-sync-db: ## Sync database from Kubernetes
Expand Down Expand Up @@ -48,5 +47,5 @@ define kubectl_cp
endef

define kubectl_get_pod
$(shell $(KUBECTL_BIN) get pods -n $(KUBECTL_NAMESPACE) $(KUBECTL_POD_SELECTOR) -o jsonpath="{.items[0].metadata.name}")
$(shell $(KUBECTL_BIN) get pods -n $(KUBECTL_NAMESPACE) --template '{{range .items}}{{ if not .metadata.deletionTimestamp }}{{.metadata.name}}{{"\n"}}{{end}}{{end}}')
endef

0 comments on commit ae4228f

Please sign in to comment.