This is a sample QuickNode Marketplace add-on built on top of Sinatra and PostgreSQL.
It implements the 4 provisioning routes that a partner needs to integrate with Marketplace, as well as the required Healthcheck route.
It also has support for:
- RPC methods via a
POST /rpcroute - A dashboard view with Single Sign On using JSON Web Tokens (JWT).
To install and run the application locally:
- Clone the repository.
gem install foremanbundle- Copy
.env.exampleto.envfile and fill in with the appropiate values. rake db:migratebin/dev
The application has 4 provisioning routes protected by HTTP Basic Auth:
POST /provisionPUT /updateDELETE /deactivateDELETE /deprovision
It has a public healthcheck route that returns 200 if the service and the database is up and running:
GET /healthcheck
It has a dashboard that can be accessed using Single Sign On with JSON Web Token (JWT):
GET /dashboard?jwt=foobar
It has an JSON RPC route:
POST /rpc
You can use the qn-marketplace-cli tool to quickly test your add-on while developing it.
To obtain a basic auth string, you can use Ruby or your language of choice with your username and password, as such:
require 'securerandom' secret_key = SecureRandom.hex(32)For the commands below, the --basic-auth flag is the Base64 encoding of username:password. You need to make sure to replace that with your valid credentials (as defined in your .env file).
PUDD:
./qn-marketplace-cli pudd --base-url http://localhost:3005 --basic-auth dXNlcm5hbWU6cGFzc3dvcmQ=SSO:
./qn-marketplace-cli sso --url http://localhost:3005/provision --jwt-secret jwt-secret --basic-auth dXNlcm5hbWU6cGFzc3dvcmQ=RPC:
./qn-marketplace-cli rpc --url http://localhost:3005/provision --rpc-method qn_test --rpc-url http://localhost:3005/rpc --rpc-params "[\"abc\"]" --basic-auth dXNlcm5hbWU6cGFzc3dvcmQ=Healthcheck:
./qn-marketplace-cli healthcheck --url http://localhost:3005/healthcheckMIT