You will need the following software installed in order to deploy Crypticle to a K8s cluster:
- Node.js version 11 or higher. Download Node.js.
dockerCLI. Install Docker.
kubectlCLI. Install Kubectl.
- If using Rancher, you will need to install the Rancher server on a remote machine of your choice; you will then be able to create your cluster from the Rancher control panel. Install Rancher.
- If using GKE, you will need the
gcloudcommand from the Google Cloud SDK. Install Google Cloud SDK.
Once you have the required software, follow these steps to deploy Crypticle (this approach works best with Rancher):
- Setup your Kubernetes cluster with multiple nodes on your provider (3 is ideal for testing).
- Install the
crypticleCLI tool with
npm install -g crypticle.
- Create your project directory with
crypticle create myproject.
- Navigate to your project directory with
- Get the
Kubeconfigfrom your K8s control panel (or cloud provider) and paste it into the
~/.kube/configfile on your local machine (replace the whole file content).
- Open a new terminal window/tab to make sure that
kubectlhas the latest environment; otherwise you may get errors when trying to create a
secretin your cluster.
- Make sure that your production config file (e.g.
blockchains/lisk/config.prod.jsonfor a Lisk project) contains the correct values; this config is the one which will be used by default in the K8s cluster.
- Upload configs to your K8s cluster using the following command (replace
/lisk/with your blockchain name):
kubectl create configmap crypticle-config \ --from-file=blockchains/lisk/config.prod.json \ --from-file=blockchains/lisk/config.dev.json
- Upload secrets
BLOCKCHAIN_WALLET_PASSPHRASEto your K8s cluster with this command (replace the values with your own):
kubectl create secret generic crypticle-secret \ --from-literal=SECRET_SIGNUP_KEY=313e7cc1-ad75-4030-a927-6a09f39c1603 \ --from-literal=AUTH_KEY=15d16361-6402-41a5-8840-d2a330b8ea40 \ --from-literal=STORAGE_ENCRYPTION_KEY=0111394e-3b3e-4eb3-9759-21741cf055c7 \ --from-literal=BLOCKCHAIN_WALLET_PASSPHRASE="drastic spot aerobic web wave \ tourist library first scout fatal inherit arrange"
- If your custom
adapter.jsfile has any dependencies, make sure that they are all inside the
blockchains/node_modules/directory (to allow them to build correctly).
crypticle deployto build your Docker image containing your custom adapter logic and your config files and then deploy it to your K8s cluster.
- To access the Crypticle app (after deployment has completed), use
kubectl describe ingress agc-ingressto get ingress IP addresses; you can copy and paste any of them directly into your browser's address bar.
- Before you execute any of the commands above, make sure that you have the
gcloudcommand installed (see quickstart guides). Check that
gcloudis installed using the
gcloud -vcommand (it should show you a list of version numbers).
- Create a K8s cluster from your GKE control panel.
- Once your cluster is ready, go to the
Clusterssection and click on the
Connectbutton next to your cluster; then run the provided
gcloud container clusters ...command in your terminal.
- Follow all the deployment steps from the section above with the following differences:
- Skip the step where you need to set the
~/.kube/configfile content; the
gcloudcommand above from GKE should take care of this automatically.
- Instead of
crypticle deploy, use
crypticle deploy --gke(this will cause
.yamlfiles from the
kubernetes/gke/directory to override those in the main
- To access the Crypticle app (after deployment has completed), go to the
Services & Ingresssection and click on the link from the
- Skip the step where you need to set the
- If the
crypticle-workerdeployment is taking a very long time to launch, you should check that your
secretare available within your cluster. If not, you will need to run the relevant
secretdeployment steps as described above.
Scaling on K8s
You can scale any
Deployment or the RethinkDB
StatefulSet using standard
kubectl scale ... --replicas=... commands (see
kubectl scale --help for details).
Be careful when scaling down the RethinkDB
StatefulSet as this may cause data loss if the underlying persistent volumes are removed.
Sharding transaction processing in the database
The RethinkDB admin control panel lets you shard any table at the click of a button.
After you've scaled your
rethinkdb service to multiple hosts, you will be able to increase the number of shards for the