As of Jan 16 2025, this app has been replaced by https://github.com/NYPL/job-service-v2
This package is intended to be used as a Lambda-based Node.js/PHP Job Service using the NYPL PHP Microservice Starter.
This package adheres to PSR-1, PSR-2, and PSR-4 (using the Composer autoloader).
- Node.js >=6.0
- PHP >=7.0
Homebrew is highly recommended for PHP:
brew install php71
brew install php71-redis
- Clone the repo.
- Install required dependencies.
- Run
npm install
to install Node.js packages. - Run
composer install
to install PHP packages.
- Run
Various files are used to configure and deploy the Lambda.
.env
- Lambda configuration common across deploymentspackage.json
- See "scripts" section for environment specific configuration./config/[environment].env
- Deployment specific environmental variables
To use node-lambda
to process the sample API Gateway event in event.json
, run:
npm run test-create-job
To use the PHP internal web server, run:
php -S localhost:8888 -t . index.php
You can then make a request to the Lambda: http://localhost:8888/api/v0.1/jobs
.
Create a Swagger route to generate Swagger specification documentation:
$service->get("/swagger", function (Request $request, Response $response) {
return SwaggerGenerator::generate(__DIR__ . "/src", $response);
});
Travis CI is configured to run our build and deployment process on AWS.
Our Travis CI/CD pipeline will execute the following steps for each deployment trigger:
- Run unit test coverage
- Build Lambda deployment packages
- Execute the
deploy
hook only fordevelopment
,qa
andmaster
branches to adhere to ournode-lambda
deployment process - Developers do not need to manually deploy the application unless an error occurred via Travis