Deploy a Website from scratch to Akash!

Taken from https://akash.network/

INTRO

BUILD A WEBSITE

This is what the code editor should look like. There are a ton of courses about how to get good at html and css. I recommend free code camp or this introductory course. Btw, I am not sponsored by any company/person/link! I recommend you name your homepage document index.html as it will make navigation easier when you get further in this guide. Once you have written these files, go back to your desktop, enter into your project folder, and double click on index.html. It should open your document into a browser where you’ll be able to test your code and css design!

CREATE A DOCKER IMAGE AND CONTAINER

cd desktop/Example (Remember, “Example” is my folder project name)

Then, to create the Dockerfile, type:

touch Dockerfile

And then to enter and edit the Dockerfile, type:

vim Dockerfile

Once inside the Dockerfile, press the “i” key on your keyboard to enter “insert mode” (edit mode). Type this into your blank Dockerfile:

FROM nginx
COPY . /usr/share/nginx/html

Click the “esc” key on your keyboard to exit insert mode and then type “:wq!” and press enter to exit the Dockerfile and return to terminal. Ensure the Docker desktop app is up and running at this point.

This is what your desktop folder will look like at this point:

Now type:

docker build -t website:1.0 .

This command will build a Docker image inside your docker desktop app. Ensure you are still inside your project folder at the command line or this won’t work (“Example”—our foldername—comes before %).

Now, open up the Docker desktop app and you should see the image you just created under the images tab:

Hover above the Image name, and on the far right, click the “run” button. Type in port 3000 (any local port would work) and click run again.

Now, still in the Docker app, click on Containers/Apps on the lefthand navbar. On this page, you should see a green box running your container! Click on “open in browser”.

Viola! Our website is now running on localhost 3000! Now we can also see why we named our homepage index.html. The program typically opens the index.html file first. If you see an nginx page instead of your webpage, type /index.html after the local host portion which will populate the website. No worries if you need to do this.

Time to push this image to the docker hub so the Akash network will be able to use it! To do this you need to create an account on docker hub. Then on your docker hub account, create a public repository.

Next, on the terminal command line type:

docker tag website:1.0 dockerhubusername/website:1.0

Hit enter and then type:
docker push dockerhubusername/website:1.0

You’ll want to change out “dockerhubusername” with your actual username you created on docker hub. This will tag the image and send the file to your repositories. You should now see a public repository with your image in it on dockerhub!

CREATE AN AKASH WALLET

AKASH DEPLOY GUI

gh repo clone tombeynon/akash-deploy

This will clone an awesome GUI made by Tom Beynon off his Github. This means you’ll be able to skip a lot of command line coding and deploy your contract much easier. Once you’ve completed this command, go into the docker desktop app and run the image on a local port.

Here, I added a password and used the recovery mnemonic from my keplr wallet. Create the wallet. Then, navigate to your wallet and create a certificate.

Then, navigate to the deployments page and create a new deployment. Enter this into the manifest box (taken from Tom Beynon):

Change the italicized portions. The image section should contain your docker hub username and project name + tag (our example would be 1234/website:1.0).

---
version: "2.0"

services:
web:
image: tombeynon/akash-hello-world:release-v0.1.1
expose:
- port: 80
as: 80
to:
- global: true

profiles:
compute:
web:
resources:
cpu:
units: 0.5
memory:
size: 512Mi
storage:
size: 512Mi
placement:
dcloud:
attributes:
host: akash
signedBy:
anyOf:
- "akash1365yvmc4s7awdyj3n2sav7xfx76adc6dnmlx63"
pricing:
web:
denom: uakt
amount: 500

deployment:
web:
dcloud:
profile: web
count: 1

Submit the manifest. Now, click on your bids and create a lease from this bids. Do this quickly as it will expire within 5 minutes! Finally, click send to provider. You are finished and deployed on the decentralized cloud. Pretty amazing huh?

ADDITIONAL DETAILS

Then click on Add New Record, scroll down to URL Redirect Record, type @ for host (@ represents your purchased domain name) and then put your Akash web address as the “Value”. If you want your domain name to show up in the search bar, and not Akash’s url, click unmasked and change it to Masked. Masked will display your domain name. It took about two hours for my web redirect to work so give it a little time!

I have undoubtedly missed details, like all guides.

P.S. Please consider donating to Paul Alexander, one of the last surviving men in the iron lung. A victim of Polio, he never gave up, became a lawyer, and wrote a book. His family is struggling with medical expenses and needs help. https://www.gofundme.com/f/20ozlofeqo?utm_campaign=m_pd+share-sheet&utm_medium=social&utm_source=twitter

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store