sqs-pipeline-lambdas-node-source
425
This image is the base for nodejs code in data-pipelines. This is the repository for source-lambdas in nodejs
The basic setup consists of a index.js and a Dockerfile
docker pull julianbei/data-pipeline-lambdas-source
create two files:
the index.js must export the run function which gets called as soon as the connection to the broker is established. the first parameter of that function is the queue-reference object which exports two functions:
var config = {
AWS_ACCESS_KEY: process.env.AWS_ACCESS_KEY,
AWS_ACCESS_SECRET: process.env.AWS_ACCESS_SECRET,
AWS_REGION: process.env.AWS_REGION,
DESTINATION_TOPIC: process.env.DESTINATION_TOPIC
};
module.exports.config = config;
var message = 'no application provided';
var messages = [
'no',
'application',
'provided'
];
var run = function(queue){
queue.send(message);
queue.sendMore(messages);
}
module.exports.run = run;
FROM julianbei/data-pipeline-lambdas-source
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-source
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.
source-lambda:
build: source-lambda/.
command: forever -m 5 /app/index.js
environment:
- AWS_ACCESS_KEY=
- AWS_ACCESS_SECRET=
- AWS_REGION=
- DESTINATION_TOPIC=
You can optionally reload the app an each change in your app folder. This might be an option for development:
volumes:
- ./source-lambda:/app/lambda/
Content type
Image
Digest
Size
37.6 MB
Last updated
over 10 years ago
docker pull hitfox/sqs-pipeline-lambdas-node-source