Manage Functions
HarperDB Custom Functions are enabled by default and can be configured further through the HarperDB Studio. It is recommended to read through the Custom Functions documentation first to gain a strong understanding of HarperDB Custom Functions behavior.
All Custom Functions configuration is handled through the functions page of the HarperDB Studio, accessed with the following instructions:
Navigate to the HarperDB Studio Organizations page.
Click the appropriate organization that the instance belongs to.
Select your desired instance.
Click functions in the instance control bar.
Note, the functions page will only be available to super users.
Manage Projects
On the functions page of the HarperDB Studio you are presented with a functions management screen with the following properties:
projects
Displays a list of Custom Functions projects residing on this instance.
/project_name/routes
Only displayed if there is an existing project. Displays the routes files contained within the selected project.
/project_name/helpers
Only displayed if there is an existing project. Displays the helper files contained within the selected project.
/project_name/static
Only displayed if there is an existing project. Displays the static file count and a link to the static files contained within the selected project. Note, static files cannot currently be deployed through the Studio and must be deployed via the HarperDB API or manually to the server (not applicable with HarperDB Cloud).
Root File Directory
Displays the root file directory where the Custom Functions projects reside on this instance.
Custom Functions Server URL
Displays the base URL in which all Custom Functions are accessed for this instance.
Create a Project
HarperDB Custom Functions Projects can be initialized with the following instructions.
If this is your first project, skip this step. Click the plus icon next to the projects heading.
Enter the project name in the text box located under the projects heading.
Click the check mark icon next the appropriate instance.
The Studio will take a few moments to provision a new project based on the Custom Functions template.
The Custom Functions project is now created and ready to modify.
Modify a Project
Custom Functions routes and helper functions can be modified directly through the Studio. From the functions page:
Select the appropriate project.
Select the appropriate route or helper.
Modify the code with your desired changes.
Click the save icon at the bottom right of the screen.
Note, saving modifications will restart the Custom Functions server on your HarperDB instance and may result in up to 60 seconds of downtime for all Custom Functions.
Create Additional Routes/Helpers
To create an additional route to your Custom Functions project. From the functions page:
Select the appropriate Custom Functions project.
Click the plus icon to the right of the routes header.
Enter the name of the new route in the textbox that appears.
Click the check icon to create the new route.
Note, adding a route will restart the Custom Functions server on your HarperDB instance and may result in up to 60 seconds of downtime for all Custom Functions.
To create an additional helper to your Custom Functions project. From the functions page:
Select the appropriate Custom Functions project.
Click the plus icon to the right of the helpers header.
Enter the name of the new helper in the textbox that appears.
Click the check icon to create the new helper.
Note, adding a helper will restart the Custom Functions server on your HarperDB instance and may result in up to 60 seconds of downtime for all Custom Functions.
Delete a Project/Route/Helper
To delete a Custom Functions project from the functions page:
Click the minus icon to the right of the projects header.
Click the red minus icon to the right of the Custom Functions project you would like to delete.
Confirm deletion by clicking the red check icon.
Note, deleting a project will restart the Custom Functions server on your HarperDB instance and may result in up to 60 seconds of downtime for all Custom Functions.
To delete a Custom Functions project route from the functions page:
Select the appropriate Custom Functions project.
Click the minus icon to the right of the routes header.
Click the red minus icon to the right of the Custom Functions route you would like to delete.
Confirm deletion by clicking the red check icon.
Note, deleting a route will restart the Custom Functions server on your HarperDB instance and may result in up to 60 seconds of downtime for all Custom Functions.
To delete a Custom Functions project helper from the functions page:
Select the appropriate Custom Functions project.
Click the minus icon to the right of the helper header.
Click the red minus icon to the right of the Custom Functions header you would like to delete.
Confirm deletion by clicking the red check icon.
Note, deleting a header will restart the Custom Functions server on your HarperDB instance and may result in up to 60 seconds of downtime for all Custom Functions.
Deploy Custom Functions Project to Other Instances
The HarperDB Studio provides the ability to deploy Custom Functions projects to additional HarperDB instances within the same Studio Organization. To deploy Custom Functions projects to additional instances, starting from the functions page:
Select the project you would like to deploy.
Click the deploy button at the top right.
A list of instances (excluding the current instance) within the organization will be displayed in tabular with the following information:
Instance Name: The name used to describe the instance.
Instance URL: The URL used to access the instance.
CF Capable: Describes if the instance version supports Custom Functions (yes/no).
CF Enabled: Describes if Custom Functions are configured and enabled on the instance (yes/no).
Has Project: Describes if the selected Custom Functions project has been previously deployed to the instance (yes/no).
Deploy: Button used to deploy the project to the instance.
Remote: Button used to remove the project from the instance. Note, this will only be visible if the project has been previously deployed to the instance.
In the appropriate instance row, click the deploy button.
Note, deploying a project will restart the Custom Functions server on the HarperDB instance receiving the deployment and may result in up to 60 seconds of downtime for all Custom Functions.
Last updated