Skip to content
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
7 changes: 7 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ VORTEX_PROVISION_TYPE=database
# Set this to 1 in .env.local to override when developing locally.
VORTEX_PROVISION_OVERRIDE_DB=0

# Fallback to profile installation if the database dump is not available.
#
# When enabled and the provision type is set to "database", the site will be
# installed from the profile if the database dump file or container image
# is not available.
VORTEX_PROVISION_FALLBACK_TO_PROFILE=0

# Skip database sanitization.
#
# Database sanitization is enabled by default in all non-production
Expand Down
1 change: 1 addition & 0 deletions .vortex/docs/content/development/variables.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ The list below is automatically generated with [Shellvar](https://github.com/ale
| <a id="vortex_provision_db_dir"></a>`VORTEX_PROVISION_DB_DIR` | Directory with database dump file. | `./.data` | `scripts/vortex/provision.sh` |
| <a id="vortex_provision_db_file"></a>`VORTEX_PROVISION_DB_FILE` | Database dump file name. | `db.sql` | `scripts/vortex/provision.sh` |
| <a id="vortex_provision_db_image"></a>`VORTEX_PROVISION_DB_IMAGE` | Name of the pre-built database container image. | `${VORTEX_DB_IMAGE}` | `scripts/vortex/provision.sh` |
| <a id="vortex_provision_fallback_to_profile"></a>`VORTEX_PROVISION_FALLBACK_TO_PROFILE` | Fallback to profile installation if the database dump is not available.<br/><br/>When enabled and the provision type is set to "database", the site will be installed from the profile if the database dump file or container image is not available. | `UNDEFINED` | `.env`, `scripts/vortex/provision.sh` |
| <a id="vortex_provision_override_db"></a>`VORTEX_PROVISION_OVERRIDE_DB` | Overwrite a database if it exists.<br/><br/>Usually set to `0` in deployed environments and can be temporary set to `1` for a specific deployment. Set this to `1` in .env.local to override when developing locally. | `UNDEFINED` | `.env`, `.env.local.example`, `scripts/vortex/provision.sh` |
| <a id="vortex_provision_post_operations_skip"></a>`VORTEX_PROVISION_POST_OPERATIONS_SKIP` | Flag to skip running of operations after site provision is complete. Useful to only import the database from file (or install from profile) and not perform any additional operations. For example, when need to capture database state before any updates ran (for example, DB caching in CI). | `0` | `scripts/vortex/provision.sh` |
| <a id="vortex_provision_sanitize_db_additional_file"></a>`VORTEX_PROVISION_SANITIZE_DB_ADDITIONAL_FILE` | Path to file with custom sanitization SQL queries.<br/><br/>To skip custom sanitization, remove the file defined in VORTEX_PROVISION_SANITIZE_DB_ADDITIONAL_FILE variable from the codebase. | `./scripts/sanitize.sql` | `scripts/vortex/provision-sanitize-db.sh` |
Expand Down
67 changes: 58 additions & 9 deletions .vortex/docs/content/drupal/provision.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,70 @@ conditions that could alter the execution path.
The numbered steps refer to the environment variables described in the next
section.

<picture style={{ display: 'block', textAlign: 'center' }}>
<img src="/img/diagram-provision-dark.svg#gh-dark-mode-only" alt="Provision flow"/>
<img src="/img/diagram-provision-light.svg#gh-light-mode-only" alt="Provision flow"/>
</picture>
```text
🚀 Start
① 💡 Skip provision? ──Yes──► 🏁 End
│ No
② 💡 Provision type = database
├─ 💡 Existing site found = YES
│ ├─ Container image set? ──► preserve content (no change)
│ ├─ ③ Overwrite DB? ──Yes──► 🗑️ Drop DB ──► 🛢️ Attempt import from dump
│ │ │
│ │ ├─ Dump file exists? ──► 🛢️ Import DB
│ │ └─ Dump file missing?
│ │ ├─ ④ Fallback? ──Yes──► 📦 Install from profile ✓
│ │ └─ ④ Fallback? ──No───► 🏁 EXIT 1 (fail) ✗
│ └─ else ──► preserve content, ⑦ skip sanitization
└─ 💡 Existing site found = NO
├─ Container image set?
│ ├─ ④ Fallback? ──Yes──► 📦 Install from profile ✓
│ └─ ④ Fallback? ──No───► 🏁 EXIT 1 ("corrupted image") ✗
└─ Container image not set? ──► 🗑️ Drop DB ──► 🛢️ Attempt import from dump
├─ Dump file exists? ──► 🛢️ Import DB
└─ Dump file missing?
├─ ④ Fallback? ──Yes──► 📦 Install from profile ✓
└─ ④ Fallback? ──No───► 🏁 EXIT 1 (fail) ✗

── after provisioning (both DB and profile paths) ──

⑤ 💡 Skip other operations? ──Yes──► 🏁 End
│ No
⑥ 🚧 Enable maintenance mode
⬇️ Import configuration
🔄 Run DB updates
🧹 Rebuild caches
🔄 Run deployment operations
⑦ 😷 Run DB sanitization
⚙️ Run custom scripts
⑥ 🚧 Disable maintenance mode
🏁 End
```

### Customizing flow

You can control the provisioning flow using the following environment variables:

1. `VORTEX_PROVISION_SKIP=1`<br/>Kill-switch to completely skip provisioning. The script will exit immediately after start. Useful in emergencies when any kind of automation needs to be disabled.<br/><br/>
2. `VORTEX_PROVISION_OVERRIDE_DB=1`<br/>Drop an existing database before importing from dump/installing from profile. This is useful when an already provisioned environment requires a fresh database to be imported.<br/><br/>
3. `VORTEX_PROVISION_TYPE=profile`<br/>Install from a Drupal `profile` instead of importing from a `database` dump. Useful for building sites without the persistent DB and/or test profile configuration installation.<br/><br/>
4. `VORTEX_PROVISION_POST_OPERATIONS_SKIP=1`<br/>Skip configuration imports, database updates, and other post-provisioning steps. Essentially, this is `drush sql:drop` and `$(drush sql:connect) < .data/db.sql` commands. This is useful when you want to provision a site without running any additional operations.<br/>`ahoy import-db` uses this flag to import DB and exit.<br/><br/>
5. `VORTEX_PROVISION_USE_MAINTENANCE_MODE=1`<br/>Enable maintenance mode right after the site is bootstrappable and disable it at the end. Useful when you want to prevent users from accessing the site while it is being provisioned.<br/><br/>
6. `VORTEX_PROVISION_SANITIZE_DB_SKIP=1`<br/>Disable database sanitization.
2. `VORTEX_PROVISION_TYPE=profile`<br/>Install from a Drupal `profile` instead of importing from a `database` dump. Useful for building sites without the persistent DB and/or test profile configuration installation.<br/><br/>
3. `VORTEX_PROVISION_OVERRIDE_DB=1`<br/>Drop an existing database before importing from dump/installing from profile. This is useful when an already provisioned environment requires a fresh database to be imported.<br/><br/>
4. `VORTEX_PROVISION_FALLBACK_TO_PROFILE=1`<br/>Automatically fall back to installing from profile if the database dump file or container image is not available. Useful for distribution demos or when using recipes/profiles that can install without a pre-existing database.<br/><br/>
5. `VORTEX_PROVISION_POST_OPERATIONS_SKIP=1`<br/>Skip configuration imports, database updates, and other post-provisioning steps. Essentially, this is `drush sql:drop` and `$(drush sql:connect) < .data/db.sql` commands. This is useful when you want to provision a site without running any additional operations.<br/>`ahoy import-db` uses this flag to import DB and exit.<br/><br/>
6. `VORTEX_PROVISION_USE_MAINTENANCE_MODE=1`<br/>Enable maintenance mode right after the site is bootstrappable and disable it at the end. Useful when you want to prevent users from accessing the site while it is being provisioned.<br/><br/>
7. `VORTEX_PROVISION_SANITIZE_DB_SKIP=1`<br/>Disable database sanitization.

:::tip

Expand Down
4 changes: 0 additions & 4 deletions .vortex/docs/static/img/diagram-provision-dark.svg

This file was deleted.

4 changes: 0 additions & 4 deletions .vortex/docs/static/img/diagram-provision-light.svg

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ VORTEX_PROVISION_TYPE=database
# Set this to 1 in .env.local to override when developing locally.
VORTEX_PROVISION_OVERRIDE_DB=0

# Fallback to profile installation if the database dump is not available.
#
# When enabled and the provision type is set to "database", the site will be
# installed from the profile if the database dump file or container image
# is not available.
VORTEX_PROVISION_FALLBACK_TO_PROFILE=0

# Skip database sanitization.
#
# Database sanitization is enabled by default in all non-production
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -142,13 +142,8 @@
@@ -149,13 +149,8 @@
VORTEX_DB_FILE=db.sql

# Database download source.
Expand All @@ -13,7 +13,7 @@
# Environment to download the database from.
#
# Applies to hosting environments.
@@ -199,17 +194,3 @@
@@ -206,17 +201,3 @@
# with optional names in the format "email|name".
# Example: "to1@example.com|Jane Doe, to2@example.com|John Doe"
VORTEX_NOTIFY_EMAIL_RECIPIENTS="webmaster@star-wars.com|Webmaster"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -142,12 +142,11 @@
@@ -149,12 +149,11 @@
VORTEX_DB_FILE=db.sql

# Database download source.
Expand All @@ -15,7 +15,7 @@

# Environment to download the database from.
#
@@ -199,17 +198,3 @@
@@ -206,17 +205,3 @@
# with optional names in the format "email|name".
# Example: "to1@example.com|Jane Doe, to2@example.com|John Doe"
VORTEX_NOTIFY_EMAIL_RECIPIENTS="webmaster@star-wars.com|Webmaster"
Expand Down
Loading