Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add environment version support. #773

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions commands/env-init.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,16 @@ if [ -z "${WARDEN_ENV_TYPE}" ]; then
done
fi

WARDEN_ENV_VERSION="${WARDEN_PARAMS[2]:-default}"

# Verify the auto-select and/or type path resolves correctly before setting it
assertValidEnvType || exit $?

# Write the .env file to current working directory
cat > "${WARDEN_ENV_PATH}/.env" <<EOF
WARDEN_ENV_NAME=${WARDEN_ENV_NAME}
WARDEN_ENV_TYPE=${WARDEN_ENV_TYPE}
WARDEN_ENV_VERSION=${WARDEN_ENV_VERSION}
WARDEN_WEB_ROOT=/

TRAEFIK_DOMAIN=${WARDEN_ENV_NAME}.test
Expand Down
2 changes: 1 addition & 1 deletion commands/env-init.help
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

WARDEN_USAGE=$(cat <<EOF
\033[33mUsage:\033[0m
env-init <project_name> <environment_type>
env-init <project_name> <environment_type> <environment_version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since <environment_version> is optional, it should be surrounded by square brackets: [<environment_version>]; otherwise, it appears to be a required argument.


\033[33mOptions:\033[0m
-h, --help Display this help menu
Expand Down
10 changes: 5 additions & 5 deletions commands/env.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,14 @@ TRAEFIK_ADDRESS="$(docker container inspect traefik \
export TRAEFIK_ADDRESS;

if [[ $OSTYPE =~ ^darwin ]]; then
export MUTAGEN_SYNC_FILE="${WARDEN_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml"
export MUTAGEN_SYNC_FILE="${WARDEN_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_VERSION}/${WARDEN_ENV_TYPE}.mutagen.yml"

if [[ -f "${WARDEN_HOME_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml" ]]; then
export MUTAGEN_SYNC_FILE="${WARDEN_HOME_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml"
if [[ -f "${WARDEN_HOME_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_VERSION}/${WARDEN_ENV_TYPE}.mutagen.yml" ]]; then
export MUTAGEN_SYNC_FILE="${WARDEN_HOME_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_VERSION}/${WARDEN_ENV_TYPE}.mutagen.yml"
fi

if [[ -f "${WARDEN_ENV_PATH}/.warden/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml" ]]; then
export MUTAGEN_SYNC_FILE="${WARDEN_ENV_PATH}/.warden/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml"
if [[ -f "${WARDEN_ENV_PATH}/.warden/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_VERSION}/${WARDEN_ENV_TYPE}.mutagen.yml" ]]; then
export MUTAGEN_SYNC_FILE="${WARDEN_ENV_PATH}/.warden/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_VERSION}/${WARDEN_ENV_TYPE}.mutagen.yml"
fi

if [[ -f "${WARDEN_ENV_PATH}/.warden/mutagen.yml" ]]; then
Expand Down
10 changes: 5 additions & 5 deletions commands/sync.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ if [[ $OSTYPE =~ ^darwin ]] && ! test $(version ${MUTAGEN_VERSION}) -ge $(versio
fi

if [[ $OSTYPE =~ ^darwin && -z "${MUTAGEN_SYNC_FILE}" ]]; then
export MUTAGEN_SYNC_FILE="${WARDEN_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml"
export MUTAGEN_SYNC_FILE="${WARDEN_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_VERSION}/${WARDEN_ENV_TYPE}.mutagen.yml"

if [[ -f "${WARDEN_HOME_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml" ]]; then
export MUTAGEN_SYNC_FILE="${WARDEN_HOME_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml"
if [[ -f "${WARDEN_HOME_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_VERSION}/${WARDEN_ENV_TYPE}.mutagen.yml" ]]; then
export MUTAGEN_SYNC_FILE="${WARDEN_HOME_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_VERSION}/${WARDEN_ENV_TYPE}.mutagen.yml"
fi

if [[ -f "${WARDEN_ENV_PATH}/.warden/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml" ]]; then
export MUTAGEN_SYNC_FILE="${WARDEN_ENV_PATH}/.warden/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml"
if [[ -f "${WARDEN_ENV_PATH}/.warden/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_VERSION}/${WARDEN_ENV_TYPE}.mutagen.yml" ]]; then
export MUTAGEN_SYNC_FILE="${WARDEN_ENV_PATH}/.warden/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_VERSION}/${WARDEN_ENV_TYPE}.mutagen.yml"
fi

if [[ -f "${WARDEN_ENV_PATH}/.warden/mutagen.yml" ]]; then
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
37 changes: 37 additions & 0 deletions environments/magento2/2.4.5/init.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

WARDEN_DB=1
WARDEN_ELASTICSEARCH=0
WARDEN_OPENSEARCH=1
WARDEN_ELASTICHQ=0
WARDEN_VARNISH=1
WARDEN_RABBITMQ=1
WARDEN_REDIS=1

OPENSEARCH_VERSION=1.2
MYSQL_DISTRIBUTION=mariadb
MYSQL_DISTRIBUTION_VERSION=10.4
NODE_VERSION=12
COMPOSER_VERSION=2.2
PHP_VERSION=8.1
PHP_XDEBUG_3=1
RABBITMQ_VERSION=3.9
REDIS_VERSION=6.2
VARNISH_VERSION=7.0

WARDEN_SYNC_IGNORE=

WARDEN_ALLURE=0
WARDEN_SELENIUM=0
WARDEN_SELENIUM_DEBUG=0
WARDEN_BLACKFIRE=0
WARDEN_SPLIT_SALES=0
WARDEN_SPLIT_CHECKOUT=0
WARDEN_TEST_DB=1
WARDEN_MAGEPACK=0
MAGEPACK_VERSION=2.11

BLACKFIRE_CLIENT_ID=
BLACKFIRE_CLIENT_TOKEN=
BLACKFIRE_SERVER_ID=
BLACKFIRE_SERVER_TOKEN=

11 changes: 11 additions & 0 deletions environments/magento2/2.4.6/db.base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
services:
db:
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-magento}
- MYSQL_DATABASE=${MYSQL_DATABASE:-magento}
- MYSQL_USER=${MYSQL_USER:-magento}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-magento}
command:
- mysqld
- --max_allowed_packet=1024M
- --explicit_defaults_for_timestamp=on
37 changes: 37 additions & 0 deletions environments/magento2/2.4.6/init.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

WARDEN_DB=1
WARDEN_ELASTICSEARCH=0
WARDEN_OPENSEARCH=1
WARDEN_ELASTICHQ=0
WARDEN_VARNISH=1
WARDEN_RABBITMQ=1
WARDEN_REDIS=1

OPENSEARCH_VERSION=2.5
MYSQL_DISTRIBUTION=mariadb
MYSQL_DISTRIBUTION_VERSION=10.6
NODE_VERSION=12
COMPOSER_VERSION=2.2
PHP_VERSION=8.2
PHP_XDEBUG_3=1
RABBITMQ_VERSION=3.11
REDIS_VERSION=7.0
VARNISH_VERSION=7.1

WARDEN_SYNC_IGNORE=

WARDEN_ALLURE=0
WARDEN_SELENIUM=0
WARDEN_SELENIUM_DEBUG=0
WARDEN_BLACKFIRE=0
WARDEN_SPLIT_SALES=0
WARDEN_SPLIT_CHECKOUT=0
WARDEN_TEST_DB=1
WARDEN_MAGEPACK=0
MAGEPACK_VERSION=2.11

BLACKFIRE_CLIENT_ID=
BLACKFIRE_CLIENT_TOKEN=
BLACKFIRE_SERVER_ID=
BLACKFIRE_SERVER_TOKEN=

23 changes: 23 additions & 0 deletions environments/magento2/2.4.6/magento2.base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
services:
nginx:
environment:
- NGINX_PUBLIC=/pub
- NGINX_TEMPLATE=magento2.conf

php-fpm:
labels:
- traefik.enable=true
- traefik.http.routers.${WARDEN_ENV_NAME}-livereload.tls=true
- traefik.http.routers.${WARDEN_ENV_NAME}-livereload.priority=3
- traefik.http.routers.${WARDEN_ENV_NAME}-livereload.rule=
(HostRegexp(`{subdomain:.+}.${TRAEFIK_DOMAIN}`) || Host(`${TRAEFIK_DOMAIN}`))
&& (Path(`/livereload.js`) || Path(`/livereload`))
- traefik.http.routers.${WARDEN_ENV_NAME}-livereload.service=${WARDEN_ENV_NAME}-livereload
- traefik.http.services.${WARDEN_ENV_NAME}-livereload.loadbalancer.server.port=35729
- traefik.docker.network=${WARDEN_ENV_NAME}_default
environment:
- MAGE_DEBUG_SHOW_ARGS=1

php-debug:
environment:
- MAGE_DEBUG_SHOW_ARGS=1
10 changes: 10 additions & 0 deletions environments/magento2/2.4.6/magento2.blackfire.darwin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

x-volumes: &volumes
- .${WARDEN_WEB_ROOT:-}/pub/media:/var/www/html/pub/media:cached
- appdata:/var/www/html

x-environment: &environment
- CHOWN_DIR_LIST=pub/media ${CHOWN_DIR_LIST:-}

services:
php-blackfire: { volumes: *volumes, environment: *environment }
15 changes: 15 additions & 0 deletions environments/magento2/2.4.6/magento2.darwin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

x-volumes: &volumes
- .${WARDEN_WEB_ROOT:-}/pub/media:/var/www/html/pub/media:cached
- appdata:/var/www/html

x-environment: &environment
- CHOWN_DIR_LIST=pub/media ${CHOWN_DIR_LIST:-}

services:
nginx: { volumes: *volumes }
php-fpm: { volumes: *volumes, environment: *environment }
php-debug: { volumes: *volumes, environment: *environment }

volumes:
appdata:
12 changes: 12 additions & 0 deletions environments/magento2/2.4.6/magento2.magepack.base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
services:
magepack:
hostname: "${WARDEN_ENV_NAME}-magepack"
image: ${WARDEN_IMAGE_REPOSITORY}/magepack:${MAGEPACK_VERSION:-2.3}
environment:
- TRAEFIK_DOMAIN
- TRAEFIK_SUBDOMAIN
extra_hosts:
- ${TRAEFIK_DOMAIN}:${TRAEFIK_ADDRESS:-0.0.0.0}
- ${TRAEFIK_SUBDOMAIN:-app}.${TRAEFIK_DOMAIN}:${TRAEFIK_ADDRESS:-0.0.0.0}
depends_on:
- php-fpm
7 changes: 7 additions & 0 deletions environments/magento2/2.4.6/magento2.magepack.darwin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

x-volumes: &volumes
- .${WARDEN_WEB_ROOT:-}/pub/media:/var/www/html/pub/media:cached
- appdata:/var/www/html

services:
magepack: { volumes: *volumes }
6 changes: 6 additions & 0 deletions environments/magento2/2.4.6/magento2.magepack.linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

x-volumes: &volumes
- .${WARDEN_WEB_ROOT:-}/:/var/www/html

services:
magepack: { volumes: *volumes }
30 changes: 30 additions & 0 deletions environments/magento2/2.4.6/magento2.mutagen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
sync:
defaults:
mode: two-way-resolved
watch:
pollingInterval: 10
ignore:
vcs: false
paths:
# Root .git folder
- "/.git/"

# System files
- ".DS_Store"
- "._*"

# Vim files
- "*~"
- "*.sw[a-p]"

# Magento files
- "/pub/media"
- "/pub/static/**"
- "!/pub/static/.htaccess"
- "/var/**"
- "!/var/.htaccess"

permissions:
defaultFileMode: "0644"
defaultDirectoryMode: "0755"
25 changes: 25 additions & 0 deletions environments/magento2/2.4.6/magento2.splitdb.checkout.base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
services:
php-fpm:
depends_on:
- checkoutdb

php-debug:
depends_on:
- checkoutdb

checkoutdb:
hostname: "${WARDEN_ENV_NAME}-checkoutdb"
image: ${WARDEN_IMAGE_REPOSITORY}/${MYSQL_DISTRIBUTION:-mariadb}:${MYSQL_DISTRIBUTION_VERSION:-${MARIADB_VERSION:-10.4}}
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-magento}
- MYSQL_DATABASE=${MYSQL_DATABASE:-magento}
- MYSQL_USER=${MYSQL_USER:-magento}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-magento}
command:
- mysqld
- --max_allowed_packet=1024M
volumes:
- checkoutdbdata:/var/lib/mysql

volumes:
checkoutdbdata:
25 changes: 25 additions & 0 deletions environments/magento2/2.4.6/magento2.splitdb.sales.base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
services:
php-fpm:
depends_on:
- salesdb

php-debug:
depends_on:
- salesdb

salesdb:
hostname: "${WARDEN_ENV_NAME}-salesdb"
image: ${WARDEN_IMAGE_REPOSITORY}/${MYSQL_DISTRIBUTION:-mariadb}:${MYSQL_DISTRIBUTION_VERSION:-${MARIADB_VERSION:-10.4}}
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-magento}
- MYSQL_DATABASE=${MYSQL_DATABASE:-magento}
- MYSQL_USER=${MYSQL_USER:-magento}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-magento}
command:
- mysqld
- --max_allowed_packet=1024M
volumes:
- salesdbdata:/var/lib/mysql

volumes:
salesdbdata:
21 changes: 21 additions & 0 deletions environments/magento2/2.4.6/magento2.tests.base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
services:
tmp-mysql:
hostname: "${WARDEN_ENV_NAME}-mysql"
image: ${WARDEN_IMAGE_REPOSITORY}/${MYSQL_DISTRIBUTION:-mariadb}:${MYSQL_DISTRIBUTION_VERSION:-${MARIADB_VERSION:-10.4}}
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-magento}
- MYSQL_DATABASE=magento_integration_tests
- MYSQL_USER=${MYSQL_USER:-magento}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-magento}
command:
- mysqld
- --max_allowed_packet=1024M
- --explicit_defaults_for_timestamp=on
volumes:
- tmp-dbdata:/var/lib/mysql

volumes:
tmp-dbdata:
driver_opts:
type: tmpfs
device: tmpfs
11 changes: 11 additions & 0 deletions environments/magento2/2.4.7/db.base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
services:
db:
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-magento}
- MYSQL_DATABASE=${MYSQL_DATABASE:-magento}
- MYSQL_USER=${MYSQL_USER:-magento}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-magento}
command:
- mysqld
- --max_allowed_packet=1024M
- --explicit_defaults_for_timestamp=on
37 changes: 37 additions & 0 deletions environments/magento2/2.4.7/init.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

WARDEN_DB=1
WARDEN_ELASTICSEARCH=0
WARDEN_OPENSEARCH=1
WARDEN_ELASTICHQ=0
WARDEN_VARNISH=1
WARDEN_RABBITMQ=1
WARDEN_REDIS=1

OPENSEARCH_VERSION=2.12
MYSQL_DISTRIBUTION=mariadb
MYSQL_DISTRIBUTION_VERSION=10.6
NODE_VERSION=12
COMPOSER_VERSION=2.7
PHP_VERSION=8.3
PHP_XDEBUG_3=1
RABBITMQ_VERSION=3.13
REDIS_VERSION=7.2
VARNISH_VERSION=7.5

WARDEN_SYNC_IGNORE=

WARDEN_ALLURE=0
WARDEN_SELENIUM=0
WARDEN_SELENIUM_DEBUG=0
WARDEN_BLACKFIRE=0
WARDEN_SPLIT_SALES=0
WARDEN_SPLIT_CHECKOUT=0
WARDEN_TEST_DB=1
WARDEN_MAGEPACK=0
MAGEPACK_VERSION=2.11

BLACKFIRE_CLIENT_ID=
BLACKFIRE_CLIENT_TOKEN=
BLACKFIRE_SERVER_ID=
BLACKFIRE_SERVER_TOKEN=

Loading