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

feat: PHP SPX #820

Merged
merged 3 commits into from
Nov 19, 2024
Merged
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.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ fi
[[ ${WARDEN_MAGEPACK} -eq 1 ]] \
&& appendEnvPartialIfExists "${WARDEN_ENV_TYPE}.magepack"

[[ ${WARDEN_PHP_SPX} -eq 1 ]] \
&& appendEnvPartialIfExists "php-spx"

if [[ -f "${WARDEN_ENV_PATH}/.warden/warden-env.yml" ]]; then
DOCKER_COMPOSE_ARGS+=("-f")
DOCKER_COMPOSE_ARGS+=("${WARDEN_ENV_PATH}/.warden/warden-env.yml")
Expand Down
16 changes: 16 additions & 0 deletions commands/spx.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
[[ ! ${WARDEN_DIR} ]] && >&2 echo -e "\033[31mThis script is not intended to be run directly!\033[0m" && exit 1

WARDEN_ENV_PATH="$(locateEnvPath)" || exit $?
loadEnvConfig "${WARDEN_ENV_PATH}" || exit $?

## set defaults for this command which can be overridden either using exports in the user
## profile or setting them in the .env configuration on a per-project basis
WARDEN_ENV_SPX_COMMAND=${WARDEN_ENV_SPX_COMMAND:-bash}
WARDEN_ENV_SPX_CONTAINER=${WARDEN_ENV_SPX_CONTAINER:-php-spx}

## allow return codes from sub-process to bubble up normally
trap '' ERR

"$WARDEN_BIN" env exec "${WARDEN_ENV_SPX_CONTAINER}" \
"${WARDEN_ENV_SPX_COMMAND}" "${WARDEN_PARAMS[@]}" "$@"
11 changes: 11 additions & 0 deletions commands/spx.help
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
[[ ! ${WARDEN_DIR} ]] && >&2 echo -e "\033[31mThis script is not intended to be run directly!\033[0m" && exit 1

WARDEN_USAGE=$(cat <<EOF
\033[33mUsage:\033[0m
spx [args]

\033[33mOptions:\033[0m
-h, --help Display this help menu
EOF
)
1 change: 1 addition & 0 deletions commands/usage.help
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Warden version $(cat ${WARDEN_DIR}/version)
shell Launches into a shell within the current project environment
status Display list of all running Warden project environments
debug Launches debug enabled shell within current project environment
spx Launches spx enabled shell within current project environment
sign-certificate Signs a wildcard certificate including all passed hostnames on the SAN list
version Show version information
EOF
Expand Down
1 change: 1 addition & 0 deletions environments/drupal/init.env
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ PHP_XDEBUG_3=1
WARDEN_DB=1
WARDEN_RABBITMQ=0
WARDEN_REDIS=0
WARDEN_PHP_SPX=0

RABBITMQ_VERSION=3.8

Expand Down
26 changes: 26 additions & 0 deletions environments/includes/php-spx.base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
x-volumes: &volumes
- ${WARDEN_SSL_DIR}/rootca/certs:/etc/ssl/warden-rootca-cert:ro
- ${WARDEN_COMPOSER_DIR}:/home/www-data/.composer:cached
- .${WARDEN_WEB_ROOT:-}/:/var/www/html:cached
- bashhistory:/bash_history
- sshdirectory:/home/www-data/.ssh

x-extra_hosts: &extra_hosts
- ${TRAEFIK_DOMAIN}:${TRAEFIK_ADDRESS:-0.0.0.0}
- ${TRAEFIK_SUBDOMAIN:-app}.${TRAEFIK_DOMAIN}:${TRAEFIK_ADDRESS:-0.0.0.0}

services:
php-spx:
hostname: "${WARDEN_ENV_NAME}-php-spx"
image: ${WARDEN_IMAGE_REPOSITORY}/php-fpm${WARDEN_SVC_PHP_IMAGE_SUFFIX:-}:${PHP_VERSION:-7.4}-spx
environment:
- TRAEFIK_DOMAIN
- TRAEFIK_SUBDOMAIN
- SSH_AUTH_SOCK=${SSH_AUTH_SOCK_PATH_ENV:-/tmp/ssh-auth.sock}
- NODE_VERSION=${NODE_VERSION:-12}
- COMPOSER_VERSION=${COMPOSER_VERSION:-1}
- COMPOSER_MEMORY_LIMIT=-1
- HISTFILE=/bash_history/.bash_history
- CHOWN_DIR_LIST=${CHOWN_DIR_LIST:-}
volumes: *volumes
extra_hosts: *extra_hosts
1 change: 1 addition & 0 deletions environments/laravel/init.env
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ REDIS_VERSION=5.0

WARDEN_DB=1
WARDEN_REDIS=1
WARDEN_PHP_SPX=0

## Laravel Config
APP_URL=http://app.$WARDEN_ENV_NAME.test
Expand Down
1 change: 1 addition & 0 deletions environments/magento1/init.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

WARDEN_DB=1
WARDEN_REDIS=1
WARDEN_PHP_SPX=0

MYSQL_DISTRIBUTION=mariadb
MYSQL_DISTRIBUTION_VERSION=10.3
Expand Down
1 change: 1 addition & 0 deletions environments/magento2/init.env
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ WARDEN_ELASTICHQ=0
WARDEN_VARNISH=1
WARDEN_RABBITMQ=1
WARDEN_REDIS=1
WARDEN_PHP_SPX=0

OPENSEARCH_VERSION=2.12
MYSQL_DISTRIBUTION=mariadb
Expand Down
1 change: 1 addition & 0 deletions environments/shopware/init.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ WARDEN_REDIS=1
WARDEN_RABBITMQ=0
WARDEN_ELASTICSEARCH=0
WARDEN_VARNISH=0
WARDEN_PHP_SPX=0

MYSQL_DISTRIBUTION=mariadb
MYSQL_DISTRIBUTION_VERSION=10.4
Expand Down
1 change: 1 addition & 0 deletions environments/symfony/init.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ WARDEN_REDIS=1
WARDEN_RABBITMQ=0
WARDEN_ELASTICSEARCH=0
WARDEN_VARNISH=0
WARDEN_PHP_SPX=0

MYSQL_DISTRIBUTION=mariadb
MYSQL_DISTRIBUTION_VERSION=10.4
Expand Down
1 change: 1 addition & 0 deletions environments/wordpress/init.env
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ PHP_XDEBUG_3=1

WARDEN_DB=1
WARDEN_REDIS=0
WARDEN_PHP_SPX=0

APP_ENV=local
APP_DEBUG=true
Expand Down