Skip to main content

Build and Deployment

Scottsdale Mint deploys WordPress to AWS Lambda via the Ymir serverless WordPress platform. All deployments are triggered manually through Bitbucket Pipelines custom pipelines โ€” developers never run ymir deploy locally.


Deployment Environmentsโ€‹

EnvironmentDomainYmir Environment
Productionwww.scottsdalemint.comproduction
Stagingstaging.scottsdalemint.comstaging
Developmentdev.scottsdalemint.comdevelopment

Ymir Configuration (ymir.yml)โ€‹

The ymir.yml file at the project root controls all infrastructure and deployment settings.

Projectโ€‹

id: 931
name: scottsdalemint
type: bedrock

Note: The project type is bedrock reflecting the Roots Bedrock WordPress framework structure.

Deployment Typeโ€‹

All environments use image-based deployment (deployment: image) โ€” Ymir builds a Docker container image rather than a zip package.

Environment Summaryโ€‹

SettingProductionStagingDevelopment
Architecturex86_64x86_64x86_64
Lambda Concurrency80010080
Website Memory4096 MB2048 MB2048 MB
Website Timeout120s120sโ€”
Console Memory1024 MB1024 MB1024 MB
Console Timeout600s600s600s
Database Serverscottsdalemint-aurora-prodscottsdalemint-aurora-devscottsdalemint-aurora-dev
Database Namewordpresswordpress_stgwordpress_dev
Redis Cachescottsdalemint-prod-v2scottsdalemint-dev-v2scottsdalemint-dev-v2
Warmup Requests1004020
API GatewayDisabledDisabledDisabled
CronEnabledEnabledEnabled

Build Configurationโ€‹

build:
commands:
- 'composer install --no-dev'
include:
- web/app/plugins/woocommerce

The WooCommerce plugin is explicitly included in the build package because it is not managed via Composer โ€” it is bundled directly.

CDN Configuration (identical across all environments)โ€‹

cdn:
caching: enabled
process_images: enabled
cookies_whitelist:
- woocommerce_cart_hash
- woocommerce_items_in_cart
- woocommerce_recently_viewed
- 'wp_woocommerce_session_*'
excluded_paths:
- '/uploads/elementor/*'
- /addons
- /cart
- /checkout
- /my-account
forwarded_headers:
- origin
- authorization
- x-http-method-override
- x-wp-nonce

Bitbucket Pipelines (Primary Deployment Method)โ€‹

All three deployment pipelines are defined as custom pipelines and must be manually triggered from the Bitbucket UI (Pipelines โ†’ Run Pipeline โ†’ select pipeline). They are not triggered automatically on branch push.

Runnerโ€‹

Pipelines run on a self-hosted Bitbucket runner with the self.hosted, x86, linux labels. The pipeline container uses the composer:2 Docker image with Docker-in-Docker available.

Theme Submoduleโ€‹

The suma-elementor theme is a git submodule. Each pipeline checks out the environment-specific release branch before deploying:

PipelineSubmodule Branch
developmentrelease/development
stagingrelease/staging
productionrelease/production

Pipeline Stepsโ€‹

Each pipeline performs the following steps:

  1. Checks out the correct suma-elementor submodule branch for the target environment
  2. Installs required PHP extensions (redis, zip, ftp) via apk and pecl
  3. Runs composer install --no-scripts
  4. Deploys via vendor/bin/ymir deploy <environment>

Production โ€” Additional Post-Deploy Stepsโ€‹

After a successful deploy, the production pipeline also:

  1. Purges the Imperva CDN cache via the Imperva API (site ID 91102551)
  2. Waits 5 seconds for propagation
  3. Triggers the NFusion pricing cache refresh by calling the internal pricing middleware endpoint
# Post-deploy cache invalidation (production only)
- curl -X POST "https://my.imperva.com/api/prov/v1/sites/cache/purge?site_id=..." \
-H "x-API-Id: <IMPERVA_API_ID>" \
-H "x-API-Key: <IMPERVA_API_KEY>"
- sleep 5
- curl http://<PRICING_MIDDLEWARE_HOST>:3000/refresh-cache
Credentials

The Imperva API ID, API Key, and pricing middleware host are stored as Bitbucket Repository Variables. Do not hardcode them.

How to Trigger a Deploymentโ€‹

  1. Open the repository in Bitbucket
  2. Navigate to Pipelines โ†’ Run Pipeline
  3. Select the branch you want to deploy from
  4. Under Pipeline, choose custom: development, custom: staging, or custom: production
  5. Click Run
caution

Always deploy to development or staging first and verify before running the production pipeline. Production deployments go live immediately.


What Happens During a Ymir Deploymentโ€‹

  1. Ymir builds a Docker image from the codebase (deployment: image)
  2. Runs composer install --no-dev and bundles web/app/plugins/woocommerce
  3. Pushes the image to Amazon ECR
  4. Creates a new Lambda function version from the image
  5. Updates the Lambda alias to point to the new version
  6. Warmup requests are fired to pre-warm the Lambda pool
  7. CloudFront cache is invalidated
  8. (Production only) Imperva cache is purged and pricing cache is refreshed

Running Ymir CLI Commands (Admin / Debugging Only)โ€‹

Ymir CLI is available locally via vendor/bin/ymir for administrative tasks. It is not used to trigger deployments.

# Execute a WP-CLI command on production
vendor/bin/ymir command production -- wp cache flush

# Tail Lambda logs
vendor/bin/ymir logs production --tail

# View recent logs
vendor/bin/ymir logs production

Composer Dependenciesโ€‹

# Install all dependencies (including dev)
composer install

# Install for production (no dev, optimized autoloader)
composer install --no-dev --optimize-autoloader

# Update a specific package
composer update package/name

# Apply patches after update
composer install # cweagans/composer-patches applies automatically

Post-Deployment Checklistโ€‹

After any production deployment:

  • Health check: https://scottsdalemint.com/wp-json returns 200
  • WooCommerce is active and products are loading
  • Algolia search is functioning
  • Pricing pipeline is updating product prices (check a product price)
  • Checkout page loads without JavaScript errors
  • CloudFront cache is serving static assets
  • New Relic is receiving APM data
  • Imperva cache purge completed (check pipeline logs)

Rollbackโ€‹

Ymir supports rollback to a previous Lambda version:

vendor/bin/ymir rollback production

This immediately switches the Lambda alias back to the previous image version โ€” no redeployment needed.