Skip to content

Commit 73db6f6

Browse files
committed
Merge branch 'CF_for_DLE_3.2_with_configurator' into 'master'
CF stack for DLE v3.2 with web configurator See merge request postgres-ai/database-lab!580
2 parents 84ec493 + a06d2f2 commit 73db6f6

File tree

2 files changed

+13
-117
lines changed

2 files changed

+13
-117
lines changed

cloudformation/DLE3-AWS_MP.xlsx

207 KB
Binary file not shown.

cloudformation/dle_cf_template.yaml

Lines changed: 13 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,15 @@ Metadata:
2222
- CertificateSubdomain
2323
- CertificateHostedZone
2424
- CertificateEmail
25-
-
26-
Label:
27-
default: "Database Lab Engine (DLE) configuration"
28-
Parameters:
29-
- DLERetrievalRefreshTimetable
30-
- PostgresDumpParallelJobs
31-
- DLEVerificationToken
32-
- DLEDebugMode
3325
-
3426
Label:
3527
default: "Source PostgreSQL parameters"
3628
Parameters:
3729
- SourceDatabaseSize
38-
- SourcePostgresHost
39-
- SourcePostgresPort
40-
- SourcePostgresUsername
41-
- SourcePostgresPassword
42-
- SourcePostgresDBName
43-
- PostgresConfigSharedPreloadLibraries
44-
- SourcePostgresDBList
4530
-
4631
Label:
4732
default: "Advanced DLE configuration"
4833
Parameters:
49-
- PostgresDockerImage
5034
- DLEZFSDataSetsNumber
5135
ParameterLabels:
5236
KeyName:
@@ -63,36 +47,14 @@ Metadata:
6347
default: "Hosted zone"
6448
CertificateEmail:
6549
default: "Certificate email"
66-
DLEDebugMode:
67-
default: "DLE debug mode"
6850
DLEVerificationToken:
6951
default: "DLE verification token"
70-
DLERetrievalRefreshTimetable:
71-
default: "DLE retrieval refresh timetable"
72-
PostgresDockerImage:
73-
default: "Postgres docker image"
7452
DLEZFSDataSetsNumber:
7553
default: "Number of supported snapshots."
76-
PostgresDumpParallelJobs:
77-
default: "Number of pg_dump jobs"
78-
SourcePostgresDBName:
79-
default: "Database name"
8054
VPC:
8155
default: "VPC security group"
8256
Subnet:
8357
default: "Subnet"
84-
SourcePostgresHost:
85-
default: "Host name or IP"
86-
SourcePostgresPort:
87-
default: "Port"
88-
SourcePostgresUsername:
89-
default: "User name"
90-
SourcePostgresPassword:
91-
default: "Password"
92-
PostgresConfigSharedPreloadLibraries:
93-
default: "shared_preload_libraries parameter"
94-
SourcePostgresDBList:
95-
default: "Comma separated list of databases to copy"
9658
Parameters:
9759
Subnet:
9860
Description: Subnet to attach EC2 machine.
@@ -150,68 +112,18 @@ Parameters:
150112
AllowedPattern: '^$|[^\s@]+@[^\s@]+\.[^\s@]+'
151113
Default: ''
152114
ConstraintDescription: Must be a valid email of the form \'user@example.com\'
153-
DLEDebugMode:
154-
Description: Enables DLE debug mode
155-
Type: String
156-
Default: True
157-
AllowedValues:
158-
- True
159-
- False
160115
DLEVerificationToken:
161116
Description: DLE verification token
162117
Type: String
163118
Default: "example-verification-token"
164119
MinLength: '9'
165120
MaxLength: '32'
166-
DLERetrievalRefreshTimetable:
167-
Description: DLE refresh schedule on cron format
168-
Type: String
169-
Default: '0 0 * * *'
170121
DLEZFSDataSetsNumber:
171122
Description: Number of database copies needed
172123
Type: Number
173124
Default: 2
174125
MinValue: 2
175126
MaxValue: 100
176-
PostgresDockerImage:
177-
Description: Docker image to run PostgreSQL
178-
Type: String
179-
Default: 'postgresai/extended-postgres:14'
180-
SourcePostgresDBName:
181-
Description: Source database name. This parameter is used to connect to the database
182-
Type: String
183-
Default: 'postgres'
184-
SourcePostgresHost:
185-
Description: Source Postgres cluster host name or IP
186-
Type: String
187-
Default: ''
188-
SourcePostgresPort:
189-
Description: Source Postgres cluster port
190-
Type: Number
191-
MinValue: 1024
192-
MaxValue: 65535
193-
Default: 5432
194-
SourcePostgresUsername:
195-
Description: Source Postgres cluster username
196-
Type: String
197-
Default: postgres
198-
SourcePostgresPassword:
199-
Description: Source Postgres cluster password
200-
Type: String
201-
Default: ''
202-
NoEcho: true
203-
PostgresConfigSharedPreloadLibraries:
204-
Description: Source Postgres shared_preload_libraries value
205-
Type: String
206-
Default: ''
207-
PostgresDumpParallelJobs:
208-
Description: Number of jobs to run pg_dump against the source database
209-
Type: String
210-
Default: '1'
211-
SourcePostgresDBList:
212-
Description: List of database names on source for copy to DLE. Leave it empty to copy all accessible databases
213-
Type: String
214-
Default: ''
215127
Mappings:
216128
AWSInstanceType2Arch:
217129
r5.large:
@@ -404,41 +316,20 @@ Resources:
404316
dle_config_path="/home/ubuntu/.dblab/engine/configs"
405317
dle_meta_path="/home/ubuntu/.dblab/engine/meta"
406318
postgres_conf_path="/home/ubuntu/.dblab/postgres_conf"
407-
408-
# Create a special marker file to identify that the DLE is running as a "managed" instance
409-
# (e.g., launched using Marketplace or Terraform), and has not yet been configured.
410-
touch $dle_meta_path/pending.retrieval
319+
dle_logs_path="home/ubuntu/.dblab/engine/logs"
411320

412321
yq e -i '
413-
.global.debug=${DLEDebugMode} |
414322
.embeddedUI.host="" |
323+
.embeddedUI.dockerImage="registry.gitlab.com/postgres-ai/database-lab/ce-ui:$DLE_DOCKER_IMAGE_VERSION" |
415324
.server.verificationToken="${DLEVerificationToken}" |
416-
.retrieval.refresh.timetable="${DLERetrievalRefreshTimetable}" |
417-
.retrieval.spec.logicalRestore.options.forceInit=true |
418325
.poolManager.mountDir = "/var/lib/dblab/dblab_pool" |
419326
.retrieval.spec.logicalDump.options.dumpLocation="/var/lib/dblab/dblab_pool/dataset_1/dump/" |
420-
.retrieval.spec.logicalRestore.options.dumpLocation="/var/lib/dblab/dblab_pool/dataset_1/dump/" |
421-
.databaseContainer.dockerImage="${PostgresDockerImage}" |
422-
.databaseConfigs.configs.shared_preload_libraries="${PostgresConfigSharedPreloadLibraries}"
327+
.retrieval.spec.logicalRestore.options.forceInit=true |
328+
.retrieval.spec.logicalRestore.options.dumpLocation="/var/lib/dblab/dblab_pool/dataset_1/dump/"
423329
' $dle_config_path/server.yml
424330
425-
yq e -i '
426-
.retrieval.spec.logicalDump.options.source.connection.host = "${SourcePostgresHost}" |
427-
.retrieval.spec.logicalDump.options.source.connection.port = ${SourcePostgresPort} |
428-
.retrieval.spec.logicalDump.options.source.connection.dbname="${SourcePostgresDBName}" |
429-
.retrieval.spec.logicalDump.options.source.connection.username = "${SourcePostgresUsername}" |
430-
.retrieval.spec.logicalDump.options.source.connection.password = "${SourcePostgresPassword}" |
431-
.retrieval.spec.logicalDump.options.parallelJobs = ${PostgresDumpParallelJobs} |
432-
.retrieval.spec.logicalRestore.options.configs.shared_preload_libraries = "${PostgresConfigSharedPreloadLibraries}"
433-
' $dle_config_path/server.yml
434-
435-
for i in $(echo ${SourcePostgresDBList} | sed "s/,/ /g")
436-
do
437-
yq e -i "
438-
.retrieval.spec.logicalDump.options.databases.$i = {}
439-
" $dle_config_path/server.yml
440-
done
441331
332+
touch $dle_meta_path/pending.retrieval
442333
443334
sudo docker run \
444335
--detach \
@@ -449,9 +340,14 @@ Resources:
449340
--volume /var/run/docker.sock:/var/run/docker.sock \
450341
--volume /var/lib/dblab:/var/lib/dblab/:rshared \
451342
--volume /var/lib/dblab/dblab_pool/dataset_1/dump/:/var/lib/dblab/dblab_pool/dataset_1/dump/:rshared \
452-
--volume $dle_config_path:/home/dblab/configs:ro \
343+
--volume $dle_config_path:/home/dblab/configs \
453344
--volume $dle_meta_path:/home/dblab/meta \
345+
--volume $dle_logs_path:/home/dblab/logs \
454346
--volume $postgres_conf_path:/home/dblab/standard/postgres/control \
347+
--volume /sys/kernel/debug:/sys/kernel/debug:rw \
348+
--volume /lib/modules:/lib/modules:ro \
349+
--volume /proc:/host_proc:ro \
350+
--env DLE_COMPUTING_INFRASTRUCTURE=AWS \
455351
--env DOCKER_API_VERSION=1.39 \
456352
--restart always \
457353
registry.gitlab.com/postgres-ai/database-lab/dblab-server:$DLE_DOCKER_IMAGE_VERSION
@@ -478,7 +374,7 @@ Resources:
478374
sudo systemctl enable envoy
479375
sudo systemctl start envoy
480376
fi
481-
377+
482378
# upgrade ssm agent version
483379
wget https://s3.us-east-1.amazonaws.com/amazon-ssm-us-east-1/amazon-ssm-agent/3.1.1575.0/amazon-ssm-agent-ubuntu-amd64.tar.gz
484380
tar -xf amazon-ssm-agent-ubuntu-amd64.tar.gz
@@ -490,7 +386,7 @@ Resources:
490386
--url=http://localhost:2345 \
491387
--token=${DLEVerificationToken} \
492388
--insecure'
493-
389+
494390
while ! echo "UI started" | nc localhost 2346; do sleep 10; done
495391
/opt/aws/bin/cfn-signal -e $? -d "DLE UI is available" -r "DLE Deploy Process Complete" '${WaitHandle}'
496392

0 commit comments

Comments
 (0)