Now that you know how to generate code for custom business logic timers (Backendless background jobs) and how to locally debug custom business logic, it is time to learn how to deploy that code to production.
By “production” we mean the Backendless online service running in the cloud. It may not be your ultimate production phase – you may still be developing the application, but it is a convenient way to distinguish it from the debugging/development step.
In order to push your custom server-side code with Timers to Backendless, the CodeRunner distribution and the zip file downloaded from the Business Logic (Cloud Code) code generator, include a command line utility. The utility name is “Deploy” and it has an appropriate extension for the supported operating systems (.sh for Linux and .bat for Windows).
To run the utility, open a command prompt window and change the current directory to the /bin directory which is a part of CodeRunner SDK (and it is also present in the CBL zip downloaded from Backendless Console). Run the utility without any arguments:
> ./Deploy.sh [INFO] CodeRunner(tm) Backendless Debugging Utility [INFO] Copyright(C) 2015 Backendless Corp. All rights reserved. [INFO] Version: 1.13 Build date: 20150320-1727 [INFO] Registering runner on: https://api.backendless.com with secretKey: XXXX-XXXX-XXXX-XXXX [INFO] Runner successfully registered [INFO] Parsing event model... [WARN] Timer's 'Reminder' start time is in the past. The timer will run accordingly to the schedule. [INFO] Build successfully: EventModel{timers=1, eventHandlers=0} [INFO] Deploying model to server, and starting debug... Running custom code [INFO] Model successfully deployed... [INFO] Waiting for events... [INFO] Deploying 0 event handlers and 1 timer to the server… [INFO] Successfully deployed all event handlers and timers. [INFO] If you connected to coderunner for debug - please stop debugging [INFO] CodeRunner will shutdown now [INFO] Debugging Utility disconnected successfully [INFO] Thank you for using Backendless
Notice the command output informs you of how many timers were found and deployed to your Backendless backend:
[INFO] Deploying 0 event handlers and 1 timer to the server…
Once the code is deployed, you can confirm it using Backendless Console:
Once a timer code is in production, it is executed entirely on the Backendless servers according to the scheduled specified in the timer code. There is also a way to run the timer on-demand using the button in the Run column on the interface shown in the screenshot above.
Enjoy!