From 04d11a79aef9a76a2656817bcfc1f69a7874d696 Mon Sep 17 00:00:00 2001 From: Daniel Karnutsch Date: Mon, 23 Sep 2024 16:27:29 +0200 Subject: [PATCH 1/4] Add DigitalOcean Deployment --- .digitalocean/comet-starter-cms.yaml | 294 ++++++++++++++++++ .digitalocean/comet-starter-imgproxy.yaml | 50 +++ .digitalocean/comet-starter-site.yaml | 74 +++++ .../create-app/cleanupWorkingDirectory.ts | 2 +- 4 files changed, 419 insertions(+), 1 deletion(-) create mode 100644 .digitalocean/comet-starter-cms.yaml create mode 100644 .digitalocean/comet-starter-imgproxy.yaml create mode 100644 .digitalocean/comet-starter-site.yaml diff --git a/.digitalocean/comet-starter-cms.yaml b/.digitalocean/comet-starter-cms.yaml new file mode 100644 index 000000000..c09c8e905 --- /dev/null +++ b/.digitalocean/comet-starter-cms.yaml @@ -0,0 +1,294 @@ +alerts: + - rule: DEPLOYMENT_FAILED + - rule: DOMAIN_FAILED +features: + - buildpack-stack=ubuntu-22 +ingress: + rules: + - component: + name: admin + match: + path: + prefix: /admin-do-not-use + - component: + name: oauth2-proxy + match: + path: + prefix: / + - component: + name: api + match: + path: + prefix: /public-api +name: comet-starter-cms +region: fra +services: + - build_command: |- + cp ../site-configs.d.ts src/site-configs.d.ts && + npm run build && + npm prune --omit=dev + environment_slug: node-js + envs: + - key: NODE_ENV + scope: RUN_TIME + value: production + - key: POSTGRESQL_HOST + scope: RUN_AND_BUILD_TIME + value: db-postgresql-fra1-74967-do-user-15310175-0.l.db.ondigitalocean.com + - key: POSTGRESQL_PORT + scope: RUN_AND_BUILD_TIME + value: "25060" + - key: POSTGRESQL_DB + scope: RUN_AND_BUILD_TIME + value: db_starter + - key: POSTGRESQL_PASSWORD + scope: RUN_AND_BUILD_TIME + type: SECRET + value: EV[1:VJWKcWvicy4ClCPNzpPOSwiZB0p8/gZq:SZK9hwGdXBqcCEApIdFWuSLWS//rvY/VEfyJ2WWwM/agjP+BLUOiew==] + - key: POSTGRESQL_USER + scope: RUN_AND_BUILD_TIME + value: starter + - key: API_URL + scope: RUN_AND_BUILD_TIME + value: https://comet-starter-cms-64wfr.ondigitalocean.app/public-api/api + - key: API_PORT + scope: RUN_AND_BUILD_TIME + value: "4000" + - key: CORS_ALLOWED_ORIGIN + scope: RUN_AND_BUILD_TIME + value: comet-starter-site-tyqqf\.ondigitalocean\.app + - key: IMGPROXY_SALT + scope: RUN_AND_BUILD_TIME + type: SECRET + value: EV[1:DpbiOlcKj5C5taV+27VGP0Wc2GFFu0Cu:I8RNxsSOqaGk12doCtjeIT9hUNWTM6rAr7kMX6X+JlE4VyYH5kd1XFZ9SozGmADqFKEkI//BIJQ00XAq6dkXr6amsH7AtVJSxkl4WjBBs24sW/jnSIjebEYDq4n9oQbptdhrQcNwTYaAy/VZm1KzgzxdXaQHDsLmbtYWXLKUue/VldiCajnRExZjiTdk/x8Y] + - key: IMGPROXY_URL + scope: RUN_AND_BUILD_TIME + value: https://comet-starter-imgproxy-ovgzu.ondigitalocean.app + - key: IMGPROXY_KEY + scope: RUN_AND_BUILD_TIME + type: SECRET + value: EV[1:wD77N9Aop33RXd8qv/pUCyIyItqY877u:DeExUMZXlI96dabfE09kuc/Kj54FZmVrjuTb2VMLajK1B+fxuNIHecelUdFX1wo1lrYm+jRFBotC8nWh4uhEYfC4KVS6QdjeKIXAxhuZ7cGI848/VAzkWKoEgYoSUYTXNTbpETptNFWQ1XFzJxDKZiYFaW8LmknvxUixuaxULsobxjFhH/S+fTlHt6j9DN9K] + - key: DAM_SECRET + scope: RUN_AND_BUILD_TIME + type: SECRET + value: EV[1:cN8JQAPIBnJqXpO8RGBqx9tvzArnSMFz:tQ2EW+BE5XWg2rPUvXqCjbXKNxIYLRGLdsAKk+CVhaDRWhc=] + - key: BLOB_STORAGE_DRIVER + scope: RUN_AND_BUILD_TIME + value: s3 + - key: BLOB_STORAGE_DIRECTORY_PREFIX + scope: RUN_AND_BUILD_TIME + value: starter + - key: S3_REGION + scope: RUN_AND_BUILD_TIME + value: fra1 + - key: S3_ENDPOINT + scope: RUN_AND_BUILD_TIME + value: https://fra1.digitaloceanspaces.com + - key: S3_BUCKET + scope: RUN_AND_BUILD_TIME + value: comet-starter + - key: S3_ACCESS_KEY_ID + scope: RUN_AND_BUILD_TIME + type: SECRET + value: EV[1:MoPtts0J/3qbPVcLpNbJDQncPsvQBWmG:sseL7FpcEps7IV5v/uqBctUwp+tSMBAzJl3XkZjMCLZ69PUt] + - key: S3_SECRET_ACCESS_KEY + scope: RUN_AND_BUILD_TIME + type: SECRET + value: EV[1:GNjlve0WqXUtZr2TVaxvI9UTcv6a0Mta:zK4fpoWTpwDHO6MfYEWLoOsw3Kq3W3N9FvGAIuHRc1I6FF6zeZOULOIxzOXgLJPb6xIIiUKB8dAOu7Y=] + - key: POSTGRESQL_CA_CERT + scope: RUN_AND_BUILD_TIME + value: |- + -----BEGIN CERTIFICATE----- + MIIEQTCCAqmgAwIBAgIUFbJ/dvvfKgsSSRZ1WB3LZ5OiEWQwDQYJKoZIhvcNAQEM + BQAwOjE4MDYGA1UEAwwvYjNjZTRjMWYtZWUyOS00MDQ4LWE2ZmItZTFlNDU0MTIy + MTk1IFByb2plY3QgQ0EwHhcNMjMxMjA0MTQ1NDIxWhcNMzMxMjAxMTQ1NDIxWjA6 + MTgwNgYDVQQDDC9iM2NlNGMxZi1lZTI5LTQwNDgtYTZmYi1lMWU0NTQxMjIxOTUg + UHJvamVjdCBDQTCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAKRtK5Ud + nFGKdoyjGssagR9vMRQw73tpuNeZG4OmewPwKdgDhsjH+ZLfgJOI2wSoclBkWFQj + dIg0GuXkFVwO4SZ0a/7uBtJLYh9z8U4N14pOa+xrBISE7zshGjJjKjHhbCT7VYhc + l6OK2CZZzXZk+xoh5o1JwLxkc1l2rzG5l3CrZnL43L93h6KEGY4VWe8QBoxqUCxG + 2aDuyYpqjlHJhS4imRxbJ9R++t3UBPVpaebU4jwWw91DujYD86LMmq9WEVNfnrno + 8SNNYRS6ojay/WUphKTfK3VqwUw7OGAIHxAzQPc6nx8mdNa++Y51J6IOL4O7bBp5 + gxb46TVlHeH0GXZEu+m2AUnPT8tmPgzHzDAI7UQ2NN2kTxrUGZ2aV/f1lxIhij6o + sfwoSJZzt98dvp02Cg9zqgXxxyv04YUeK7PDoS9aP7uXrj81dLl84MIdbqJOZNd1 + XwfIhu0hKlAi2H5PuPBwn++aJ9Htjhbte4Bp2QJF6hcqfW0chpZPupQOmwIDAQAB + oz8wPTAdBgNVHQ4EFgQUZm7RuycpRchnPp3PzsK3vPORT4AwDwYDVR0TBAgwBgEB + /wIBADALBgNVHQ8EBAMCAQYwDQYJKoZIhvcNAQEMBQADggGBABmGDsdgEKDGS4wU + v+170Nl3JFDySE3DwcYEUFQCm9/gLW6dpHV5S5Vghiq3oTtmUAB/atXYjS6FlFTx + lWkyW4j9m9YbbzW+SX5rPiO01Hu3sUae0s2kjRWpFnoZWirphCS4JZ24wLtWBkyl + 1pthVhUg4qh4zOfeWvVmd8MENkieFf0mhWyY2gvbcvPgYRrsVoNDzm72vvRnhjtG + 81+MMudCLUKtYg+oNIbBwzu2JZ2tdr6lrxTCwlnepyPAQfxF3oC7FbxfMirf/Rp+ + eibIi9DYfjschlTe0BW1afYn1cradTsH0uFrSV6UCYjhN7aYCLYBJoL+c/raEA0u + avwdD47sHsIhse+1HjF2VRVPDP+ZGTvqkAuiLAXEi4eht0rluX/j/Rnc+peq21al + bamtaNx6H7l4QlXegUXaxxAmeW2FR5nBUb2tiFBF70KA+rl4hRa7FuxcPmkNOtRO + EokFG4nQ9lh/mN5vpkdxCA438Ur3yBqzaSI1NvGpb8/8gBG0Gg== + -----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" + } + ] + - key: POSTGRESQL_USE_SSL + scope: RUN_AND_BUILD_TIME + value: "true" + - key: USE_AUTHPROXY + scope: RUN_AND_BUILD_TIME + value: "true" + - key: BASIC_AUTH_SYSTEM_USER_PASSWORD + scope: RUN_AND_BUILD_TIME + type: SECRET + value: EV[1:RRBCV3yOi07TjXxGcad36RGJAJ2DnHbw:mmzqyMwl9gtfoiNigjj/0GrZTduEp6LtgJKV/5a3geMwKSk=] + - key: IDP_CLIENT_ID + scope: RUN_AND_BUILD_TIME + value: 59e44de5-0431-4413-b50b-7e52740a6d7b + - key: IDP_JWKS_URI + scope: RUN_AND_BUILD_TIME + value: https://auth-sso.vivid-planet.cloud/.well-known/jwks.json + - key: IDP_END_SESSION_ENDPOINT + scope: RUN_AND_BUILD_TIME + value: https://auth-sso.vivid-planet.cloud/oauth2/sessions/logout + - key: POST_LOGOUT_REDIRECT_URI + scope: RUN_AND_BUILD_TIME + value: https://comet-starter-cms-64wfr.ondigitalocean.app/oauth2/sign_out?rd=%2F + github: + branch: main + deploy_on_push: false + repo: vivid-planet/comet-starter + http_port: 4000 + instance_count: 1 + instance_size_slug: apps-s-1vcpu-0.5gb + name: api + run_command: npm run db:migrate:prod && npm run start:prod + source_dir: /api + - envs: + - key: OAUTH2_PROXY_API_ROUTES + scope: RUN_AND_BUILD_TIME + value: /api + - key: OAUTH2_PROXY_CODE_CHALLENGE_METHOD + scope: RUN_AND_BUILD_TIME + value: S256 + - key: OAUTH2_PROXY_PASS_AUTHORIZATION_HEADER + scope: RUN_AND_BUILD_TIME + value: "true" + - key: OAUTH2_PROXY_PASS_ACCESS_TOKEN + scope: RUN_AND_BUILD_TIME + value: "true" + - key: OAUTH2_PROXY_COOKIE_SECURE + scope: RUN_AND_BUILD_TIME + value: "true" + - key: OAUTH2_PROXY_COOKIE_SAMESITE + scope: RUN_AND_BUILD_TIME + value: lax + - key: OAUTH2_PROXY_COOKIE_HTTPONLY + scope: RUN_AND_BUILD_TIME + value: "true" + - key: OAUTH2_PROXY_SKIP_PROVIDER_BUTTON + scope: RUN_AND_BUILD_TIME + value: "true" + - key: OAUTH2_PROXY_SILENCE_PING_LOGGING_true + scope: RUN_AND_BUILD_TIME + value: "true" + - key: OAUTH2_PROXY_REQUEST_LOGGING + scope: RUN_AND_BUILD_TIME + value: "false" + - key: OAUTH2_PROXY_AUTH_LOGGING + scope: RUN_AND_BUILD_TIME + value: "true" + - key: OAUTH2_PROXY_COOKIE_REFRESH + scope: RUN_AND_BUILD_TIME + value: 23h + - key: OAUTH2_PROXY_EMAIL_DOMAINS + scope: RUN_AND_BUILD_TIME + value: "*" + - key: OAUTH2_PROXY_CLIENT_SECRET + scope: RUN_AND_BUILD_TIME + type: SECRET + value: EV[1:uQi0YzdSCPn4w2obTTkdFOiUmYC0onNR:NEwKBNspvye4T0NkL6QpCP5PiTduvpyfnF/JjvKbX8Aec0s=] + - key: OAUTH2_PROXY_CLIENT_ID + scope: RUN_AND_BUILD_TIME + value: 59e44de5-0431-4413-b50b-7e52740a6d7b + - key: OAUTH2_PROXY_COOKIE_SECRET + scope: RUN_AND_BUILD_TIME + type: SECRET + value: EV[1:nG0XBGrISwLqRYdFFELwYeszfQ0vMCjC:XBISzF+YWffV1LA25rTvp4v6iLhjVL4a3VGkd2v7Iiw=] + - key: OAUTH2_PROXY_PROVIDER + scope: RUN_AND_BUILD_TIME + value: oidc + - key: OAUTH2_PROXY_OIDC_ISSUER_URL + scope: RUN_AND_BUILD_TIME + value: https://auth-sso.vivid-planet.cloud + - key: OAUTH2_PROXY_UPSTREAMS + scope: RUN_AND_BUILD_TIME + value: http://admin:80,http://api:80/api/ + - key: OAUTH2_PROXY_WHITELIST_DOMAIN + scope: RUN_AND_BUILD_TIME + value: auth-sso.vivid-planet.cloud + - key: OAUTH2_PROXY_SCOPE + scope: RUN_AND_BUILD_TIME + value: openid profile email offline_access + - key: OAUTH2_PROXY_HTTP_ADDRESS + scope: RUN_AND_BUILD_TIME + value: 0.0.0.0:4180 + - key: OAUTH2_PROXY_SKIP_AUTH_PREFLIGHT + scope: RUN_AND_BUILD_TIME + value: "true" + http_port: 4180 + image: + registry: dkarnutsch + registry_type: DOCKER_HUB + repository: oauth2-proxy + tag: latest + instance_count: 1 + instance_size_slug: apps-s-1vcpu-0.5gb + name: oauth2-proxy + - build_command: |- + ./intl-update.sh && + cp ../api/schema.gql schema.gql && + cp ../api/block-meta.json block-meta.json && + cp ../api/src/comet-config.json src/comet-config.json && + cp ../site-configs.d.ts src/site-configs.d.ts && + npm run build && + rm -rf ./node_modules + environment_slug: node-js + envs: + - key: NODE_ENV + scope: RUN_TIME + value: production + - key: API_URL + scope: RUN_AND_BUILD_TIME + value: https://comet-starter-cms-64wfr.ondigitalocean.app/api + - key: ADMIN_URL + scope: RUN_AND_BUILD_TIME + 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"}]' + - key: PREVIEW_URL + scope: RUN_AND_BUILD_TIME + value: https://comet-starter-site-preview-jespg.ondigitalocean.app + github: + branch: main + deploy_on_push: false + repo: vivid-planet/comet-starter + http_port: 3000 + instance_count: 1 + instance_size_slug: apps-s-1vcpu-0.5gb + name: admin + run_command: npm run serve + source_dir: admin diff --git a/.digitalocean/comet-starter-imgproxy.yaml b/.digitalocean/comet-starter-imgproxy.yaml new file mode 100644 index 000000000..b57e36f82 --- /dev/null +++ b/.digitalocean/comet-starter-imgproxy.yaml @@ -0,0 +1,50 @@ +alerts: + - rule: DEPLOYMENT_FAILED + - rule: DOMAIN_FAILED +features: + - buildpack-stack=ubuntu-22 +ingress: + rules: + - component: + name: darthsim-imgproxy + match: + path: + prefix: / +name: comet-starter-imgproxy +region: fra +services: + - envs: + - key: IMGPROXY_KEY + scope: RUN_AND_BUILD_TIME + type: SECRET + value: EV[1:caLHr/u1NkMWvW8NG5nn0+JvpBW+NMNu:yhmQi6RpvAt58666wyk3IzIMFg7ALTeIhruXpPFabcQgSkmAaBXzj08oAYuhv6u0tnWabUIHDkvzyY0CnoYpHD3vE1R5tWLUQwOoEgzGKHqiO7f5zdeuTzFUxG7ctCFfsXedzL2e4R7+u3FmLox0woPk0DhbiYiA8+qSNnVEKWMXJTkAkfQkwdtovgskqdz5] + - key: IMGPROXY_SALT + scope: RUN_AND_BUILD_TIME + type: SECRET + value: EV[1:yCE1f0mZPV+uFFs96/SmFsbvWXH3pfDn:1dt+Waq2vALvR7qXaC3Lh2VONtDjgmBzSuPyn+6kpk3DN9xzmbSPhV3G1pCZ+NRA16TOL3jhfiIgWD4QbCAs5y2JM2EOcptDQKpuQ6YYGvB9Gb2dBgrJS7WG5pKqSIuI3g+YKKa/ns5HWzH/CdIsieVdvmlb4PFasdhdCIMOHCIhwNONChz0yIO7XsV8vLJl] + - key: IMGPROXY_USE_S3 + scope: RUN_AND_BUILD_TIME + value: "true" + - key: IMGPROXY_S3_REGION + scope: RUN_AND_BUILD_TIME + value: fra1 + - key: IMGPROXY_S3_ENDPOINT + scope: RUN_AND_BUILD_TIME + value: https://comet-starter.fra1.digitaloceanspaces.com + - key: AWS_ACCESS_KEY_ID + scope: RUN_AND_BUILD_TIME + type: SECRET + value: EV[1:utFAK7Ej0e07tb6cQhWCCLlRUSKJy6DU:rGoIItdercf5JSs2oSEanA11liimnDjdLxwmhcBjO9UCeHaM] + - key: AWS_SECRET_ACCESS_KEY + scope: RUN_AND_BUILD_TIME + type: SECRET + value: EV[1:xupjwXwlpZv8VeQyLx9nKJTrw1BipI3a:Lkws9OWy+b5a20BNHCHiFv8H2M99aYNirhY+eGBZsCoUkLvCYoJvKDaVpHLz7N+CCC3Hfgycd4Ix008=] + http_port: 8080 + image: + registry: darthsim + registry_type: DOCKER_HUB + repository: imgproxy + tag: v3 + instance_count: 1 + instance_size_slug: apps-s-1vcpu-0.5gb + name: darthsim-imgproxy diff --git a/.digitalocean/comet-starter-site.yaml b/.digitalocean/comet-starter-site.yaml new file mode 100644 index 000000000..dbca90cac --- /dev/null +++ b/.digitalocean/comet-starter-site.yaml @@ -0,0 +1,74 @@ +alerts: + - rule: DEPLOYMENT_FAILED + - rule: DOMAIN_FAILED +features: + - buildpack-stack=ubuntu-22 +ingress: + rules: + - component: + name: comet-starter-site + match: + path: + prefix: / +name: comet-starter-site +region: fra +services: + - build_command: |- + ./intl-update.sh && + cp ../api/schema.gql schema.gql && + cp ../api/block-meta.json block-meta.json && + cp ../api/src/comet-config.json src/comet-config.json && + cp ../site-configs.d.ts src/site-configs.d.ts && + npm run build && + npm prune --omit=dev + environment_slug: node-js + envs: + - key: NODE_ENV + scope: RUN_TIME + value: production + - key: ADMIN_URL + scope: RUN_AND_BUILD_TIME + value: https://comet-starter-cms-64wfr.ondigitalocean.app/ + - key: NEXT_PUBLIC_API_URL + scope: RUN_AND_BUILD_TIME + value: https://comet-starter-cms-64wfr.ondigitalocean.app/public-api/api + - key: API_URL_INTERNAL + scope: RUN_AND_BUILD_TIME + value: https://comet-starter-cms-64wfr.ondigitalocean.app/public-api/api + - key: SITE_PREVIEW_SECRET + scope: RUN_AND_BUILD_TIME + type: SECRET + 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" + } + ] + - key: API_BASIC_AUTH_SYSTEM_USER_PASSWORD + scope: RUN_AND_BUILD_TIME + type: SECRET + value: EV[1:qkU44a+IP3BfIT4YvfGdrOj505b+mdu2:aD7wKJCkMvTng/HGtOjuXg2QjP2KGUn8FHghsVmZpptr4JA=] + github: + branch: main + deploy_on_push: false + repo: vivid-planet/comet-starter + http_port: 3000 + instance_count: 1 + instance_size_slug: apps-s-1vcpu-0.5gb + name: comet-starter-site + run_command: npm run serve + source_dir: site diff --git a/create-app/src/scripts/create-app/cleanupWorkingDirectory.ts b/create-app/src/scripts/create-app/cleanupWorkingDirectory.ts index 0afbd05e9..61f83be8f 100644 --- a/create-app/src/scripts/create-app/cleanupWorkingDirectory.ts +++ b/create-app/src/scripts/create-app/cleanupWorkingDirectory.ts @@ -2,7 +2,7 @@ import { deleteFilesAndFolders } from "../../util/deleteFilesAndFolders"; import { removeReferenceInFile } from "../../util/removeReferenceInFile"; export function cleanupWorkingDirectory(verbose: boolean) { - deleteFilesAndFolders(["create-app", ".git", ".github", "LICENSE"], verbose); + deleteFilesAndFolders(["create-app", ".git", ".github", "LICENSE", ".digitalocean"], verbose); removeReferenceInFile("lint-staged.config.js", /.*create-app.*\n/gim, verbose); removeReferenceInFile(".vscode/settings.json", /, "create-app"/g, verbose); removeReferenceInFile("install.sh", /^.*create-app.*$/gm, verbose); From 8c43afc1103fd6351433050b690594d105e8e436 Mon Sep 17 00:00:00 2001 From: Daniel Karnutsch Date: Thu, 3 Oct 2024 12:37:38 +0200 Subject: [PATCH 2/4] 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 | 11 +++++++++ 4 files changed, 20 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..492221c41 --- /dev/null +++ b/.digitalocean/deploy.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# TODO move me to project root and change app ids if in use + +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 From 9e7c1376ad8216039884c9999a19a16d093ea524 Mon Sep 17 00:00:00 2001 From: Daniel Karnutsch Date: Tue, 8 Oct 2024 08:09:30 +0200 Subject: [PATCH 3/4] Add imgproxy do deploy.sh --- .digitalocean/deploy.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.digitalocean/deploy.sh b/.digitalocean/deploy.sh index 492221c41..4faf6148c 100644 --- a/.digitalocean/deploy.sh +++ b/.digitalocean/deploy.sh @@ -2,10 +2,14 @@ # TODO move me to project root and change app ids if in use +doctl apps update zzzz --spec .digitalocean/comet-starter-imgproxy.yaml + 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 +doctl apps update xxxx --spec .digitalocean/comet-starter-cms.yaml # Configuration-Changes +doctl apps create-deployment xxxx # Code-Changes 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 +doctl apps update yyyy --spec .digitalocean/comet-starter-site-main.yaml # Configuration-Changes +doctl apps create-deployment yyyy # Code-Changes From c52e7777f70a7492a5b9c1f19709c37d9a96938d Mon Sep 17 00:00:00 2001 From: Daniel Karnutsch Date: Mon, 14 Oct 2024 15:15:18 +0200 Subject: [PATCH 4/4] Better placeholders for app ids --- .digitalocean/deploy.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.digitalocean/deploy.sh b/.digitalocean/deploy.sh index 4faf6148c..3584e2933 100644 --- a/.digitalocean/deploy.sh +++ b/.digitalocean/deploy.sh @@ -2,14 +2,14 @@ # TODO move me to project root and change app ids if in use -doctl apps update zzzz --spec .digitalocean/comet-starter-imgproxy.yaml +doctl apps update --spec .digitalocean/comet-starter-imgproxy.yaml 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 # Configuration-Changes -doctl apps create-deployment xxxx # Code-Changes +doctl apps update --spec .digitalocean/comet-starter-cms.yaml # configuration changes +doctl apps create-deployment xxxx # code changes 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 # Configuration-Changes -doctl apps create-deployment yyyy # Code-Changes +doctl apps update --spec .digitalocean/comet-starter-site-main.yaml # configuration changes +doctl apps create-deployment yyyy # code changes