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
10 changes: 10 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,16 @@ VORTEX_DB_DOWNLOAD_FTP_PORT=21
VORTEX_DB_DOWNLOAD_FTP_FILE=db.sql
#;> DB_DOWNLOAD_SOURCE_FTP

#;< DB_DOWNLOAD_SOURCE_S3
# Database dump file sourced from S3.

# AWS S3 bucket name for database download.
VORTEX_DB_DOWNLOAD_S3_BUCKET=

# AWS S3 region.
VORTEX_DB_DOWNLOAD_S3_REGION=ap-southeast-2
#;> DB_DOWNLOAD_SOURCE_S3

# Environment to download the database from.
#
# Applies to hosting environments.
Expand Down
13 changes: 11 additions & 2 deletions .env.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,21 @@ VORTEX_ACQUIA_SECRET=
# VORTEX_DB_DOWNLOAD_SSH_FILE=
#;> DB_DOWNLOAD_SOURCE_LAGOON

#;< DB_DOWNLOAD_SOURCE_S3
# Database dump file sourced from S3.

# AWS access key for S3 database download.
VORTEX_DB_DOWNLOAD_S3_ACCESS_KEY=
# AWS secret key for S3 database download.
VORTEX_DB_DOWNLOAD_S3_SECRET_KEY=
#;> DB_DOWNLOAD_SOURCE_S3

#;< DB_DOWNLOAD_SOURCE_CONTAINER_REGISTRY
# Database image sourced from a container registry.

# The username to log into the container registry.
VORTEX_CONTAINER_REGISTRY_USER=$DOCKER_USER
VORTEX_CONTAINER_REGISTRY_USER=
# The password (token) to log into the container registry.
VORTEX_CONTAINER_REGISTRY_PASS=$DOCKER_PASS
VORTEX_CONTAINER_REGISTRY_PASS=
Comment on lines 75 to +78
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix dotenv-linter key order to avoid CI warnings.
Reorder the container registry variables to satisfy the UnorderedKey rule.

♻️ Suggested reorder
-# The username to log into the container registry.
-VORTEX_CONTAINER_REGISTRY_USER=
-# The password (token) to log into the container registry.
-VORTEX_CONTAINER_REGISTRY_PASS=
+# The password (token) to log into the container registry.
+VORTEX_CONTAINER_REGISTRY_PASS=
+# The username to log into the container registry.
+VORTEX_CONTAINER_REGISTRY_USER=
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# The username to log into the container registry.
VORTEX_CONTAINER_REGISTRY_USER=$DOCKER_USER
VORTEX_CONTAINER_REGISTRY_USER=
# The password (token) to log into the container registry.
VORTEX_CONTAINER_REGISTRY_PASS=$DOCKER_PASS
VORTEX_CONTAINER_REGISTRY_PASS=
# The password (token) to log into the container registry.
VORTEX_CONTAINER_REGISTRY_PASS=
# The username to log into the container registry.
VORTEX_CONTAINER_REGISTRY_USER=
🧰 Tools
🪛 dotenv-linter (4.0.0)

[warning] 78-78: [UnorderedKey] The VORTEX_CONTAINER_REGISTRY_PASS key should go before the VORTEX_CONTAINER_REGISTRY_USER key

(UnorderedKey)

🤖 Prompt for AI Agents
In @.env.local.example around lines 75 - 78, The environment keys are out of
alphabetical order and trigger the dotenv-linter UnorderedKey rule; swap the two
variables so VORTEX_CONTAINER_REGISTRY_PASS appears before
VORTEX_CONTAINER_REGISTRY_USER (i.e., reorder the two lines in the .env
example), ensuring the key order is alphabetical and CI warnings go away.

#;> DB_DOWNLOAD_SOURCE_CONTAINER_REGISTRY
#;> !PROVISION_TYPE_PROFILE
550 changes: 281 additions & 269 deletions .vortex/docs/content/development/variables.mdx

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class DatabaseDownloadSource extends AbstractHandler {

const CONTAINER_REGISTRY = 'container_registry';

const S3 = 's3';

const NONE = 'none';

/**
Expand All @@ -45,6 +47,7 @@ public function options(array $responses): ?array {
self::ACQUIA => 'Acquia backup',
self::LAGOON => 'Lagoon environment',
self::CONTAINER_REGISTRY => 'Container registry',
self::S3 => 'S3 bucket',
self::NONE => 'None',
];

Expand Down Expand Up @@ -105,6 +108,7 @@ public function process(): void {
DatabaseDownloadSource::ACQUIA,
DatabaseDownloadSource::LAGOON,
DatabaseDownloadSource::CONTAINER_REGISTRY,
DatabaseDownloadSource::S3,
];

foreach ($types as $type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
+# Database image sourced from a container registry.
+
+# The username to log into the container registry.
+VORTEX_CONTAINER_REGISTRY_USER=$DOCKER_USER
+VORTEX_CONTAINER_REGISTRY_USER=
+# The password (token) to log into the container registry.
+VORTEX_CONTAINER_REGISTRY_PASS=$DOCKER_PASS
+VORTEX_CONTAINER_REGISTRY_PASS=
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
+# Database image sourced from a container registry.
+
+# The username to log into the container registry.
+VORTEX_CONTAINER_REGISTRY_USER=$DOCKER_USER
+VORTEX_CONTAINER_REGISTRY_USER=
+# The password (token) to log into the container registry.
+VORTEX_CONTAINER_REGISTRY_PASS=$DOCKER_PASS
+VORTEX_CONTAINER_REGISTRY_PASS=
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
@@ -142,13 +142,16 @@
VORTEX_DB_FILE=db.sql

# Database download source.
-VORTEX_DB_DOWNLOAD_SOURCE=url
+VORTEX_DB_DOWNLOAD_SOURCE=s3

-# Database dump file sourced from a URL.
-#
-# HTTP Basic Authentication credentials should be embedded into the value.
-VORTEX_DB_DOWNLOAD_URL=
+# Database dump file sourced from S3.

+# AWS S3 bucket name for database download.
+VORTEX_DB_DOWNLOAD_S3_BUCKET=
+
+# AWS S3 region.
+VORTEX_DB_DOWNLOAD_S3_REGION=ap-southeast-2
+
# Environment to download the database from.
#
# Applies to hosting environments.
@@ -199,17 +202,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"
-
-################################################################################
-# DEMO #
-################################################################################
-# #
-# Override project-specific values for demonstration purposes. #
-# Used to showcase Vortex without asking users to perform additional steps. #
-# #
-# Remove this section after completing database download integration. #
-# #
-################################################################################
-
-# URL of the database used for demonstration with URL database download type.
-VORTEX_DB_DOWNLOAD_URL=https://github.com/drevops/vortex/releases/download/__VERSION__/db_d11.demo.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@@ -32,3 +32,10 @@

# Always override existing downloaded DB dump.
VORTEX_DB_DOWNLOAD_FORCE=1
+
+# Database dump file sourced from S3.
+
+# AWS access key for S3 database download.
+VORTEX_DB_DOWNLOAD_S3_ACCESS_KEY=
+# AWS secret key for S3 database download.
+VORTEX_DB_DOWNLOAD_S3_SECRET_KEY=
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@@ -32,3 +32,10 @@

# Always override existing downloaded DB dump.
VORTEX_DB_DOWNLOAD_FORCE=1
+
+# Database dump file sourced from S3.
+
+# AWS access key for S3 database download.
+VORTEX_DB_DOWNLOAD_S3_ACCESS_KEY=
+# AWS secret key for S3 database download.
+VORTEX_DB_DOWNLOAD_S3_SECRET_KEY=
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public static function dataProviderHandlerProcess(): array {
Env::put(PromptManager::makeEnvName(AiCodeInstructions::id()), AiCodeInstructions::CLAUDE);
}),
],

'db download source, s3' => [
static::cw(fn() => Env::put(PromptManager::makeEnvName(DatabaseDownloadSource::id()), DatabaseDownloadSource::S3)),
],
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ function (AbstractHandlerDiscoveryTestCase $test): void {
},
],

'database download source - discovery - s3' => [
[],
[DatabaseDownloadSource::id() => DatabaseDownloadSource::S3] + $expected_defaults,
function (AbstractHandlerDiscoveryTestCase $test): void {
$test->stubDotenvValue('VORTEX_DB_DOWNLOAD_SOURCE', DatabaseDownloadSource::S3);
},
],

'database download source - discovery - invalid' => [
[],
$expected_defaults,
Expand Down
Loading