Athina Self Hosting Guide

The example below is for Azure, but similar steps can be followed for other cloud providers.

Prerequisites

  • Create a VM with at least 64GB of free disk space, 16GB of RAM, and 4 CPUs. Assign a public DNS to the instance as well.
  • SSH into the instance and set up the following:
  • Obtain Athina GitHub access credentials.
  • Obtain Athina ECR access credentials (AWS CLI is required).

Core Services Setup

  • Clone the athina-deploy repository (ensure all Athina project folders are at the same directory level):
    git clone https://github.com/athina-ai/athina-deploy
    
  • Copy .example.env to .env.
  • Populate the respective values. Some default values and keys are provided. You can change them if needed. The DB Name can remain as it is.
  • Create a Google OAuth client for Google login (Google Sign-In Documentation). Ensure you set the correct redirect URI and authorized domain (:9000/auth/google/redirect).

Transactional Emails (Optional)

  • We use Loops for transactional emails like user invitations, OTP sending, and downloading exported data.
  • Create a free account and obtain the API key from the Loops dashboard.
  • Create three transactional email templates:
    • User invitation email:
      • Data variables: inviterName and invitedEmail
    • OTP email:
      • Data variable: otp
    • Data export email:
      • Data variable: s3_link

Services Creation

  • Log in to ECR using credentials:
aws ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin 867387325299.dkr.ecr.eu-central-1.amazonaws.com
  • Pull the required images:
docker-compose --profile core --profile worker pull
  • Update the .env file in athina-deploy with the endpoint and API key obtained in the previous step.
  • Run the following command:
docker-compose --profile core --profile worker up -d
  • Wait for all services to start.

Dashboard

  • Clone the athina-dashboard repository:
git clone https://github.com/athina-ai/athina-dashboard
  • Copy the following to .env:
# API URL
NEXT_PUBLIC_API_URL=
# Frontend URL
NEXT_PUBLIC_ATHINA_BASE_URL=
  • Set them to the correct values.
  • Run the following commands:
npm install --legacy-peer-deps
npm run build
bash script.sh start
  • Navigate to http://<IP/DOMAIN>:3000/login.

Updates

You can use the athina.sh for starting, stopping, updating and restarting the services in docker-deploy.

bash athina.sh start # Start the services
bash athina.sh stop # Stop the services
bash athina.sh pull # Pull the latest images
bash athina.sh update # Update the services
bash athina.sh restart # Restart the services

Post Installation

You can edit few configurations in the database to customize the platform. Particularly, you can set the domain in the org table. If you populate the domain column all subsequent users signing up using the same domain will be automatically be added to the same org, instead of creating a new org.

-- Replace 'your_org_id' with the actual org_id
SELECT id FROM org;

-- Query for setting your domain so that further users signing up will be added to your org
UPDATE org SET domain = 'your_domain' WHERE id = 'your_org_id';

-- Set max_evals_per_month to 1000.
UPDATE org SET max_evals_per_month = 1000 WHERE id = 'your_org_id';

-- Paywall org config updated with allowed team members
UPDATE paywall_org_config SET allowed_team_members = 25 WHERE org_id = 'your_org_id';