Skip to content

alikarim/akash-ssh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Akash SSH Boilerplate

This boilerplate showcases the deployment of an application on the Akash Network with SSH capabilities. It features two services: the app and the bastion host. These services facilitate secure access to the application container.

Prerequisites

Public Docker Repository

Akash does not support private Docker repositories. Create a public repository on Docker Hub if you don't already have one.

Akash Network

Learn more about the Akash Network at the Akash Guidebook.

Create .env File

Create a .env file with the following variables:

ACCOUNT=<docker account>
APP_REPOSITORY=<docker repository>
APP_TAG=<docker image tag>
BASTION_HOST_REPOSITORY=<docker repository>
BASTION_HOST_TAG=<docker image tag>
SSH_USER=<ssh user>
SSH_PORT=<ssh port to be exposed>
SSH_PUBLIC_KEY=<ssh public key>
SUBNET=<custom subnet for docker network e.g., 172.30.0.0/16>

Commands

You can use the provided Makefile for easy execution of the following commands. Alternatively, you can run each command manually.

Generate SSH Key

mkdir -p ssh
ssh-keygen -t rsa -b 4096 -C '' -f ./ssh/id_rsa -q -N ''
chmod 400 ./ssh/id_rsa

Build

docker-compose build --no-cache

Push Docker Image to Remote Repository

docker-compose push

Run Docker Containers Locally

docker-compose up

Stop Docker Containers

docker-compose down

Get Docker Container IP

docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container>

SSH into the Bastion Host

eval `ssh-agent -s`
ssh-add ./ssh/id_rsa
ssh -A <ssh user>@<provider> -p <provider generated port>

SSH into the Application Container from the Bastion Host

ssh root@<container name> -p <SSH_PORT>
ssh root@app -p 2022

Generate SDL File

This command generates a new SDL file in the deploy folder.

make sdl

Example

The following commands create SSH keys, build Docker images, push them to the Docker repository, and generate a new SDL file.

make ssh-key  # Generates SSH keys and updates .env file
make build
make push
make sdl      # Creates a new SDL file in the deploy folder

Use this boilerplate to deploy your application securely on the Akash Network with SSH access.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published