Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

🚀 Coin Gen AI Layer — Full Setup Guide (Local + Coolify + Redis)


🧠 Overview

This project is a FastAPI backend that:

  • Scrapes & discovers trends
  • Uses AI for topic extraction
  • Caches results in Redis
  • Runs scheduled background jobs

🏗️ Architecture

User → Coolify (Traefik) → FastAPI App → Redis
                             ↓
                         Scheduler + AI

⚙️ Requirements

  • Linux VPS (Ubuntu recommended)
  • Docker installed
  • Domain (optional for HTTPS)

🐳 Install Docker (if not installed)

sudo apt update
sudo apt install -y docker.io docker-compose
sudo systemctl enable docker
sudo systemctl start docker

🚀 Install Coolify (Self-Hosted)

We use the official install script (internally uses Docker Compose).

curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash

📍 After install

Open in browser:

http://YOUR_SERVER_IP:8000

Create admin account → dashboard ready ✅


🧠 What Coolify installs

  • Traefik (reverse proxy)
  • PostgreSQL (Coolify DB)
  • Redis (internal services)
  • Coolify backend

All managed via Docker automatically.


🧪 Verify installation

docker ps

You should see containers like:

  • coolify
  • coolify-db
  • coolify-redis

📦 Deploy Redis (App Cache)

  1. Go to Coolify Dashboard
  2. Add Resource → Redis
  3. Click Deploy
  4. Copy Redis URL (internal)

Example:

redis://redisAdmin:password@redis-database-xxxxx:6379

🚀 Deploy Application

1. Add App

  • Add Resource → Application → Public Repository
  • Repo:
https://github.com/Dev-kaif/Coin-gen-ai-layer

2. Configure

Setting Value
Build Pack Dockerfile
Port 8000

3. Environment Variables

REDIS_URL=redis://username:password@redis-host:6379
GOOGLE_API_KEY=your_google_api_key
TREND_TTL_SECONDS=900

4. Network Fix (IMPORTANT)

Ports Exposes: 8000
Port Mappings: (leave empty)

5. Deploy

Click:

Deploy

🌐 Access App

http://your-domain/docs

🔐 HTTPS Setup

⚠️ sslip.io is rate-limited for SSL

👉 Use your own domain:

DNS Setup

Type: A
Name: @
Value: YOUR_SERVER_IP

Then in Coolify:

  • Add domain
  • Enable SSL
  • Redeploy

🐳 Local Docker Setup (Alternative)

Build

docker build -t coin-app .

Network

docker network create coin-network

Redis

docker run -d \
  --name redis \
  --network coin-network \
  redis:alpine

App

docker run -d \
  -p 8000:8000 \
  --name coin-app \
  --network coin-network \
  -e REDIS_URL=redis://redis:6379 \
  -e GOOGLE_API_KEY=your_key \
  coin-app

🔍 Health Check (Recommended)

@app.get("/health")
async def health():
    return {"status": "ok"}

Coolify config:

/health

🧠 Redis Usage

Key Purpose
trends: Cached data
trends:ranking Sorted ranking
trends:history Momentum tracking

⚠️ Common Issues

Bad Gateway

  • Fix port → 8000
  • Match Ports Exposes

Redis not connecting

  • Use redis://... NOT localhost

Google API 429

  • Rate limit hit
  • Reduce frequency or upgrade plan

🚀 Production Tips

  • Use custom domain + SSL
  • Increase scheduler interval
  • Add retry logic for APIs
  • Monitor logs

🎯 Status

✅ Dockerized ✅ Redis integrated ✅ Coolify deployed ✅ Public API


👨‍💻 Author

Built by Dev-kaif 🚀

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages