The Kibisis API is a set of DigitalOcean functions that act as a RESTful API for the Kibisis ecosystem.
The project structure is based on the DigitalOcean functions project structure.
However, the core directories lib
and packages
have specific functionality:
packages
- This is where each function resides. Each package/function relates to a versioned API path. For example,v1/quests
will correspond to an API pathhttps://<endpoint>/v1/quests
lib
- This contains independent modules that are referenced from the packages.
⚠️ NOTE: Each path must parse the request header and handle the method, i.e. GET, POST, DELETE e.t.c.
To start using your own Doppler config, go to the project on Doppler and press the "+" to create a new personal branch config in the "Development" config
⚠️ NOTE: Use your name in lowercase with underscores instead of spaces (snake_case).
Once the branch project config has been setup, follow the instructions here to:
- login to Doppler, and;
- setup Doppler to use the
api
project with your personal config.
⚠️ NOTE: When naming your token, it is recommended you use: "-<device_name>".
The DigitalOcean CLI client, doctl
, is used to deploy the function to a remote environment tha can be used to develop.
Follow the instructions outlined in the documentation.
⚠️ NOTE: Once you have setupdoctl
make sure you also install the serverless subcommand usingdoctl serverless install
⚠️ NOTE: If you have a personal namespace already setup, you can skip this step.
- Setup a personal namespace using your name suffixed by the word "
namespace
" ensuring to use kebab-case:
doctl serverless namespaces create --label="kieran-namespace" --region="ams3"
⚠️ NOTE: The above example shows setting up a namespace in the Amsterdam region, but it is better if you use a region that is closest to you. Run the command:doctl serverless namespaces list-regions
to get a list of regions and replace the--region
value with the desired region form the list.
- Deploy the function to the namespace that was created in the previous step:
make deploy
- Get the URL of the deployed function:
doctl serverless functions get <package>/<function> --url
This will return a URL in the form of:
https://faas-ams3-2a2df116.doserverless.co/api/v1/web/<namespace>/<package>/<function>
Use this URL to interact with the API.
Command | Description |
---|---|
make |
Deploys the functions to the remote namespace. Intended for development purposes only. |
make clean |
Removes build files and configurations. |
make deploy |
Fetches secrets from Doppler and deploys the functions to the configured namespace. Intended for development purposes only. |
make list |
Lists the deployed functions in the configured namespace. |
make logs |
Outputs the activation logs for the deployed functions. |
make test |
Runs the tests for each function. |
make setup |
Installs dependencies. |
make swagger |
Parses the functions and creates the swagger.json to packages/vX/swagger directories. |
make watch |
Fetches secrets from Doppler and watches for code changes and redeploys functions to namespace. Intended for development purposes only. |
Please read the Contributing Guide to learn about the development process.
Please refer to the COPYING file.