Skip to content

Commit

Permalink
Dynamically create site-config via @comet/cli
Browse files Browse the repository at this point in the history
  • Loading branch information
dkarnutsch committed Oct 7, 2024
1 parent 04d11a7 commit 288893e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 41 deletions.
2 changes: 2 additions & 0 deletions .digitalocean/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
comet-starter-cms.yaml
comet-starter-site-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: |-
Expand Down Expand Up @@ -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
Expand All @@ -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
9 changes: 9 additions & 0 deletions .digitalocean/deploy.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 288893e

Please sign in to comment.