This is a guide to deploying Pancake Swap Interface on Akash in a non-custodial way. Akash is a permissionless and censorship-resistant cloud network that guarantees sovereignty over your data and your applications. With Akash, you’re in complete control of all aspects of the life cycle of an application with no middleman.
This is a technical guide, best suited to a reader with basic Linux command line knowledge. The audience for this guide is intended for includes:
- Application developers with little or no systems administration experience, wanting to deploy applications on the decentralized cloud.
- System administrators with little or no experience with infrastructure automation, wanting to learn more.
- Infrastructure automation engineers that want to explore decentralized cloud.
- Anyone who wants to get a feel for the current state of the decentralized cloud ecosystem.
You will need the below setup before we being:
- Install Akash: Make sure to have Akash client installed on your workstation, check install guide for instructions.
- Choose Your Akash Network: You'll need to know information about the network you're connecting your node to. See Choosing a Network for how to obtain any network-related information.
- Fund Your Account: You'll need a AKT wallet with funds to pay for your deployment. See the funding guide creating a key and funding your account.
- Install Docker: You'll need docker running on your workstation, follow this guide to setup Docker on your workstation..
- Setup Container Registry: To stage your containers to deploy onto Akash. We'll Docker Hub in this guide. Signup for a free Docker Hub account if you haven't.
- Setup Builpacks.io: Builpacks.io is a Cloud Native Buildpacks transform your application source code into images that can run on any cloud. Install
pack
tool using this guide.
We will be using shell variables throughout this guide for convenience and clarity. Ensure you have the below set of variables defined on your shell, you can use export VARNAME=...
:
Name | Description |
---|---|
AKASH_NODE |
Akash network configuration base URL. See here. |
AKASH_CHAIN_ID |
Chain ID of the Akash network connecting to. See here. |
ACCOUNT_ADDRESS |
The address of your account. See here. |
KEY_NAME |
The name of the key you will be deploying from. See here if you haven't yet setup a key |
Verify you have correct $AKASH_NODE
, that you have populated while configuring the connection using export AKASH_NODE=$(curl -s "$AKASH_NET/rpc-nodes.txt" | shuf -n 1)
.
echo $AKASH_NODE $AKASH_CHAIN_ID
You should see a response similar to:
tcp://rpc-edgenet.akashdev.net:2665 akash-edgenet-1
Your values may differ depending on the network you're connecting to, tcp://rpc-edgenet.akashdev.net:2665
and akash-edgenet-1
are details for edgenet.
Verify you have the key set up and your account has sufficient balances, see the funding guide otherwise:
My local key is named alice
, the below command should return the name you've used:
echo $KEY_NAME
The above should return a response similar to:
alice
Populate ACCOUNT_ADDRESS
from KEY_NAME
and verify:
export ACCOUNT_ADDRESS="$(akash keys show $KEY_NAME -a)"
echo $ACCOUNT_ADDRESS
akash1j8s87w3fctz7nlcqtkl5clnc805r240443eksx
Check your account has sufficient balance by running:
akash query bank balances --node $AKASH_NODE $ACCOUNT_ADDRESS
You should see a response similar to:
balances:
- amount: "93000637"
denom: uakt
pagination:
next_key: null
total: "0"
Please note the balance indicated is is denominated in uAKT (AKT * 10^-6), in the above example, the account has a balance of 93 AKT. We're now setup to deploy.
Create a deployment configuration deploy.yaml
to deploy the yuravorobei/pancake-swap
for Pancake Swap Interface Node JS app container using SDL:
cat > deploy.yaml <<EOF
---
version: "2.0"
services:
web:
image: yuravorobei/pancake-swap
expose:
- port: 8080
as: 80
to:
- global: true
profiles:
compute:
web:
resources:
cpu:
units: 1.0
memory:
size: 512Mi
storage:
size: 1Gi
placement:
akash:
signedBy:
anyOf:
- "akash1365yvmc4s7awdyj3n2sav7xfx76adc6dnmlx63"
pricing:
web:
denom: uakt
amount: 10000
deployment:
web:
akash:
profile: web
count: 1
Alternatively, you can use cURL to download:
curl -s https://raw.githubusercontent.com/ovrclk/awesome-akash/master/pancake-swap/deploy.yaml > deploy.yaml
You may use the sample deployment file as-is or modify it for your own needs as desscribed in our SDL (Stack Definition Language documentation.
{% hint style="warn" %}
Please note if you are running on the testnet, you are limited in the amount of testnet resources you may request.
{% endhint %}
To deploy on Akash, run:
akash tx deployment create deploy.yaml --from $KEY_NAME --node $AKASH_NODE --chain-id $AKASH_CHAIN_ID --fees 5000uakt -y
In this step, you post your deployment, the Akash marketplace matches you with a provider via auction. To create a deployment use akash deployment. The syntax for the deployment is akash tx deployment create <config-path> --from <key-name>
.
You can check the status of your lease by running:
akash query market lease list --owner $ACCOUNT_ADDRESS --node $AKASH_NODE --state active
- lease_id:
dseq: "115884"
gseq: 1
oseq: 1
owner: akash1j8s87w3fctz7nlcqtkl5clnc805r240443eksx
provider: akash1y8xhp9ekxctahvex7842h607lmwp50q0n89tw0
price:
amount: "51"
denom: uakt
state: active
pagination:
next_key: null
total: "0"
In the above example, we can see that a lease is created using for 51 uakt or 0.0000051 AKT per block to execute the container.
For convenience and clarity for future referencing, we can extract the below set of values to shell variables that we will be using to reference the deployment:
Attribute | Value |
---|---|
PROVIDER |
akash1y8xhp9ekxctahvex7842h607lmwp50q0n89tw0 |
DSEQ |
115884 |
OSEQ |
1 |
GSEQ |
1 |
Verify we have the right values populated by running:
echo $PROVIDER $DSEQ $OSEQ $GSEQ
You should see a response similar to:
akash1y8xhp9ekxctahvex7842h607lmwp50q0n89tw0 115884 1 1
Upload the manifest using the values from above step:
akash provider send-manifest deploy.yaml --node $AKASH_NODE --dseq $DSEQ --oseq $OSEQ --gseq $GSEQ --owner $ACCOUNT_ADDRESS --provider $PROVIDER
Your image is now deployed, once you uploaded the manifest. You can retrieve the access details by running the below:
akash provider lease-status --node $AKASH_NODE --dseq $DSEQ --oseq $OSEQ --gseq $GSEQ --provider $PROVIDER --owner $ACCOUNT_ADDRESS
You should see a response similar to:
{
"services": {
"web": {
"name": "web",
"available": 1,
"total": 1,
"uris": [
"phzz2bcjjoz7jhvderxo5d.provider1.akashdev.net"
],
"observed-generation": 0,
"replicas": 0,
"updated-replicas": 0,
"ready-replicas": 0,
"available-replicas": 0
}
},
"forwarded-ports": {}
}
You can access the application by visiting the hostnames mapped to your deployment. In above example, its http://phzz2bcjjoz7jhvderxo5d.provider1.akashdev.net
You can view the logs for your applicaiton using akash provider service-logs
, for example:
akash provider service-logs --node $AKASH_NODE --dseq $DSEQ --oseq $OSEQ --gseq $GSEQ --provider $PROVIDER --owner $ACCOUNT_ADDRESS --service web
You should see a response similar to:
[web-7447d7769-c6t4f] yarn run v1.22.10
[web-7447d7769-c6t4f] $ /workspace/node_modules/.bin/serve build
[web-7447d7769-c6t4f] INFO: Accepting connections at http://localhost:5000
When you are done with your application, close the deployment. This will deprovision your container and stop the token transfer. Close deployment using deployment by creating a deployment-close
transaction:
akash tx deployment close --node $AKASH_NODE --chain-id $AKASH_CHAIN_ID --dseq $DSEQ --owner $ACCOUNT_ADDRESS --from $KEY_NAME -y --fees 5000uakt
Additionally, you can also query the market to check if your lease is closed:
akash query market lease list --owner $ACCOUNT_ADDRESS --node $AKASH_NODE
You should see a response similar to:
leases:
- lease_id:
dseq: "115884"
gseq: 1
oseq: 1
owner: akash1j8s87w3fctz7nlcqtkl5clnc805r240443eksx
provider: akash1y8xhp9ekxctahvex7842h607lmwp50q0n89tw0
price:
amount: "186"
denom: uakt
state: closed
pagination:
next_key: null
total: "0"