https://github.com/andreialecu/dpd-startup
Deployd module to create event scripts that are run on startup, after deployd starts your project, regardless of any requests coming in.
https://github.com/andreialecu/dpd-startup
Last synced: about 1 month ago
JSON representation
Deployd module to create event scripts that are run on startup, after deployd starts your project, regardless of any requests coming in.
- Host: GitHub
- URL: https://github.com/andreialecu/dpd-startup
- Owner: andreialecu
- License: mit
- Created: 2017-11-06T21:13:05.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-01-25T11:10:12.000Z (over 6 years ago)
- Last Synced: 2025-10-14T19:24:18.212Z (8 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Start-up Code Resource for deployd
[](https://www.npmjs.org/package/dpd-startup)
This is a custom [deployd](https://www.npmjs.org/package/deployd) resource type that allows you to define a script that will be run on startup.
It is useful for setting up Pub/sub job processors, to schedule things that should be run regularly, to ensure that mongodb indexes are created, etc.
### Installation
`npm install dpd-startup --save`
or
`yarn add dpd-startup`
See [Installing Modules](http://docs.deployd.com/docs/using-modules/installing-modules.md) for details.
### Usage
Use [dpd-dashboard](https://www.npmjs.org/package/dpd-startup) to add a **Start-up Module**. The name doesn't matter and you can have as many as you need.
You can write your startup code inside the `Index` event. The code will be run on startup. You will have access to the `dpd` object like in any other event script.
#### Important note:
The code will also be re-run every time you save the script if you're using [dpd-dashboard](https://www.npmjs.org/package/dpd-startup).
So, make sure your startup logic is valid for this purpose. Otherwise, restart your project manually every time, or do not edit the script using `dpd-dashboard`.
The order the startup scripts are ran in is not guaranteed. If you need a particular order, and would like to split your startup script into smaller parts, you can combine this with [dpd-codemodule](https://www.npmjs.org/package/dpd-codemodule) and write your logic inside **Code Resources**, which you can then use from your **startup module**.