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โ
| Environment | Domain | Ymir Environment |
|---|---|---|
| Production | www.scottsdalemint.com | production |
| Staging | staging.scottsdalemint.com | staging |
| Development | dev.scottsdalemint.com | development |
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โ
| Setting | Production | Staging | Development |
|---|---|---|---|
| Architecture | x86_64 | x86_64 | x86_64 |
| Lambda Concurrency | 800 | 100 | 80 |
| Website Memory | 4096 MB | 2048 MB | 2048 MB |
| Website Timeout | 120s | 120s | โ |
| Console Memory | 1024 MB | 1024 MB | 1024 MB |
| Console Timeout | 600s | 600s | 600s |
| Database Server | scottsdalemint-aurora-prod | scottsdalemint-aurora-dev | scottsdalemint-aurora-dev |
| Database Name | wordpress | wordpress_stg | wordpress_dev |
| Redis Cache | scottsdalemint-prod-v2 | scottsdalemint-dev-v2 | scottsdalemint-dev-v2 |
| Warmup Requests | 100 | 40 | 20 |
| API Gateway | Disabled | Disabled | Disabled |
| Cron | Enabled | Enabled | Enabled |
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:
| Pipeline | Submodule Branch |
|---|---|
development | release/development |
staging | release/staging |
production | release/production |
Pipeline Stepsโ
Each pipeline performs the following steps:
- Checks out the correct
suma-elementorsubmodule branch for the target environment - Installs required PHP extensions (
redis,zip,ftp) viaapkandpecl - Runs
composer install --no-scripts - Deploys via
vendor/bin/ymir deploy <environment>
Production โ Additional Post-Deploy Stepsโ
After a successful deploy, the production pipeline also:
- Purges the Imperva CDN cache via the Imperva API (site ID
91102551) - Waits 5 seconds for propagation
- 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
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โ
- Open the repository in Bitbucket
- Navigate to Pipelines โ Run Pipeline
- Select the branch you want to deploy from
- Under Pipeline, choose
custom: development,custom: staging, orcustom: production - Click Run
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โ
- Ymir builds a Docker image from the codebase (
deployment: image) - Runs
composer install --no-devand bundlesweb/app/plugins/woocommerce - Pushes the image to Amazon ECR
- Creates a new Lambda function version from the image
- Updates the Lambda alias to point to the new version
- Warmup requests are fired to pre-warm the Lambda pool
- CloudFront cache is invalidated
- (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-jsonreturns 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.