Skip to content

Commit 13b48ba

Browse files
committed
updates for devcontainer execution
1 parent b7724b7 commit 13b48ba

File tree

9 files changed

+1503
-57
lines changed

9 files changed

+1503
-57
lines changed

.archetect-history

Lines changed: 0 additions & 3 deletions
This file was deleted.

.devcontainer/devcontainer.json

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,35 @@
11
{
2-
"name": "Stack",
3-
"image": "ghcr.io/scaffoldly/aws-localstack:3.1.0-node20",
4-
"features": {
5-
"ghcr.io/scaffoldly/devcontainer-features/aws-serverless-express:1": {}
2+
"name": "github-sls-rest-api",
3+
"image": "ghcr.io/scaffoldly/aws-localstack:3.1.0-node16",
4+
"features": {
5+
"ghcr.io/devcontainers/features/terraform:1": {},
6+
"ghcr.io/scaffoldly/devcontainer-features/aws-serverless-express:1": {}
7+
},
8+
"remoteUser": "root",
9+
"hostRequirements": {
10+
"cpus": 4
11+
},
12+
"appPort": [3000, 4566],
13+
"forwardPorts": [3000, 4566],
14+
"portsAttributes": {
15+
"3000": {
16+
"label": "serverless-offline"
617
},
7-
"remoteUser": "root",
8-
"hostRequirements": {
9-
"cpus": 4
10-
},
11-
"appPort": [
12-
3000,
13-
4566
14-
],
15-
"forwardPorts": [
16-
3000,
17-
4566
18-
],
19-
"portsAttributes": {
20-
"3000": {
21-
"label": "serverless-offline",
22-
"onAutoForward": "openPreview"
23-
},
24-
"4566": {
25-
"label": "localstack"
26-
}
27-
},
28-
"otherPortsAttributes": {
29-
"onAutoForward": "ignore"
30-
},
31-
"waitFor": "onCreateCommand",
32-
"onCreateCommand": "",
33-
"updateContentCommand": "",
34-
"postCreateCommand": "",
35-
"postAttachCommand": ""
18+
"4566": {
19+
"label": "localstack"
20+
}
21+
},
22+
"otherPortsAttributes": {
23+
"onAutoForward": "ignore"
24+
},
25+
"waitFor": "onCreateCommand",
26+
"onCreateCommand": "yarn",
27+
"updateContentCommand": "",
28+
"postCreateCommand": "",
29+
"postAttachCommand": "yarn start",
30+
"containerEnv": {
31+
"TF_HTTP_USERNAME": "${localEnv:GITHUB_REPOSITORY}",
32+
"TF_HTTP_PASSWORD": "${localEnv:GITHUB_TOKEN}",
33+
"STAGE": "${localEnv:CODESPACE_NAME}"
34+
}
3635
}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ yarn-error.log
66
.build/
77
.DS_Store
88

9+
# Terraform files
10+
.terraform
11+
.terraform.*
12+
913
# Autogenerated files
1014
src/env.ts
1115
src/models/interfaces

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"editor.formatOnSave": true,
33
"editor.codeActionsOnSave": {
4-
"source.fixAll.eslint": true
4+
"source.fixAll.eslint": "explicit"
55
},
66
"filewatcher.commands": [
77
{

examples/basic/main.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
terraform {
2+
backend "http" {
3+
address = "http://localhost:3000/github/v1"
4+
lock_address = "http://localhost:3000/github/v1/lock"
5+
unlock_address = "http://localhost:3000/github/v1/lock"
6+
lock_method = "PUT"
7+
unlock_method = "DELETE"
8+
}
9+
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"openapi": "openapi-generator -g axios -i .scaffoldly/$NODE_ENV -o src/services/openapi -r auth-sls-rest-api",
1616
"types": "ts-node types.ts",
1717
"tsoa": "node tsoa.js",
18-
"dynamodb": "serverless dynamodb install",
1918
"lint": "eslint '*/**/*.{js,ts,tsx}' --quiet --fix && yarn run prettier --write '*/**/*.{js,ts,tsx}'"
2019
},
2120
"devDependencies": {
@@ -45,6 +44,7 @@
4544
"serverless-dynamodb-local": "^0.2.40",
4645
"serverless-offline": "^8.1.0",
4746
"serverless-offline-dynamodb-streams": "^5.0.0",
47+
"serverless-offline-resources": "^1.0.6",
4848
"serverless-plugin-resource-tagging": "^1.1.1",
4949
"ts-node": "^10.4.0",
5050
"typescript": "^4.4.4"
@@ -63,4 +63,4 @@
6363
"tsoa": "^3.8.0",
6464
"ulid": "^2.3.0"
6565
}
66-
}
66+
}

scripts/prepare.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ yarn dotenv
77
yarn openapi
88

99
yarn types
10-
yarn dynamodb
1110

1211
yarn tsoa
1312
yarn build

serverless.yml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ disabledDeprecations:
99
plugins:
1010
- serverless-bundle
1111
- serverless-dotenv-plugin
12-
- serverless-dynamodb-local
1312
- serverless-plugin-resource-tagging
13+
- serverless-offline-resources
1414
- serverless-offline
1515

1616
provider:
@@ -30,7 +30,7 @@ provider:
3030
STAGE_DOMAIN: ${file(serverless.config.js):stageDomain}
3131
SERVICE_NAME: ${file(serverless.config.js):serviceName}
3232
SERVICE_SLUG: ${file(serverless.config.js):serviceSlug}
33-
STAGE: ${opt:stage, "local"}
33+
STAGE: ${env:CODESPACE_NAME, "local"}
3434
stackTags:
3535
ServiceName: ${self:service}
3636
ServiceSlug: ${file(serverless.config.js):serviceSlug}
@@ -133,6 +133,7 @@ resources:
133133

134134
custom:
135135
serverless-offline:
136+
stage: ${env:CODESPACE_NAME, "local"}
136137
useChildProcesses: false
137138
noPrependStageInUrl: true
138139
prefix: ${file(serverless.config.js):serviceSlug}
@@ -144,13 +145,3 @@ custom:
144145
copyFiles:
145146
- from: 'public/*'
146147
to: './'
147-
148-
dynamodb:
149-
stages:
150-
- local
151-
start:
152-
port: 8100
153-
dbPath: .dynamodb
154-
migrate: true
155-
serverless-offline-dynamodb-streams:
156-
endpoint: http://0.0.0.0:8100

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy