---
title: "Deploy Kong API Gateway"
description: "Setup for Kong Gateway with PostgreSQL and Konga UI management."
category: "Other"
url: https://railway.com/deploy/Addl8t
---

# Deploy Kong API Gateway

Setup for Kong Gateway with PostgreSQL and Konga UI management.

**[Deploy Kong API Gateway on Railway](https://railway.com/template/Addl8t)**

- **Creator:** Fulvio's Projects
- **Category:** Other
- **Total deploys:** 81

## Template content

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:latest

### Kong API Gateway https://docs.konghq.com/assets/images/logos/konglogo-dark-theme.svg

- **Image:** kong:latest

### kong-migration

- **Image:** kong:latest
- **Start command:** `kong migrations bootstrap`

### konga

- **Image:** pantsel/konga:latest

## Documentation

## Overview

This setup provides a full environment for running Kong Gateway, a powerful and flexible API management solution, alongside PostgreSQL for database storage and Konga UI for a user-friendly web interface to manage Kong.

## Services Description

### 1. kong-database
- **Image**: postgres:latest
- **Description**: This service runs a PostgreSQL database that stores Kong Gateway's configuration and runtime data.
- **Environment Variables**: 
  - `POSTGRES_USER`: User for PostgreSQL (default: kong)
  - `POSTGRES_DB`: Database name for PostgreSQL (default: kong)
  - `POSTGRES_PASSWORD`: Password for PostgreSQL (default: kong)
- **Ports**: Exposes port `5432`
- **Volumes**: Uses a named volume `kong-data` to persist data
- **Health Check**: Ensures PostgreSQL is ready before other services start

### 2. kong-migration
- **Image**: kong:latest
- **Description**: A temporary service that initializes the database by running Kong migrations.
- **Environment Variables**: 
  - `KONG_DATABASE`: Database type (postgres)
  - `KONG_PG_HOST`: Host of PostgreSQL service (kong-database)
  - `KONG_PG_USER`: User for PostgreSQL (same as POSTGRES_USER)
  - `KONG_PG_PASSWORD`: Password for PostgreSQL (same as POSTGRES_PASSWORD)
- **Command**: Runs `kong migrations bootstrap` to set up the database schema
- **Depends On**: Waits for `kong-database` to be healthy before starting

### 3. kong
- **Image**: kong:latest
- **Description**: The main Kong Gateway service that manages and routes APIs.
- **Environment Variables**: 
  - Various configurations for logging, admin API listening, and database connection
  - `KONG_DATABASE`: Database type (postgres)
  - `KONG_PG_HOST`: Host of PostgreSQL service (kong-database)
  - `KONG_PG_USER`: User for PostgreSQL (same as POSTGRES_USER)
  - `KONG_PG_PASSWORD`: Password for PostgreSQL (same as POSTGRES_PASSWORD)
- **Ports**: Exposes ports `8000`, `8443`, `8001`, and `8444` for proxy and admin API
- **Health Check**: Ensures the Kong service is operational

### 4. konga
- **Image**: pantsel/konga:latest
- **Description**: Konga provides a web interface to manage Kong Gateway.
- **Environment Variables**: 
  - Configuration for connecting to the PostgreSQL database
  - `DB_ADAPTER`: Database adapter (postgres)
  - `DB_HOST`: Host of PostgreSQL service (kong-database)
  - `DB_USER`: User for PostgreSQL (same as POSTGRES_USER)
  - `DB_PASSWORD`: Password for PostgreSQL (same as POSTGRES_PASSWORD)
  - `DB_DATABASE`: Database name (same as POSTGRES_DB)
  - `NODE_ENV`: Environment mode (production)
- **Ports**: Exposes port `1337` for accessing the Konga UI
- **Health Check**: Ensures the Konga service is operational

## Getting Started

1. **Clone the Repository**: Download the project to your local machine.
2. **Create a .env File**: Add the following environment variables in a `.env` file:
   ```env
   POSTGRES_USER=kong
   POSTGRES_DB=kong
   POSTGRES_PASSWORD=kong
   ```
3. **Start the Services**: Use the command `docker-compose up -d` to start all services.

## Access Points

- **Kong Admin API**: Available at `http://localhost:8001` and `https://localhost:8444`
- **Konga UI**: Available at `http://localhost:1337`

## Volumes

- **kong-data**: This named volume persists PostgreSQL data to ensure it survives container restarts.

## Health Checks

- Each service is equipped with health checks to verify their operational status and facilitate automatic recovery.

This setup ensures a robust and easy-to-manage environment for API management using Kong, with PostgreSQL for data storage and Konga UI for streamlined administration.

## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — [Jul'26] Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/Addl8t
