Skip to content

Commit 3cb1b64

Browse files
committed
fix quotes, format commands
1 parent ff30d1e commit 3cb1b64

File tree

1 file changed

+29
-40
lines changed

1 file changed

+29
-40
lines changed

dle-logical-init.sh.tpl

Lines changed: 29 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,6 @@ curl https://gitlab.com/postgres-ai/database-lab/-/raw/${dle_version}/configs/st
114114
curl https://gitlab.com/postgres-ai/database-lab/-/raw/${dle_version}/configs/standard/postgres/control/postgresql.conf --output $postgres_conf_path/postgresql.conf
115115
cat /tmp/postgresql_clones_custom.conf >> $postgres_conf_path/postgresql.conf
116116

117-
# TODO: move to Packer instructions.
118-
wget https://github.com/mikefarah/yq/releases/download/v4.14.1/yq_linux_amd64 -O /usr/bin/yq &&\
119-
chmod +x /usr/bin/yq
120-
121117
yq e -i '
122118
.global.debug=${dle_debug_mode} |
123119
.server.verificationToken="${dle_verification_token}" |
@@ -140,23 +136,23 @@ case "${source_type}" in
140136
# Mount directory to store dump files.
141137
extra_mount="--volume /var/lib/dblab/dblab_pool_00/dump:/var/lib/dblab/dblab_pool/dump"
142138

143-
yq e -i '
144-
.retrieval.spec.logicalDump.options.source.connection.host = ${source_postgres_host}" |
145-
.retrieval.spec.logicalDump.options.source.connection.port = ${source_postgres_port}" |
146-
.retrieval.spec.logicalDump.options.source.connection.username = ${source_postgres_username}" |
147-
.retrieval.spec.logicalDump.options.source.connection.password = ${source_postgres_password}" |
148-
.retrieval.spec.logicalDump.options.parallelJobs = 1"
149-
' $dle_config_path/server.yml
139+
yq e -i '
140+
.retrieval.spec.logicalDump.options.source.connection.host = ${source_postgres_host}" |
141+
.retrieval.spec.logicalDump.options.source.connection.port = ${source_postgres_port}" |
142+
.retrieval.spec.logicalDump.options.source.connection.username = ${source_postgres_username}" |
143+
.retrieval.spec.logicalDump.options.source.connection.password = ${source_postgres_password}" |
144+
.retrieval.spec.logicalDump.options.parallelJobs = 1"
145+
' $dle_config_path/server.yml
150146

151147
# restore pg_dump via pipe - without saving it on the disk
152148
yq e -i '
153-
.databaseContainer.dockerImage="postgresai/extended-postgres:${source_postgres_version}" |
154-
.retrieval.spec.logicalDump.options.immediateRestore.enabled=true |
155-
.retrieval.spec.logicalDump.options.immediateRestore.forceInit=true |
156-
.retrieval.spec.logicalDump.options.immediateRestore.configs alias = .databaseConfig |
157-
del(.retrieval.jobs[] | select(. == "logicalRestore")) |
158-
.databaseConfig.configs.shared_preload_libraries = ${postgres_config_shared_preload_libraries}
159-
' $dle_config_path/server.yml
149+
.databaseContainer.dockerImage="postgresai/extended-postgres:${source_postgres_version}" |
150+
.retrieval.spec.logicalDump.options.immediateRestore.enabled=true |
151+
.retrieval.spec.logicalDump.options.immediateRestore.forceInit=true |
152+
.retrieval.spec.logicalDump.options.immediateRestore.configs alias = .databaseConfig |
153+
del(.retrieval.jobs[] | select(. == "logicalRestore")) |
154+
.databaseConfig.configs.shared_preload_libraries = ${postgres_config_shared_preload_libraries}
155+
' $dle_config_path/server.yml
160156
;;
161157

162158
s3)
@@ -167,15 +163,15 @@ yq e -i '
167163
extra_mount="--volume ${source_pgdump_s3_mount_point}:${source_pgdump_s3_mount_point}"
168164

169165
yq e -i '
170-
del(.retrieval.jobs[] | select(. == "logicalDump")) |
171-
.retrieval.spec.logicalRestore.options.dumpLocation="${source_pgdump_s3_mount_point}/${source_pgdump_path_on_s3_bucket}"
172-
' $dle_config_path/server.yml
166+
del(.retrieval.jobs[] | select(. == "logicalDump")) |
167+
.retrieval.spec.logicalRestore.options.dumpLocation="${source_pgdump_s3_mount_point}/${source_pgdump_path_on_s3_bucket}"
168+
' $dle_config_path/server.yml
173169

174170
nProcessors = $(getconf _NPROCESSORS_ONLN)
175171
yq e -i '
176-
.retrieval.spec.logicalDump.options.parallelJobs=${postgres_dump_parallel_jobs} |
177-
.retrieval.spec.logicalRestore.options.parallelJobs=$nProcessors
178-
' $dle_config_path/server.yml
172+
.retrieval.spec.logicalDump.options.parallelJobs=${postgres_dump_parallel_jobs} |
173+
.retrieval.spec.logicalRestore.options.parallelJobs=$nProcessors
174+
' $dle_config_path/server.yml
179175
;;
180176

181177
esac
@@ -221,12 +217,12 @@ curl https://gitlab.com/postgres-ai/joe/-/raw/${joe_version}/configs/config.exam
221217

222218
yq e -i '
223219
.app.debug = ${dle_debug_mode} |
224-
.platform.token = ${platform_access_token} |
225-
.channelMapping.dblabServers.prod1.token = ${dle_verification_token} |
220+
.platform.token = "${platform_access_token}" |
221+
.channelMapping.dblabServers.prod1.token = "${dle_verification_token}" |
226222
.channelMapping.dblabServers.url.token = "http://localhost:2345" |
227-
.channelMapping.communicationTypes.webui[0].credentials.signingSecret = ${platform_joe_signing_secret} |
228-
.channelMapping.communicationTypes.webui[0].channels[0].project = ${platform_project_name} |
229-
.channelMapping.communicationTypes.webui[0].channels[0].dblabParams.dbname = ${source_postgres_dbname} |
223+
.channelMapping.communicationTypes.webui[0].credentials.signingSecret = "${platform_joe_signing_secret}" |
224+
.channelMapping.communicationTypes.webui[0].channels[0].project = "${platform_project_name}" |
225+
.channelMapping.communicationTypes.webui[0].channels[0].dblabParams.dbname = "${source_postgres_dbname}" |
230226
del(.channelMapping.communicationTypes.slack) |
231227
del(.channelMapping.communicationTypes.slackrtm) |
232228
del(.channelMapping.communicationTypes.slacksm)
@@ -247,20 +243,13 @@ mkdir -p $ci_checker_config_path
247243

248244
curl https://gitlab.com/postgres-ai/database-lab/-/raw/${dle_version}/configs/config.example.ci_checker.yml --output $ci_checker_config_path/ci_checker.yml
249245

250-
sed -ri "s/^(\s*)(debug:.*$)/\1debug: ${dle_debug_mode}/" $ci_checker_config_path/ci_checker.yml
251-
sed -ri "s/^(\s*)( verificationToken: \"secret_token\".*$)/\1 verificationToken: ${vcs_db_migration_checker_verification_token}/" $ci_checker_config_path/ci_checker.yml
252-
sed -ri "s/^(\s*)( url: \"https\\:\\/\\/dblab.domain.com\"$)/\1 url: \"http\\:\\/\\/dblab_server\\:2345\"/" $ci_checker_config_path/ci_checker.yml
253-
sed -ri "s/^(\s*)( verificationToken: \"checker_secret_token\".*$)/\1 verificationToken: ${dle_verification_token}/" $ci_checker_config_path/ci_checker.yml
254-
sed -ri "s/^(\s*)( accessToken:.*$)/\1 accessToken: ${platform_access_token}/" $ci_checker_config_path/ci_checker.yml
255-
sed -ri "s/^(\s*)( token:.*$)/\1 token: ${vcs_github_secret_token}/" $ci_checker_config_path/ci_checker.yml
256-
257246
yq e -i '
258247
.app.debug = ${dle_debug_mode} |
259-
.app.verificationToken = ${vcs_db_migration_checker_verification_token} |
248+
.app.verificationToken = "${vcs_db_migration_checker_verification_token}" |
260249
.dle.url = "http://dblab_server:2345" |
261-
.dle.verificationToken = ${dle_verification_token} |
262-
.platform.accessToken = ${platform_access_token} |
263-
.source.token = ${vcs_github_secret_token}
250+
.dle.verificationToken = "${dle_verification_token}" |
251+
.platform.accessToken = "${platform_access_token}" |
252+
.source.token = "${vcs_github_secret_token}"
264253
' $ci_checker_config_path/ci_checker.yml
265254

266255
sudo docker run \

0 commit comments

Comments
 (0)