I have a NodeJS app that runs as a process and that executes a task every 15 minutes using node-schedule
.
We first need a manifest.yml file that contains:
--- applications: - name: APP-NAME buildpack: nodejs_buildpack no-route: true health-check-type: process env: OPTIMIZE_MEMORY: true
The no-route
parameter is true so that we don’t get a route assigned, and the health-check-type
is set to process so that the orchestrator monitors process availability and doesn’t try to ping a non-existent web endpoint. And OPTIMIZE_MEMORY
in « env » section is based on the Pivotal recommendations.
If you need to use a local package in your app, you’ll have to pack it up first. To do it, go to your local module folder, and type npm pack
. It will create a .tgz
file that you’ll have to store in a local_modules folder for your app. Next, use npm install .\local_modules\package-1.2.3.tgz
.
You can now deploy your app with pcf push APP-NAME
and you can read the logs with cf logs APP-NAME --recent
.