How to deploy a decentralized Blog

Julius

This Guide will show you how to deploy a WordPress blog on Akash Network which receives all static files from Skynet.

To access the website we don’t use a common “.com” but instead use a Handshake-Domain.

In addition, to make it as fail-safe as possible we will add a service which regularly creates backups of the database to Skynet.

This challenge came from Greg Osuri, CEO of Akash, who wanted to see if the community could integrate Skynet and HNS with Akash.

The first approach was to extend the WordPress Setup used on my other Medium Story with a custom Plugin to simply upload the WordPress Media Library to Skynet.

Neal helped me with this and created a small plugin to make it work but we ran in to many problems and I decided to find a other way and use already existing WordPress Plugins instead. This was not the preferred way because it means you have to use a few different services.

The integration of Skynet with Filebase helped a lot. It allows you to store Files on Skynet but with the ability to access them like a AWS S3 Bucket.

Handshake is a decentralized naming protocol and offers a alternative to common domains. You cannot access it directly, you need a special browser Browser like Puma (Android, iOS) or custom DNS Settings.

To buy domains you use the currency HNS and a platform like namebase.io

The Process to buy a domain takes a few days (Auction Process).

Now that you have a Domain you can go on and create a new deployment on AKASH Network.

The easiest way to deploy at the moment is to use Tom’s Deploy UI, it saved me so much time because I had to test many docker images to make this work.

It sets everything up for you and let’s you create a deployment in just a few steps.

To run it you need Docker installed and start the following command in a Terminal of your choice:

docker run -v ~/.akash-ui:/root/akash -p 3000:3000 --rm -it tombeynon/akash-deploy

-v ~/.akash-ui:/root/akash Means that the folder ~/.akash-ui on your local machine corresponds to /root/akash in your virtual docker machine. This is where your keys are stored. Make sure you use a valid path.

After this you can access the tool on http://localhost:3000

After Key setup and funding your address you can finally deploy the blog.

To do this I created a custom wordpress image with a ready server configuration. In my other Medium Story I used the “wordpress:latest” image with simple environment variables to connect to the DB. This causes massive performance issues.

Replace bold words with secure credentials.

---
version: "2.0"
services:
db:
image: mysql/mysql-server:latest
env:
- MYSQL_ROOT_PASSWORD=ROOTPASSWORD
- MYSQL_DATABASE=DATABASE
- MYSQL_USER=USERNAME
- MYSQL_PASSWORD=PASSWORD
expose:
- port: 3306
to:
- service: wordpress
wordpress:
depends-on:
- db
image: zjuuu/akash-wphns:latest
env:
- WORDPRESS_DB_HOST=db
- WORDPRESS_DB_NAME=DATABASE
- WORDPRESS_DB_USER=USERNAME
- WORDPRESS_DB_PASSWORD=PASSWORD
- WORDPRESS_TABLE_PREFIX=wp_
expose:
- port: 80
accept:
- HNS-DOMAIN
to:
- global: true
profiles:
compute:
wordpress:
resources:
cpu:
units: 1
memory:
size: 2Gi
storage:
size: 2Gi
db:
resources:
cpu:
units: 1
memory:
size: 1Gi
storage:
size: 1Gi
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

After deployment you have to check the bids and accept the offer of one Provider. After that you have to send the manifest.

Then your page will boot up and after a few minutes you can access the supplied *.ingress.*.mainnet.akashian.io url.

You will see the common WordPress installation page to set everything up.

Go to https://filebase.com/ and create a Account. You receive 5GB Storage for free.

Now we create 2 buckets on the Storage Network “Sia” (Skynet):

First one will store all static files of the blog and will be public.

The Second is private and stores all Mysql backups.

Now you have to go to the Filebase Settings and get your “S3 Api Access Key ID”, “S3 API Secret Access Key” and “S3 API Endpoint”.

Now go back to your WordPress page and install the plugin: Media Cloud. After activation it will walk you through a installation guide. On the second step you have to provide a S3 Bucket Provider. Click on “S3 Compatible”. It will ask you to insert the information from your Filebase settings page.

After this, all content you upload to WordPress is now uploaded to the bucket instead. Please note, that the possibility to upload the static generated JS, CSS files is a premium function of this plugin.

To achieve this, I used the plugin BackWPup it let’s you easily create backups of the database and other WordPress files and uploads them to the Filebase S3 Bucket.

After activation you have to add a new Job. In this example i will only backup the Database, that’s why i only check “Database backup” in the first step.

If you keep scrolling you will see a option called “Job Destination”. Select “Backup to an S3 Service” .

Scroll back to top and setup the schedule and backup settings.

In the last step you have to configure the “S3 Service”.

To do this you have to add the Filebase Endpoint, Region, your S3 API Access Key ID and S3 API Secret Access Key:

It will show a red error “The s3 service does not have a version: .” at Bucket selection. Ignore this error and click “Save changes”.

After saving you can select a desired bucket in that field.

To do this you have to go to your Namebase.io Dashboard select the Domain and add a “A”-Record with the value set to the IP of your WordPress blog.

The easiest way to get the IP is to ping the *.ingress.*.mainnet.akashian.io page in your Terminal.

The last step is to change the links on your WordPress to redirect to your HNS Domain instead of akashian.io.

Navigate to the settings and change the values of “WordPress Address” and “Site Address” to your HNS-Domain.

Click on “Save Changes”. It will redirect you to your HNS-Domain, depending on the Browser/DNS Settings you use, you will not be able to access the page anymore.

Don’t know how to access HNS-Domains? Read this Guide.