-
Notifications
You must be signed in to change notification settings - Fork 6
Akash Decentralized Deployment Guide
You will need to do this step every time you close and re-open your terminal window
AKASH_NODE=http://135.181.60.250:26657
AKASH_CHAIN_ID=akashnet-2
AKASH_ACCOUNT_ADDRESS=<YOUR_AKASH_WALLET_ADDRESS_YOU_WILL_FUND_THE_DEPLOYMENT_WITH>
AKASH_KEYRING_BACKEND=os
AKASH_KEY_NAME=skynet-tehp9
echo $AKASH_NODE $AKASH_CHAIN_ID $AKASH_KEYRING_BACKEND
Output:
http://135.181.60.250:26657/ akashnet-2 os
echo $AKASH_KEY_NAME
Output:
<YOUR_KEY_NAME>
Check Funding Address
export AKASH_ACCOUNT_ADDRESS="$(akash keys show $AKASH_KEY_NAME -a)"
echo $AKASH_ACCOUNT_ADDRESS
Output:
<Akash address for funding the deployment>
You must have at least 5 AKT to fund a deployment. This will be escrowed to pay per block for the deployment. Do not forget to deposit more for long running deployments.
akash query bank balances --node $AKASH_NODE $AKASH_ACCOUNT_ADDRESS
Output:
balances:
- amount: "93000637"
denom: uakt
pagination:
next_key: null
total: "0"
Ok so there is more to it than what I showing you here. Visit Akash's Awesome Akash examples of deployments
The following deploy.yml file will deploy an Akash RPC/API node
First we need to create our deployment certificate.
To create a deployment, a certificate must first be created. To do this, run:
akash tx cert create client --chain-id $AKASH_CHAIN_ID \
--keyring-backend $AKASH_KEYRING_BACKEND --from $AKASH_KEY_NAME \
--node $AKASH_NODE --fees 5000uakt
NOTE: You only create this once. It is stored on your local PC in the ~/.akash/<$AKASH_ACCOUNT_ADDRESS>.pem. Copy this certificate to any machine you will deploy from.
akash tx deployment create deploy.yml --from $AKASH_KEY_NAME \
--node $AKASH_NODE --chain-id $AKASH_CHAIN_ID --fees 5000uakt -y
The above will create the actual deployment request on the Akash DeCloud. With the resulting output you need to capture the DSEQ, OSEQ and GSEQ. Add them to the following variables:
AKASH_DSEQ=440665
AKASH_OSEQ=1
AKASH_GSEQ=1
The second most important thing is to know how to close a deployment. This command closes the deployment and releases any escrowed AKT back to your funding account and prevents tokens form being sent to the provider that was hosting the deployment.
akash tx deployment close --dseq $AKASH_DSEQ \
--fees 5000uakt \
--from $AKASH_KEY_NAME \
--owner $AKASH_ACCOUNT_ADDRESS \
--chain-id $AKASH_CHAIN_ID \
--node $AKASH_NODE -y
akash query deployment get -o text --owner $AKASH_ACCOUNT_ADDRESS --node $AKASH_NODE --dseq $AKASH_DSEQ
akash query market order get -o text --node $AKASH_NODE --owner $AKASH_ACCOUNT_ADDRESS \
--dseq $AKASH_DSEQ --oseq $AKASH_OSEQ --gseq $AKASH_GSEQ
View Provider bids to host your deployment
akash query market bid list --owner=$AKASH_ACCOUNT_ADDRESS --node $AKASH_NODE --dseq $AKASH_DSEQ -o text
Select a provider from the listed BIDs and assign the Provider/Owner address to the following:
AKASH_PROVIDER=<PROVIDER_ADDRESS>
Verify Setting:
echo $AKASH_PROVIDER
Output:
<PROVIDER_ADDRESS>
Now that you have created the deployment and selected a Provider to host your deployment you need to create a lease. I think of this as the contract between the Provider and the Tenant
akash tx market lease create --chain-id $AKASH_CHAIN_ID \
--node $AKASH_NODE --owner $AKASH_ACCOUNT_ADDRESS \
--dseq $AKASH_DSEQ --gseq $AKASH_GSEQ --oseq $AKASH_OSEQ \
--provider $AKASH_PROVIDER --from $AKASH_KEY_NAME --fees 5000uakt
The above will produce a large output.
akash query market lease list --owner $AKASH_ACCOUNT_ADDRESS --node $AKASH_NODE --dseq $AKASH_DSEQ -o text
The manifest tells the Provider how to configure you deployment
akash provider send-manifest deploy.yml --node $AKASH_NODE --dseq $AKASH_DSEQ \
--provider $AKASH_PROVIDER --home ~/.akash --from $AKASH_KEY_NAME
there will be no output
Please know that besides port 80, all ports will receive as random port number
akash provider lease-status --node $AKASH_NODE --home ~/.akash --dseq $AKASH_DSEQ \
--from $AKASH_KEY_NAME --provider $AKASH_PROVIDER
{
.."services": {
...."web": {
......"name": "web",
......"available": 0,
......"total": 1,
......"uris": [
........"mrfnspesm5br1ev06gnire5574.ingress.ams1p0.mainnet.akashian.io"
......],
......"observed_generation": 1,
......"replicas": 1,
......"updated_replicas": 1,
......"ready_replicas": 0,
......"available_replicas": 0
....}
..},
The '...' are just place holders.
The next two commands are import because they allow you to see how provisioning of you deployment is progressing. The first shows you the provider's system events related to the provisioning of you manifies.
akash provider lease-events --dseq $AKASH_DSEQ \
--gseq $AKASH_GSEQ --oseq $AKASH_OSEQ \
--provider $AKASH_PROVIDER --from $AKASH_KEY_NAME \
--node $AKASH_NODE
If the above does not return any out put it means the lease is closed.
The next command show the console output of you deployed application. If you deploy an Akash node your will see the familiar output of blocks being created.
akash provider lease-logs --dseq $AKASH_DSEQ --gseq $AKASH_GSEQ \
--oseq $AKASH_OSEQ --provider $AKASH_PROVIDER --from $AKASH_KEY_NAME --node $AKASH_NODE
To view the status of a particular service defined in your deploy.yml files you run the following command
akash provider service-status --dseq 470185 \
--provider akash1f6gmtjpx4r8qda9nxjwq26fp5mcjyqmaq5m6j7 \
--service wordpress --from $AKASH_KEY_NAME --node $AKASH_NODE
Change the deployment.yaml and then akash tx deployment update...
(See "Deploy Request for Providers" above but change create to update) and then akash provider send-manifest...
(See "Upload the Manifest above)"
The escrow is how you pay for your deployments. To view the escrow balance of a particular deployment do the following:
akash query deployment get --dseq $AKASH_DSEQ --owner $AKASH_ACCOUNT_ADDRESS -o text --node $AKASH_NODE
To add more funds to your deployment's escrow do the following:
akash tx deployment deposit 5000000uakt --owner $AKASH_ACCOUNT_ADDRESS \
--dseq $AKASH_DSEQ --from $AKASH_KEY_NAME --fees 5000uakt --chain-id akashnet-2 --node $AKASH_NODE