Deployment Guide

Self-Hosting Guide

Deploy your own BMKG API instance with unlimited requests and full control over your data.

Choose Your Deployment Method

Docker (Recommended)

Recommended

The easiest way to get started. Pull a pre-built image from GitHub Container Registry or build from source.

Option A: Pull pre-built image from GHCR

Terminal
docker pull ghcr.io/dhanyyudi/bmkg-api:latest
docker run -d -p 8099:8099 ghcr.io/dhanyyudi/bmkg-api:latest

Option B: Build from source with Docker Compose

Terminal
git clone https://github.com/dhanyyudi/bmkg-api.git
cd bmkg-api
cp .env.example .env
docker-compose up -d

Verify Installation

curl http://localhost:8099/health

Vercel

Quick demo deployment. Has rate limits, for demo purposes only.

Deploy to Vercel

Or use Vercel CLI:

vercel --prod

Rate limited: 30 req/min on free tier

Manual Install

Full control with Python 3.12+ setup.

bash
pip install -r requirements.txt
python main.py

Requirements

Docker Method

  • Docker Engine 20.10+
  • Docker Compose 2.0+
  • 512MB RAM minimum

Manual Method

  • Python 3.12+
  • pip
  • virtualenv (recommended)

Optional: Redis

  • Redis 6.0+ (optional)
  • For response caching
  • Improves performance

Environment Variables

Configure your instance by editing the .env file

Variable Default Description
PORT 8099 Server port to listen on
REDIS_URL redis://redis:6379 Redis connection URL (optional)
LOG_LEVEL INFO Logging level (DEBUG, INFO, WARN, ERROR)
WORKERS 1 Number of worker processes
.env.example
# Server Configuration
PORT=8099
LOG_LEVEL=INFO
WORKERS=1

# Redis (optional - enables caching)
REDIS_URL=redis://redis:6379/0

# CORS (comma-separated origins)
CORS_ORIGINS=*

Deployment Tips

Production Deployment

Use a reverse proxy like Nginx or Traefik for SSL termination and load balancing in production.

Updating

For Docker: docker-compose pull && docker-compose up -d

Health Checks

The /health endpoint returns 200 when the API is ready. Use this for monitoring and container health checks.

Ready to Deploy?

Get started with your own BMKG API instance in minutes. Questions? Check the GitHub repository or API documentation.