Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Commit

Permalink
nodejs-express: new kafka template (#698)
Browse files Browse the repository at this point in the history
Fixes: #692
Related: #695
  • Loading branch information
sam-github authored Apr 30, 2020
1 parent fc2f472 commit fc67941
Show file tree
Hide file tree
Showing 14 changed files with 1,469 additions and 34 deletions.
6 changes: 6 additions & 0 deletions incubator/nodejs-express/image/project/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Install the app dependencies in a full Node docker image
FROM node:12

# librdkafka builds against libssl-dev
RUN apt-get update && apt-get install -y libssl-dev && apt-get clean

# Copying individual files/folders as buildah 1.9.0 does not honour .dockerignore
COPY package*.json /project/
COPY *.js /project/
Expand All @@ -22,6 +25,9 @@ RUN cd / && tar czf project.tgz project
# Copy the dependencies into a slim Node docker image
FROM node:12-slim

# librdkafka links against libssl
RUN apt-get update && apt-get install -y libssl1.1 && apt-get clean

# Copy project with dependencies
COPY --chown=node:node --from=0 /project.tgz /
RUN tar xf project.tgz && chown -R node:node /project && rm project.tgz
Expand Down
95 changes: 62 additions & 33 deletions incubator/nodejs-express/image/project/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions incubator/nodejs-express/image/project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@cloudnative/health-connect": "^2.0.0",
"express": "^4.17.1",
"express-pino-logger": "^4.0.0",
"node-rdkafka": "^2.7.4",
"pino": "^5.14.0",
"prom-client": "^12.0.0"
},
Expand Down
1 change: 1 addition & 0 deletions incubator/nodejs-express/image/project/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const userApp = require(basePath + getEntryPoint());
app.use('/', userApp({
server: server,
app: app,
log: pino,
}));

app.get('*', (req, res) => {
Expand Down
2 changes: 1 addition & 1 deletion incubator/nodejs-express/stack.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Node.js Express
version: 0.4.7
version: 0.4.8
description: Express web framework for Node.js
license: Apache-2.0
language: nodejs
Expand Down
88 changes: 88 additions & 0 deletions incubator/nodejs-express/templates/kafka/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/
14 changes: 14 additions & 0 deletions incubator/nodejs-express/templates/kafka/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Appsody: Attach node debugger",
"type": "node",
"request": "attach",
"port": 9229,
"remoteRoot": "/project/user-app",
"localRoot": "${workspaceFolder}",
"protocol": "inspector"
}
]
}
47 changes: 47 additions & 0 deletions incubator/nodejs-express/templates/kafka/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Appsody: run",
"type": "shell",
"command": "appsody run",
"group": "build",
"problemMatcher": []
},
{
"label": "Appsody: debug",
"type": "shell",
"command": "appsody debug",
"group": "build",
"problemMatcher": []
},
{
"label": "Appsody: test",
"type": "shell",
"command": "appsody test",
"group": "test",
"problemMatcher": []
},
{
"label": "Appsody: build",
"type": "shell",
"command": "appsody build",
"group": "build",
"problemMatcher": []
},
{
"label": "Appsody: deploy",
"type": "shell",
"command": "appsody deploy",
"group": "build",
"problemMatcher": []
},
{
"label": "Appsody: stop",
"type": "shell",
"command": "appsody stop",
"group": "build",
"problemMatcher": []
}
]
}
Loading

0 comments on commit fc67941

Please sign in to comment.