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

wardenenv/images#719 - Add PHP-SPX image build #17

Merged
merged 3 commits into from
Aug 6, 2024

Conversation

bap14
Copy link
Member

@bap14 bap14 commented Jan 29, 2024

Adds a new SPX image build. Adjusts Nginx configuration to route requests to the SPX container (similar to Xdebug), and prevents Varnish from caching SPX requests.

@@ -2,12 +2,17 @@
resolver 127.0.0.11;

# Select upstream backend to use based on presense of Xdebug cookies and Blackfire headers
map "$http_X_BLACKFIRE_QUERY:$cookie_XDEBUG_SESSION$cookie_XDEBUG_PROFILE$cookie_XDEBUG_TRACE$arg_XDEBUG_SESSION$arg_XDEBUG_SESSION_START" $fastcgi_backend {
map "$http_X_BLACKFIRE_QUERY:$cookie_XDEBUG_SESSION$cookie_XDEBUG_PROFILE$cookie_XDEBUG_TRACE$arg_XDEBUG_SESSION$arg_XDEBUG_SESSION_START:$cookie_SPX_ENABLED$cookie_SPX_KEY$arg_SPX_ENABLED$arg_SPX_KEY$arg_SPX_UI_URI" $fastcgi_backend {
volatile;
Copy link
Member Author

Choose a reason for hiding this comment

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

@navarr I was having issues with cookies not being respected; however, it could have been because of Varnish caching the requests. This line shouldn't need to be there.

@MagePsycho
Copy link

What's the status of this PR? @navarr

@navarr
Copy link
Member

navarr commented Mar 21, 2024

@MagePsycho held up until at minimum I fix PHP images not building

@navarr navarr merged commit 833af28 into wardenenv:main Aug 6, 2024
@ihor-sviziev
Copy link
Contributor

@bap14, is there instruction how to use this image? :)

@bap14
Copy link
Member Author

bap14 commented Nov 5, 2024

@ihor-sviziev Not yet; however, now that the image is there it can move forward in being a toggled feature for projects.

@bgorski
Copy link

bgorski commented Nov 17, 2024

For anyone interested, to make SPX in Warden work now, you can add or modify the .warden/warden-env.yml file in your project and add the following things:

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

where x-volumes and x-extra_hosts are taken from environments/includes/php-fpm.base.yml in your warden installation (the ones above work for 0.15.0) and php-spx is a new container that will handle all requests that have SPX enabled.

In order to enable SPX in your requests, add the following cookies or URL params:

  • SPX_ENABLED with a value of 1
  • SPX_KEY with "warden" (without quotation marks) as the value.

To go to your SPX web UI, just use the following URL: https://yourproject.test/?SPX_UI_URI=/ where yourproject.test matches the domain you use for your project.

I'm not sure how long it will work this way, since I guess that some easier method of enabling SPX will get added to Warden in the future, but hopefully it will save someone some time setting this up for as long as there's no better way.

@monteshot
Copy link

Please notice the following:
wardenenv/warden#820 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants