Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/embed domain #50

Merged
merged 2 commits into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/deploy-code-embed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
EMBED_STYLE_URL: ${{ secrets.EMBED_STYLE_URL }}
EMBED_JS_URL: ${{ secrets.EMBED_JS_URL }}
WEB_APP_URL: ${{ secrets.WEB_APP_URL }}
ENV: ${{ secrets.ENV }}
SENTRY_DSN: ${{ secrets.CODE_EMBED_SENTRY_DSN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
Expand Down
2 changes: 2 additions & 0 deletions apps/functions/code-embed/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ DATABASE_URL="mysql:https://root:@127.0.0.1:3311/sharingan"
EMBED_STYLE_URL=https://cdn.jsdelivr.net/npm/sharingan-embed@latest/style.min.css
EMBED_JS_URL=https://cdn.jsdelivr.net/npm/sharingan-embed@latest/script.min.js
WEB_APP_URL=http:https://localhost:7500
ENV=development
SENTRY_DSN=
2 changes: 2 additions & 0 deletions apps/functions/code-embed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
"@types/node": "^17.0.45",
"esbuild": "^0.15.5",
"serverless": "^3.22.0",
"serverless-certificate-creator": "^1.6.0",
"serverless-domain-manager": "^6.1.0",
"serverless-esbuild": "^1.32.8",
"serverless-offline": "^9.2.6",
"ts-node": "^10.4.0",
Expand Down
34 changes: 31 additions & 3 deletions apps/functions/code-embed/serverless.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,32 @@ import type { AWS } from '@serverless/typescript';
import renderer from '@/functions/renderer';

const serverlessConfiguration: AWS = {
configValidationMode: 'error',
custom: {
customCertificate: {
certificateName: '${self:custom.domains.${self:provider.stage}.certificateName}',
hostedZoneNames: 'sharingan.dev.',
region: '${self:provider.region}',
},
customDomain: {
apiType: 'rest',
autoDomain: false,
basePath: '',
certificateName: '${self:custom.domains.${self:provider.stage}.certificateName}',
createRoute53Record: false,
domainName: '${self:custom.domains.${self:provider.stage}.domainName}',
endpointType: 'edge',
},
domains: {
dev: {
certificateName: 'embedstaging.sharingan.dev',
domainName: 'embedstaging.sharingan.dev',
},
prod: {
certificateName: 'embed.sharingan.dev',
domainName: 'embed.sharingan.dev',
},
},
esbuild: {
bundle: true,
concurrency: 10,
Expand All @@ -29,7 +54,7 @@ const serverlessConfiguration: AWS = {
individually: true,
patterns: ['./src/**'],
},
plugins: ['serverless-esbuild', 'serverless-offline'],
plugins: ['serverless-esbuild', 'serverless-offline', 'serverless-domain-manager', 'serverless-certificate-creator'],
provider: {
apiGateway: {
minimumCompressionSize: 1024,
Expand All @@ -40,12 +65,15 @@ const serverlessConfiguration: AWS = {
DATABASE_URL: '${env:DATABASE_URL}',
EMBED_JS_URL: '${env:EMBED_JS_URL}',
EMBED_STYLE_URL: '${env:EMBED_STYLE_URL}',
NODE_OPTIONS: '--enable-source-maps --stack-trace-limit=1000',
ENV: '${env:ENV}',
NODE_OPTIONS: '--stack-trace-limit=1000',
SENTRY_DSN: '${env:SENTRY_DSN}',
WEB_APP_URL: '${env:WEB_APP_URL}',
},
name: 'aws',
region: 'eu-west-2',
region: 'eu-west-1',
runtime: 'nodejs16.x',
stage: "${opt:stage, 'dev'}",
},
service: 'code-embed',
useDotenv: true,
Expand Down
Loading