From 288893ea1488cd4643fc3378bb586c6c6789fd46 Mon Sep 17 00:00:00 2001 From: Daniel Karnutsch Date: Thu, 3 Oct 2024 12:37:38 +0200 Subject: [PATCH] Dynamically create site-config via @comet/cli --- .digitalocean/.gitignore | 2 ++ ...er-cms.yaml => comet-starter-cms.tpl.yaml} | 24 +++---------------- ....yaml => comet-starter-site-main.tpl.yaml} | 24 ++++--------------- .digitalocean/deploy.sh | 9 +++++++ 4 files changed, 18 insertions(+), 41 deletions(-) create mode 100644 .digitalocean/.gitignore rename .digitalocean/{comet-starter-cms.yaml => comet-starter-cms.tpl.yaml} (89%) rename .digitalocean/{comet-starter-site.yaml => comet-starter-site-main.tpl.yaml} (68%) create mode 100644 .digitalocean/deploy.sh diff --git a/.digitalocean/.gitignore b/.digitalocean/.gitignore new file mode 100644 index 000000000..d83d71d1a --- /dev/null +++ b/.digitalocean/.gitignore @@ -0,0 +1,2 @@ +comet-starter-cms.yaml +comet-starter-site-main.yaml diff --git a/.digitalocean/comet-starter-cms.yaml b/.digitalocean/comet-starter-cms.tpl.yaml similarity index 89% rename from .digitalocean/comet-starter-cms.yaml rename to .digitalocean/comet-starter-cms.tpl.yaml index c09c8e905..36c069340 100644 --- a/.digitalocean/comet-starter-cms.yaml +++ b/.digitalocean/comet-starter-cms.tpl.yaml @@ -125,23 +125,7 @@ services: -----END CERTIFICATE----- - key: PRIVATE_SITE_CONFIGS scope: RUN_AND_BUILD_TIME - value: |- - [ - { - "scope": { "domain": "main", "languages": ["en", "de"] }, - "name": "Starter Main", - "domains": { "main": "comet-starter-site-tyqqf.ondigitalocean.app" }, - "preloginEnabled": true, - "url": "https://comet-starter-site-tyqqf.ondigitalocean.app" - }, - { - "scope": { "domain": "secondary", "languages": ["en", "de"] }, - "name": "Starter Secondary", - "domains": { "main": "secondary.localhost:3000" }, - "preloginEnabled": true, - "url": "http://secondary.localhost:3000" - } - ] + value: "{{ site://configs/private/dev }}" - key: POSTGRESQL_USE_SSL scope: RUN_AND_BUILD_TIME value: "true" @@ -276,12 +260,10 @@ services: value: https://comet-starter-cms-64wfr.ondigitalocean.app/ - key: PUBLIC_SITE_CONFIGS scope: RUN_AND_BUILD_TIME - value: - '[{"scope":{"domain":"main","languages":["en","de"]},"name":"Starter Main","domains":{"main":"comet-starter-site-tyqqf.ondigitalocean.app"},"preloginEnabled":true,"urls":"https://comet-starter-site-tyqqf.ondigitalocean.app"},{"scope":{"domain":"secondary","languages":["en","de"]},"name":"Starter - Secondary","domains":{"main":"secondary.localhost:3000"},"preloginEnabled":true,"url":"http://secondary.localhost:3000"}]' + value: "{{ site://configs/public/dev }}" - key: PREVIEW_URL scope: RUN_AND_BUILD_TIME - value: https://comet-starter-site-preview-jespg.ondigitalocean.app + value: https://comet-starter-site-preview-jespg.ondigitalocean.app # TODO github: branch: main deploy_on_push: false diff --git a/.digitalocean/comet-starter-site.yaml b/.digitalocean/comet-starter-site-main.tpl.yaml similarity index 68% rename from .digitalocean/comet-starter-site.yaml rename to .digitalocean/comet-starter-site-main.tpl.yaml index dbca90cac..c5abe31d2 100644 --- a/.digitalocean/comet-starter-site.yaml +++ b/.digitalocean/comet-starter-site-main.tpl.yaml @@ -6,11 +6,11 @@ features: ingress: rules: - component: - name: comet-starter-site + name: comet-starter-site-main match: path: prefix: / -name: comet-starter-site +name: comet-starter-site-main region: fra services: - build_command: |- @@ -41,23 +41,7 @@ services: value: EV[1:/Nf0VXO5XP5SJY9Y/JAFyZttB4Z1B6po:xL4pWQaF02cU4y1QCahqXdvD94A+QOJxXVVGDea4TYFVPQ==] - key: PUBLIC_SITE_CONFIGS scope: RUN_AND_BUILD_TIME - value: |- - [ - { - "scope": { "domain": "main", "languages": ["en", "de"] }, - "name": "Starter Main", - "domains": { "main": "comet-starter-site-tyqqf.ondigitalocean.app" }, - "preloginEnabled": true, - "url": "https://comet-starter-site-tyqqf.ondigitalocean.app" - }, - { - "scope": { "domain": "secondary", "languages": ["en", "de"] }, - "name": "Starter Secondary", - "domains": { "main": "secondary.localhost:3000" }, - "preloginEnabled": true, - "url": "http://secondary.localhost:3000" - } - ] + value: "{{ site://configs/public/dev }}" - key: API_BASIC_AUTH_SYSTEM_USER_PASSWORD scope: RUN_AND_BUILD_TIME type: SECRET @@ -69,6 +53,6 @@ services: http_port: 3000 instance_count: 1 instance_size_slug: apps-s-1vcpu-0.5gb - name: comet-starter-site + name: comet-starter-site-main run_command: npm run serve source_dir: site diff --git a/.digitalocean/deploy.sh b/.digitalocean/deploy.sh new file mode 100644 index 000000000..be5a350eb --- /dev/null +++ b/.digitalocean/deploy.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +sed -i '' 's/dev\.comet\-dxp\.com/comet-starter-site-tyqqf.ondigitalocean.app/g' site-configs/main.ts + +APP_ENV=dev npx -y @comet/cli inject-site-configs -i .digitalocean/comet-starter-cms.tpl.yaml -o .digitalocean/comet-starter-cms.yaml +doctl apps update xxxx --spec .digitalocean/comet-starter-cms.yaml + +APP_ENV=dev npx -y @comet/cli inject-site-configs -i .digitalocean/comet-starter-site-main.tpl.yaml -o .digitalocean/comet-starter-site-main.yaml +doctl apps update yyyy --spec .digitalocean/comet-starter-site-main.yaml \ No newline at end of file