Skip to content

Commit f88b404

Browse files
authored
[#699] Added support for downloading DB from S3. (#2256)
1 parent 78811df commit f88b404

18 files changed

Lines changed: 1489 additions & 275 deletions

File tree

.env

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,16 @@ VORTEX_DB_DOWNLOAD_FTP_PORT=21
202202
VORTEX_DB_DOWNLOAD_FTP_FILE=db.sql
203203
#;> DB_DOWNLOAD_SOURCE_FTP
204204

205+
#;< DB_DOWNLOAD_SOURCE_S3
206+
# Database dump file sourced from S3.
207+
208+
# AWS S3 bucket name for database download.
209+
VORTEX_DB_DOWNLOAD_S3_BUCKET=
210+
211+
# AWS S3 region.
212+
VORTEX_DB_DOWNLOAD_S3_REGION=ap-southeast-2
213+
#;> DB_DOWNLOAD_SOURCE_S3
214+
205215
# Environment to download the database from.
206216
#
207217
# Applies to hosting environments.

.env.local.example

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,21 @@ VORTEX_ACQUIA_SECRET=
6060
# VORTEX_DB_DOWNLOAD_SSH_FILE=
6161
#;> DB_DOWNLOAD_SOURCE_LAGOON
6262

63+
#;< DB_DOWNLOAD_SOURCE_S3
64+
# Database dump file sourced from S3.
65+
66+
# AWS access key for S3 database download.
67+
VORTEX_DB_DOWNLOAD_S3_ACCESS_KEY=
68+
# AWS secret key for S3 database download.
69+
VORTEX_DB_DOWNLOAD_S3_SECRET_KEY=
70+
#;> DB_DOWNLOAD_SOURCE_S3
71+
6372
#;< DB_DOWNLOAD_SOURCE_CONTAINER_REGISTRY
6473
# Database image sourced from a container registry.
6574

6675
# The username to log into the container registry.
67-
VORTEX_CONTAINER_REGISTRY_USER=$DOCKER_USER
76+
VORTEX_CONTAINER_REGISTRY_USER=
6877
# The password (token) to log into the container registry.
69-
VORTEX_CONTAINER_REGISTRY_PASS=$DOCKER_PASS
78+
VORTEX_CONTAINER_REGISTRY_PASS=
7079
#;> DB_DOWNLOAD_SOURCE_CONTAINER_REGISTRY
7180
#;> !PROVISION_TYPE_PROFILE

.vortex/docs/content/development/variables.mdx

Lines changed: 281 additions & 269 deletions
Large diffs are not rendered by default.

.vortex/installer/src/Prompts/Handlers/DatabaseDownloadSource.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class DatabaseDownloadSource extends AbstractHandler {
1919

2020
const CONTAINER_REGISTRY = 'container_registry';
2121

22+
const S3 = 's3';
23+
2224
const NONE = 'none';
2325

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

@@ -105,6 +108,7 @@ public function process(): void {
105108
DatabaseDownloadSource::ACQUIA,
106109
DatabaseDownloadSource::LAGOON,
107110
DatabaseDownloadSource::CONTAINER_REGISTRY,
111+
DatabaseDownloadSource::S3,
108112
];
109113

110114
foreach ($types as $type) {

.vortex/installer/tests/Fixtures/handler_process/db_download_source_container_registry/.env.local

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
+# Database image sourced from a container registry.
77
+
88
+# The username to log into the container registry.
9-
+VORTEX_CONTAINER_REGISTRY_USER=$DOCKER_USER
9+
+VORTEX_CONTAINER_REGISTRY_USER=
1010
+# The password (token) to log into the container registry.
11-
+VORTEX_CONTAINER_REGISTRY_PASS=$DOCKER_PASS
11+
+VORTEX_CONTAINER_REGISTRY_PASS=

.vortex/installer/tests/Fixtures/handler_process/db_download_source_container_registry/.env.local.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
+# Database image sourced from a container registry.
77
+
88
+# The username to log into the container registry.
9-
+VORTEX_CONTAINER_REGISTRY_USER=$DOCKER_USER
9+
+VORTEX_CONTAINER_REGISTRY_USER=
1010
+# The password (token) to log into the container registry.
11-
+VORTEX_CONTAINER_REGISTRY_PASS=$DOCKER_PASS
11+
+VORTEX_CONTAINER_REGISTRY_PASS=
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
@@ -142,13 +142,16 @@
2+
VORTEX_DB_FILE=db.sql
3+
4+
# Database download source.
5+
-VORTEX_DB_DOWNLOAD_SOURCE=url
6+
+VORTEX_DB_DOWNLOAD_SOURCE=s3
7+
8+
-# Database dump file sourced from a URL.
9+
-#
10+
-# HTTP Basic Authentication credentials should be embedded into the value.
11+
-VORTEX_DB_DOWNLOAD_URL=
12+
+# Database dump file sourced from S3.
13+
14+
+# AWS S3 bucket name for database download.
15+
+VORTEX_DB_DOWNLOAD_S3_BUCKET=
16+
+
17+
+# AWS S3 region.
18+
+VORTEX_DB_DOWNLOAD_S3_REGION=ap-southeast-2
19+
+
20+
# Environment to download the database from.
21+
#
22+
# Applies to hosting environments.
23+
@@ -199,17 +202,3 @@
24+
# with optional names in the format "email|name".
25+
# Example: "to1@example.com|Jane Doe, to2@example.com|John Doe"
26+
VORTEX_NOTIFY_EMAIL_RECIPIENTS="webmaster@star-wars.com|Webmaster"
27+
-
28+
-################################################################################
29+
-# DEMO #
30+
-################################################################################
31+
-# #
32+
-# Override project-specific values for demonstration purposes. #
33+
-# Used to showcase Vortex without asking users to perform additional steps. #
34+
-# #
35+
-# Remove this section after completing database download integration. #
36+
-# #
37+
-################################################################################
38+
-
39+
-# URL of the database used for demonstration with URL database download type.
40+
-VORTEX_DB_DOWNLOAD_URL=https://github.com/drevops/vortex/releases/download/__VERSION__/db_d11.demo.sql
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@@ -32,3 +32,10 @@
2+
3+
# Always override existing downloaded DB dump.
4+
VORTEX_DB_DOWNLOAD_FORCE=1
5+
+
6+
+# Database dump file sourced from S3.
7+
+
8+
+# AWS access key for S3 database download.
9+
+VORTEX_DB_DOWNLOAD_S3_ACCESS_KEY=
10+
+# AWS secret key for S3 database download.
11+
+VORTEX_DB_DOWNLOAD_S3_SECRET_KEY=
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@@ -32,3 +32,10 @@
2+
3+
# Always override existing downloaded DB dump.
4+
VORTEX_DB_DOWNLOAD_FORCE=1
5+
+
6+
+# Database dump file sourced from S3.
7+
+
8+
+# AWS access key for S3 database download.
9+
+VORTEX_DB_DOWNLOAD_S3_ACCESS_KEY=
10+
+# AWS secret key for S3 database download.
11+
+VORTEX_DB_DOWNLOAD_S3_SECRET_KEY=

.vortex/installer/tests/Functional/Handlers/DatabaseDownloadSourceHandlerProcessTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ public static function dataProviderHandlerProcess(): array {
4040
Env::put(PromptManager::makeEnvName(AiCodeInstructions::id()), AiCodeInstructions::CLAUDE);
4141
}),
4242
],
43+
44+
'db download source, s3' => [
45+
static::cw(fn() => Env::put(PromptManager::makeEnvName(DatabaseDownloadSource::id()), DatabaseDownloadSource::S3)),
46+
],
4347
];
4448
}
4549

0 commit comments

Comments
 (0)