Deploy a WordPress Blog on Akash Network

Julius
4 min readApr 7, 2021

This Guide will show you how to Deploy a WordPress Blog on Akash — the Unstoppable Cloud.

Requirements:

1. Set the environment Variables

To make it as simple as possible we start with setting up reusable Variables in the Terminal.

We need to set the following:

  • KEY_NAME (The name for the Key in your Keyring)
  • AKASH_KEYRING_BACKEND (Associated to your KEY_NAME)
  • ACCOUNT_ADDRESS
  • AKASH_NET_BASE
  • AKASH_NET
  • AKASH_VERSION
  • AKASH_CHAIN_ID
  • AKASH_NODE

Set the Variables with:

export KEY_NAME=examplekeyname

If you are not sure if the Variable is already set you can check it’s value with:

echo $KEY_NAME

This will return the Variable. In this case it will return “examplekeyname”. If the Variable is not set a blank line is returned.

Now that we set the KEY_NAME we have to set the Keyring backend. Allowed Values are “os”, “file” and “test”.

Use the Value associated with your KEY_NAME. In this example my KEY_NAME (Value: “examplekeyname”) uses the “file”-Backend.

export AKASH_KEYRING_BACKEND=file

Now that these two Variables are set, you can simply copy & paste the following commands.

export ACCOUNT_ADDRESS="$(akash keys show $KEY_NAME -a)"
export AKASH_NET_BASE=https://raw.githubusercontent.com/ovrclk/net/master
export AKASH_NET="$AKASH_NET_BASE/mainnet"
export AKASH_VERSION="$(curl -s "$AKASH_NET/version.txt")"
export AKASH_CHAIN_ID="$(curl -s "$AKASH_NET/chain-id.txt")"
export AKASH_NODE="$(curl -s "$AKASH_NET/rpc-nodes.txt" | shuf -n 1)"

2. Check if you are using the correct Version & Chain ID

echo $AKASH_CHAIN_ID $(akash version)

The Chain ID should be “akashnet-2” and the version “v0.12.0-rc1”

akashnet-2 v0.12.0-rc1

3. Create Certificate

If this is your first deployment on Akash you will have to create a Certificate on the Chain to identify yourself to providers.

akash tx cert create client --chain-id $AKASH_CHAIN_ID --keyring-backend $KEYRING_BACKEND --from $KEY_NAME --node $AKASH_NODE --fees 5000uakt

4. Create the deploy.yml File

Create deploy.yml file with an editor of your choice and paste the following text.

Please edit the bold text to something safe. Make sure that the first DBNAME#1,(…) matches the second DBNAME#1,(…) otherwise WordPress will be unable to connect to the Database.

deploy.yml:

---
version: "2.0"
services:
db:
image: mysql/mysql-server:latest
env:
- MYSQL_ROOT_PASSWORD=PASSWORD#1
- MYSQL_DATABASE=DBNAME#1
- MYSQL_USER=DBUSER#1
- MYSQL_PASSWORD=PASSWORD#2
expose:
- port: 3306
to:
- service: wordpress
wordpress:
depends-on:
- db
image: zjuuu/akash-wordpress:latest
env:
- WORDPRESS_DB_HOST=db
- WORDPRESS_DB_NAME=DBNAME#1
- WORDPRESS_DB_USER=DBUSER#1
- WORDPRESS_DB_PASSWORD=PASSWORD#2
- WORDPRESS_TABLE_PREFIX=wp_
expose:
- port: 80
accept:
- YOUR-DOMAIN.com
to:
- global: true
- port: 443
to:
- global: true
profiles:
compute:
wordpress:
resources:
cpu:
units: 1
memory:
size: 1Gi
storage:
size: 2Gi
db:
resources:
cpu:
units: 0.5
memory:
size: 512Mi
storage:
size: 512Mi
placement:
westcoast:
pricing:
wordpress:
denom: uakt
amount: 5000
db:
denom: uakt
amount: 5000
deployment:
wordpress:
westcoast:
profile: wordpress
count: 1
db:
westcoast:
profile: db
count: 1

If you want to use a Domain instead of the default Akash Link (*.ingress.sjc1p0.mainnet.akashian.io) you have to insert your Domain in YOUR-DOMAIN.com. Otherwise you have to delete:

accept:
- YOUR-DOMAIN.com

Now that the deploy.yml is ready we can start to deploy.

5. Create a Deployment

Make sure your Terminal is in the same directory as your deploy.yml-File.

akash tx deployment create deploy.yml --from $KEY_NAME --node $AKASH_NODE --chain-id $AKASH_CHAIN_ID --fees 5000uakt -y

After confirming the transaction you will see a response similar to this:

{"height":"251787","txhash":"2734E54A092365E84F7B538F8024CB695BC93067C2ECACBD6C153469DDDDDDDD","codespace":"","code":0,"data":"0A0E0A0C6372656174652D6C65617365","raw_log":"[{\"events\":[{\"type\":\"akash.v1\",\"attributes\":[{\"key\":\"module\",\"value\":\"market\"},{\"key\":\"action\",\"value\":\"lease-created\"},{\"key\":\"owner\",\"value\":\"akash1ytvu64v3rp5q7y3fueukmfashcvu9wxxxxxxxx\"},{\"key\":\"dseq\",\"value\":\"251700\"},{\"key\":\"gseq\",\"value\":\"1\"},{\"key\":\"oseq\",\"value\":\"1\"},{\"key\":\"provider\",\"value\":\"akash10cl5rm0cqnpj45knzakpa4cnvn5amzwaaaaaaa\"},{\"key\":\"price-denom\",\"value\":\"uakt\"},{\"key\":\"price-amount\",\"value\":\"4\"}]},

export DSEQ, QSEQ and OSEQ as new Variables.

export DSEQ=251700
export OSEQ=1
export QSEQ=1

6. Select Provider

Now your Lease-Request is on the Market and Providers bid on it.

You can see all Bids for your Lease with this command:

akash query market bid list --owner=$ACCOUNT_ADDRESS --node $AKASH_NODE --dseq $DSEQ

You will see something like this:

bids:
- bid:
bid_id:
dseq: "251700"
gseq: 1
oseq: 1
owner: akash1ytvu64v3rp5q7y3fueukmfashcvu9wxxxxxxxx
provider: akash10cl5rm0cqnpj45knzakpa4cnvn5amzwaaaaaaa
created_at: "251700"
price:
amount: "4"
denom: uakt
state: open
escrow_account:
balance:
amount: "50000000"
denom: uakt
id:
scope: bid
xid: akash1ytvu64v3rp5q7y3fueukmfashcvu9wxxxxxxxx/251700/1/1/akash10cl5rm0cqnpj45knzakpa4cnvn5amzwaaaaaaa
owner: akash10cl5rm0cqnpj45knzakpa4cnvn5amzwaaaaaaa
settled_at: "251700"
state: open
transferred:
amount: "0"
denom: uakt

In this Example i choose the provider: akash10cl5rm0cqnpj45knzakpa4cnvn5amzwaaaaaaa

export PROVIDER=akash10cl5rm0cqnpj45knzakpa4cnvn5amzwaaaaaaa

amount: “4” means it’s using 4 uAKT or 0.000004 AKT per block (1 Block = ~7 seconds) to execute the container.

7. Now you have to create the Lease with the Provider

Make sure you have at least 5 AKT in your Wallet because 5 AKT will be transferred into an Escrow Wallet to pay the leasing. If you close the deployment the remaining AKT will get returned.

akash tx market lease create --chain-id $AKASH_CHAIN_ID --node $AKASH_NODE --owner $ACCOUNT_ADDRESS --dseq $DSEQ --gseq $GSEQ --oseq $OSEQ --provider $PROVIDER --from $KEY_NAME --fees 5000uakt

8. Upload the Manifest

akash provider send-manifest deploy.yml --node $AKASH_NODE --dseq $DSEQ --provider $PROVIDER --home ~/.akash --from $KEY_NAME

The manifest is now being processed.

9. Check for the supplied Akash-Link

akash provider lease-status --node $AKASH_NODE --home ~/.akash --dseq $DSEQ --from $KEY_NAME --provider $PROVIDER

You will see a similar Response:

{"services": {"web": {"name": "web","available": 1,"total": 1,"uris": ["rga3h05jetf9h3p6dbk62m19ck.ingress.ewr1p0.mainnet.akashian.io"],"observed_generation": 1,"replicas": 1,"updated_replicas": 1,"ready_replicas": 1,"available_replicas": 1}}

In this case: rga3h05jetf9h3p6dbk62m19ck.ingress.ewr1p0.mainnet.akashian.io is your Link to access the Wordpress Page.

Please Note: It takes a few minutes for the MySql Server to start. If the Error “Error establishing a database connection” still exists after 10 minutes you have to check the logs with the following command.

akash provider lease-logs --dseq=$DSEQ --from=$ACCOUNT_ADDRESS --provider=$PROVIDER

--

--