This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
├── AssetStorage | |
├── Encoder | |
├── Packager | |
├── WorkflowAdmin | |
├── WorkflowDatabase | |
│ └── data | |
│ └── workflow-db.db | |
└── WorkflowEngine |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const jobController = require('../controllers/jobController'); | |
const jobRoutes = [ | |
{ | |
name: 'GetJobs', | |
method: 'get', | |
path: '/api/jobs', | |
handler: jobController.getJobs, | |
}, | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mongoose = require('mongoose'); | |
const jobSchema = new mongoose.Schema({ | |
name: { type: String, required: true }, | |
encodingType: { type: String, required: true }, | |
inputFolder: { type: String, required: true }, | |
inputAsset: { type: String, required: true }, | |
outputFolder: { type: String, required: true }, | |
outputAsset: { type: String, required: true }, | |
status: { type: String, required: false }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jobController.addJob = function addJob(req, reply) { | |
const job = new Job(req.body); | |
job.status = constants.WORKFLOW_STATUS.NEW; | |
job.save(function(err, job) { | |
if (!err) { | |
reply.send(job); | |
} else { | |
reply.badRequest(err); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jobController.getJob = function getJob(req, reply) { | |
const id = req.params.id; | |
Job.findById(id, function(err, job) { | |
if (!err) { | |
if (job) { | |
reply.send(job); | |
} else { | |
reply.notFound(`Could not find job with id ${id}`); | |
} | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jobController.updateJob = function updateJob(req, reply) { | |
const id = req.params.id; | |
const job = req.body; | |
const { ...updateData } = job; | |
Job.findByIdAndUpdate(id, updateData, { new: true }, function(err, job) { | |
if (!err) { | |
if (job) { | |
reply.send(job); | |
} else { | |
reply.notFound(`Could not find job with id ${id}`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:12-alpine | |
EXPOSE 8181 | |
HEALTHCHECK --interval=17s --timeout=3s --start-period=5s \ | |
CMD node ./lib/healthcheck.js | |
# Create the work dir and set permissions as WORKDIR set the permissions as root | |
RUN mkdir /home/node/app/ && chown -R node:node /home/node/app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2' | |
services: | |
workflowdb: | |
image: 'mongo:4.0.14' | |
container_name: 'workflow-db' | |
environment: | |
- MONGO_INITDB_ROOT_USERNAME=mveroot | |
- MONGO_INITDB_ROOT_PASSWORD=2020minivideoencoder! | |
- MONGO_INITDB_DATABASE=workflow-db | |
volumes: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"statusCode": 400, | |
"error": "Bad Request", | |
"message": "ValidationError: outputAsset: Path `outputAsset` is required." | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
name: 'GetJobs', // Optional name for convenience | |
method: 'get', // The HTTP verb to use | |
path: '/api/jobs', // The path of the route | |
handler: jobController.getJobs, // The controller method to call | |
} |