Skip to content

akash-network/console

Repository files navigation

Akash logo

Akash Console

Akash Console is a powerful application that allows you to deploy any Docker container on the Akash Network with just a few clicks. 🚀

version license X (formerly Twitter) Follow Discord

Table of Contents

Quick Start

To get started with Akash Console, follow these steps:

git clone [email protected]:akash-network/console.git ./akash-console
cd akash-console
npm run dc:up:dev -- deploy-web 

This will start the deploy-web service in development mode with all the necessary dependencies (API, indexer, PostgreSQL). It will also import a backup of the sandbox database by default to speed up the process.

Applications

All services are Node.js applications written in TypeScript and deployed using Docker. Both databases are PostgreSQL.

  • Console: The main website for deploying on Akash, built using the Next.js framework. Data is fetched from a combination of our API and Akash nodes (REST).
  • Stats: The stats website built using Next.js, displaying the usage data of the Akash Network from the Indexer database.
  • Api: Provides data to the deploy website, fetching from our Indexer database.
  • Indexer: Fetches the latest blocks from RPC nodes and saves blocks & stats to our Indexer Database. For details on how the indexer works, see the Indexer README.
  • Provider Proxy: Used in the deploy website to proxy requests to providers. This is necessary since it's not possible to use the cert authentication system from the browser.

Running the Application

This document provides instructions on how to set up and run the application, including steps for manual database restoration and using Docker Compose for ease of setup.

Using Docker and Docker Compose

This project's service are deployed using Docker and Docker Compose. The following sections provide instructions for setting up and running the application using Docker Compose. All the Dockerfiles are using multi-stage builds to optimize the image build processes. Same files are used to build both development and production images.

There are 3 docker-compose files:

  • docker-compose.build.yml: Base file solely building production images for the services. It can be used to verify the same build process as in CICD.
  • docker-compose.prod.yml: This file is used to run the services in production mode. It also includes the database service which would fetch a remote backup and import it on init.
  • docker-compose.yml: The default file to run all the services in development mode with features like hot-reload.

Some commands are added to package.json for convenience.

npm run dc:build # Build the production images
npm run dc:up:prod # Run the services in production mode
npm run dc:up:dev # Run the services in development mode
npm run dc:down # Stop the services referencing any possible service

Note: you may pass any docker compose related arguments to the above commands. E.g. to only start deploy-web service in development mode:

npm run dc:up:dev -- deploy-web

This would also properly spin up all the dependencies like the api.

Using Turbo Repo

Another way to run apps in dev mode is using turbo repo setup. Some available commands are:

npm run console:dev # run console ui in dev mode with dependencies
npm run stats:dev # run stats ui in dev mode with dependencies
npm run api:dev # run api in dev mode with dependencies
npm run indexer:dev # run indexer in dev mode with dependencies

Note the above commands still depend on docker to run postgres database. If you need to run them without db you can use the following commands:

npm run console:dev:no-db # run console ui in dev mode with dependencies but without postgres in docker
npm run stats:dev:no-db # run stats ui in dev mode with dependencies but without postgres in docker

Manual Database Restoration

Due to the extensive time required to index Akash from block #1, it's recommended to initialize your database using an existing backup for efficiency. This approach is particularly beneficial for development purposes.

Available Backups

Restoration Steps

  1. Create a PostgreSQL database.
  2. Restore the database using psql. Ensure PostgreSQL tools are installed on your system.

For a .sql.gz file:

gunzip -c /path/to/console-akash-sandbox.sql.gz | psql --host "localhost" --port "5432" --username "postgres" --dbname "console-akash"

After restoring the database, you can proceed with the specific project's README instructions for further setup and running the application.

Services

This project is structured as a monorepo, allowing us to manage multiple related applications and shared packages in a single repository.

Dataflow between services

Shared Packages

We utilize a /packages folder to define reusable packages that can be shared between applications. This approach promotes code reuse, maintainability, and consistency across our services. Some examples of shared packages include:

  • Common utilities
  • Shared types and interfaces
  • Reusable UI components
  • Shared configuration files

By leveraging this monorepo structure with shared packages, we can efficiently manage dependencies, streamline development workflows, and ensure consistency across our various applications.

For more information on how to use or contribute to shared packages, please refer to the code within each package in the /packages directory.

Contributing

If you'd like to contribute to the development of Akash Console, please refer to the guidelines outlined in the CONTRIBUTING.md file.

License

This project is licensed under the Apache License 2.0.