sqs-pipeline-lambdas-node-intermediator
445
This image is the base for nodejs code in data-pipelines. This is the repository for intermediator-lambdas in nodejs
The basic setup consists of a index.js and a Dockerfile
docker pull julianbei/data-pipeline-lambdas-intermediator
create two files:
'use strict';
const Promise = require('bluebird');
const config = {
RECEIVE_TOPIC : process.env.RECEIVE_TOPIC,
DESTINATION_TOPIC : process.env.DESTINATION_TOPIC,
QUEUE_URL : process.env.SQS_URL,
AWS_ACCESS_KEY : process.env.AWS_ACCESS_KEY,
AWS_ACCESS_SECRET : process.env.AWS_ACCESS_SECRET,
AWS_REGION : process.env.AWS_REGION
};
module.exports.config = config;
const processor = function(message){
return new Promise((resolve, reject) => {
// Processing logic goes here for example add fields to message objects:
message.active = true;
// after processing just resolve the final object
resolve(message);
});
};
module.exports.processor = processor;
FROM julianbei/data-pipeline-lambdas-intermediator
RUN mkdir -p /app/lambda
# Copy the main application.
COPY . ./app/lambda
WORKDIR /app
If you need own dependencies, just create a package.json and install it with your Dockerfile
FROM julianbei/data-pipeline-lambdas-intermediator
RUN mkdir -p /app/lambda
COPY ./package.json /app/package.json
WORKDIR /app
RUN npm install
# Copy the main application.
COPY . ./app/lambda/
If the js module.exports.config in your index.js is not specified, the config gets automatically loaded from your environment.
intermediator-lambda:
build: intermediator-lambda/.
command: forever -m 5 /app/index.js
environment:
- RECEIVE_TOPIC=
- DESTINATION_TOPIC=
- SQS_URL=
- AWS_ACCESS_KEY=
- AWS_ACCESS_SECRET=
- AWS_REGION=
You can optionally reload the app an each change in your app folder. This might be an option for development:
volumes:
- ./intermediator-lambda:/app/lambda/
Content type
Image
Digest
Size
39.2 MB
Last updated
over 10 years ago
docker pull hitfox/sqs-pipeline-lambdas-node-intermediator