Skip to content

Commit 6b8dd10

Browse files
committed
changes made
Signed-off-by: rabelmervin <[email protected]>
1 parent 6bd87bd commit 6b8dd10

File tree

1 file changed

+7
-20
lines changed

1 file changed

+7
-20
lines changed

Diff for: internal/command/default.provisioners.yaml

+7-20
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,10 @@
217217
- password
218218

219219

220-
- uri: template://default-provisioners/postgres
221-
# By default, match all redis types regardless of class and id. If you want to override this, create another
222-
# provisioner definition with a higher priority.
220+
- uri: template://default-provisioners/postgres-instance
221+
223222
type: postgres-instance
224-
description: Provisions a dedicated database on a shared postgres instance
223+
description: Provisions a dedicated Postgres instance
225224
# Init template has the random service name and password if needed later
226225
init: |
227226
randomServiceName: pg-{{ randAlphaNum 6 }}
@@ -232,23 +231,15 @@
232231
publishPort: {{ dig "annotations" "compose.score.dev/publish-port" "0" .Metadata | quote }}
233232
# The state for each database resource is a unique db name and credentials
234233
state: |
235-
database: {{ dig "database" .Init.randomDatabase .State | quote }}
236-
username: {{ dig "username" .Init.randomUsername .State | quote }}
234+
database: "postgres"
235+
username: "postgres"
237236
password: {{ dig "password" .Init.randomPassword .State | quote }}
238237
# The outputs are the core database outputs. We output both name and database for broader compatibility.
239238
outputs: |
240239
host: {{ dig .Init.sk "instanceServiceName" "" .Shared }}
241240
port: 5432
242-
username: {{ .State.username }}
243-
password: {{ .State.password }}
244-
# Write out an idempotent create script per database
245-
files: |
246-
{{ dig .Init.sk "instanceServiceName" "" .Shared }}-db-scripts/{{ .State.database }}.sql: |
247-
SELECT 'CREATE DATABASE "{{ .State.database }}"' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '{{ .State.database }}')\gexec
248-
SELECT $$CREATE USER "{{ .State.username }}" WITH PASSWORD '{{ .State.password }}'$$ WHERE NOT EXISTS (SELECT FROM pg_roles WHERE rolname = '{{ .State.username }}')\gexec
249-
GRANT ALL PRIVILEGES ON DATABASE "{{ .State.database }}" TO "{{ .State.username }}";
250-
\connect "{{ .State.database }}";
251-
GRANT ALL ON SCHEMA public TO "{{ .State.username }}";
241+
username: postgres
242+
password: {{ dig .Init.sk "instancePassword" "" .Shared }}
252243
# Ensure the data volume exists
253244
volumes: |
254245
{{ dig .Init.sk "instanceServiceName" "" .Shared }}-data:
@@ -272,10 +263,6 @@
272263
target: /var/lib/postgresql/data
273264
healthcheck:
274265
test: ["CMD", "pg_isready", "-U", "postgres"]
275-
interval: 2s
276-
timeout: 2s
277-
retries: 15
278-
{{ dig .Init.sk "instanceServiceName" "" .Shared }}-init:
279266
image: mirror.gcr.io/postgres:17-alpine
280267
entrypoint: ["/bin/sh"]
281268
environment:

0 commit comments

Comments
 (0)