Components
Add Component
Creates a new component project in the component root directory using a predefined template.
Operation is restricted to super_user roles only
operation (required) - must always be
add_component
project (required) - the name of the project you wish to create
replicated (optional) - if true, HarperDB will replicate the component to all nodes in the cluster. Must be a boolean.
Body
Response: 200
Deploy Component
Will deploy a component using either a base64-encoded string representation of a .tar
file (the output from package_component
) or a package value, which can be any valid NPM reference, such as a GitHub repo, an NPM package, a tarball, a local directory or a website.
If deploying with the payload
option, HarperDB will decrypt the base64-encoded string, reconstitute the .tar file of your project folder, and extract it to the component root project directory.
If deploying with the package
option, the package value will be written to harperdb-config.yaml
. Then npm install will be utilized to install the component in the node_modules
directory located in the hdb root. The value is a package reference, which should generally be a URL reference, as described here (it is also possible to include NPM registerd packages and file paths). URL package references can directly reference tarballs that can be installed as a package. However, the most common and recommended usage is to install from a Git repository, which can be combined with a tag to deploy a specific version directly from versioned source control. When using tags, we highly recommend that you use the semver
directive to ensure consistent and reliable installation by NPM. In addition to tags, you can also reference branches or commit numbers. Here is an example URL package reference to a (public) Git repository that doesn't require authentication:
or this can be shortened to:
You can also install from private repository if you have an installed SSH keys on the server:
Or you can use a Github token:
Or you can use a GitLab Project Access Token:
Note that your component will be installed by NPM. If your component has dependencies, NPM will attempt to download and install these as well. NPM normally uses the public registry.npmjs.org registry. If you are installing without network access to this, you may wish to define custom registry locations if you have any dependencies that need to be installed. NPM will install the deployed component and any dependencies in node_modules in the hdb root directory (typically ~/hdb/node_modules
).
Note: After deploying a component a restart may be required
Operation is restricted to super_user roles only
operation (required) - must always be
deploy_component
project (required) - the name of the project you wish to deploy
package (optional) - this can be any valid GitHub or NPM reference
payload (optional) - a base64-encoded string representation of the .tar file. Must be a string
restart (optional) - if true, HarperDB will restart after deploying the component. Must be a boolean
replicated (optional) - if true, HarperDB will replicate the component to all nodes in the cluster. Must be a boolean.
Body
Response: 200
Package Component
Creates a temporary .tar
file of the specified project folder, then reads it into a base64-encoded string and returns an object with the string and the payload.
Operation is restricted to super_user roles only
operation (required) - must always be
package_component
project (required) - the name of the project you wish to package
skip_node_modules (optional) - if true, creates option for tar module that will exclude the project's node_modules directory. Must be a boolean
Body
Response: 200
Drop Component
Deletes a file from inside the component project or deletes the complete project.
If just project
is provided it will delete all that projects local files and folders
Operation is restricted to super_user roles only
operation (required) - must always be
drop_component
project (required) - the name of the project you wish to delete or to delete from if using the
file
parameterfile (optional) - the path relative to your project folder of the file you wish to delete
replicated (optional) - if true, HarperDB will replicate the component deletion to all nodes in the cluster. Must be a boolean.
Body
Response: 200
Get Components
Gets all local component files and folders and any component config from harperdb-config.yaml
Operation is restricted to super_user roles only
operation (required) - must always be
get_components
Body
Response: 200
Get Component File
Gets the contents of a file inside a component project.
Operation is restricted to super_user roles only
operation (required) - must always be
get_component_file
project (required) - the name of the project where the file is located
file (required) - the path relative to your project folder of the file you wish to view
encoding (optional) - the encoding that will be passed to the read file call. Defaults to
utf8
Body
Response: 200
Set Component File
Creates or updates a file inside a component project.
Operation is restricted to super_user roles only
operation (required) - must always be
set_component_file
project (required) - the name of the project the file is located in
file (required) - the path relative to your project folder of the file you wish to set
payload (required) - what will be written to the file
encoding (optional) - the encoding that will be passed to the write file call. Defaults to
utf8
replicated (optional) - if true, HarperDB will replicate the component update to all nodes in the cluster. Must be a boolean.
Body
Response: 200
Add SSH Key
Adds an SSH key for deploying components from private repositories. This will also create an ssh config file that will be used when deploying the components.
Operation is restricted to super_user roles only
operation (required) - must always be
add_ssh_key
name (required) - the name of the key
key (required) - the private key contents. Line breaks must be delimited with
host (required) - the host for the ssh config (see below). Used as part of the
package
url when deploying a component using this keyhostname (required) - the hostname for the ssh config (see below). Used to map
host
to an actual domain (e.g.github.com
)known_hosts (optional) - the public SSH keys of the host your component will be retrieved from. If
hostname
isgithub.com
this will be retrieved automatically. Line breaks must be delimited withreplicated (optional) - if true, HarperDB will replicate the key to all nodes in the cluster. Must be a boolean.
Body
Response: 200
Generated Config and Deploy Component "package" string examples
Note that deploy_component
with a package uses npm install
so the url must be a valid npm format url. The above is an example of a url using a tag in the repo to install.
Update SSH Key
Updates the private key contents of an existing SSH key.
Operation is restricted to super_user roles only
operation (required) - must always be
update_ssh_key
name (required) - the name of the key to be updated
key (required) - the private key contents. Line breaks must be delimited with
replicated (optional) - if true, HarperDB will replicate the key update to all nodes in the cluster. Must be a boolean.
Body
Response: 200
Delete SSH Key
Deletes a SSH key. This will also remove it from the generated SSH config.
Operation is restricted to super_user roles only
operation (required) - must always be
delete_ssh_key
name (required) - the name of the key to be deleted
replicated (optional) - if true, HarperDB will replicate the key deletion to all nodes in the cluster. Must be a boolean.
Body
Response: 200
List SSH Keys
List off the names of added SSH keys
Operation is restricted to super_user roles only
operation (required) - must always be
list_ssh_keys
Body
Response: 200
Set SSH Known Hosts
Sets the SSH known_hosts file. This will overwrite the file.
Operation is restricted to super_user roles only
operation (required) - must always be
set_ssh_known_hosts
known_hosts (required) - The contents to set the known_hosts to. Line breaks must be delimite d with
replicated (optional) - if true, HarperDB will replicate the known hosts to all nodes in the cluster. Must be a boolean.
Body
Response: 200
Get SSH Known Hosts
Gets the contents of the known_hosts file
Operation is restricted to super_user roles only
operation (required) - must always be
get_ssh_known_hosts
Body
Response: 200
Last updated