Ruby on Rails with Sia and Auth0
This is an example Rails Pinterest clone hosted on Akash. There are a few extra features to make the most of decentralised hosting:

  • Runs the rails server and hosts the actual website.
  • Connects to the Postgres container for a persistent database.
  • Hosts files on Filebase (Sia, Skynet, and Storj hosting currently).
  • Uses Auth0 for user login and registration.

  • Auto-restores the Postgres database on boot, achieving persistent database through re-deploys.
  • Auto-backup of the database to Filebase every 15 minutes.
  • Crontab is defined using Whenever in schedule.rb.
  • Runs the same docker image as the rails application, but running cron instead of the rails server.

  • Runs a standard Postgres server docker image.

Ultimately this repository is designed to provide a sensible example of hosting a rails application on Akash. There are a few ways to use it:

  • Setup a free Cloudflare account and add your domain and set nameservers.
  • Setup a Filebase account and bucket.
    • Add a backups folder to your bucket.
    • You will need your bucket name, client ID, and secret.
  • Sign up for an Auth0 account and set up an App.
  • Using the example deploy.yml, populate the environment variables with the values from Filebase and Auth0.
  • Deploy on Akash and get your app URL.
  • Point your domain to your app URL using a CNAME in Cloudflare.
  • Configure 'Full' SSL mode in Cloudflare.
  • Sign in to your website using Auth0. The first user created will be made an administrator.

  • Clone the repository to your own Github account.
  • Rename any occurrence of AkashOnRails, akash-on-rails and, akash_on_rails to your own app name.
  • Change any app/models, app/controllers, app/views as required.

You can run the application locally using Docker compose.
Copy the .env.sample file to .env and populate.
Run docker-compose up to build and run the application.
Copy link
On this page
Architecture
App container
Cron container
Postgres container
Usage
Run the application as-is on Akash with your own storage and Auth0 account
Use the relevant files in your own project
Clone the repository and use it as a base for a new project
Development