# Self-host Kong Gateway

> An API gateway in database-less mode on the open source image. Load routes with the admin API at kong:8001 from inside this project. With no routes the proxy answers 404, which is the healthy state.

- Page: https://levelrail.com/templates/kong/
- JSON: https://levelrail.com/templates/kong.json
- Category: Infrastructure
- Licence: Apache-2.0 (Permissive license)
- Source: https://github.com/Kong/kong
- Upstream docs: https://docs.konghq.com/gateway/latest/

## Requirements
- Memory: about 512 MiB
- amd64: unknown, arm64: unknown
- Needs configuration before start: no
- Pinned image tag: 3.8.0

## Services

| Service | Image | Tag | Ports | Volumes |
| --- | --- | --- | --- | --- |
| kong | kong | 3.8.0 | 8000, 8001 | none |

## Environment

| Service | Variable | Kind |
| --- | --- | --- |
| kong | KONG_ADMIN_ACCESS_LOG | preset |
| kong | KONG_ADMIN_ERROR_LOG | preset |
| kong | KONG_ADMIN_LISTEN | preset |
| kong | KONG_DATABASE | preset |
| kong | KONG_PROXY_ACCESS_LOG | preset |
| kong | KONG_PROXY_ERROR_LOG | preset |
| kong | KONG_PROXY_LISTEN | preset |

## Deploy

### CLI

```bash
levelrail-cli templates deploy kong --name my-kong
```

### API

```bash
curl -X POST -H "Authorization: Bearer $TOKEN" \
  https://levelrail.example.com/api/v1/service-templates/kong/deploy
```

Create a token in the dashboard first. This one-click route deploys it as a trial app you can keep or remove.

## First run
1. Post a declarative config to kong:8001/config from a service in this project, then send traffic to the public address.

## Questions

### Can I deploy Kong Gateway on Dokploy or Dokku?

The services and pinned images on this page can be run on any Docker host. The public Dokploy templates list we compared does not have an entry with the same id for Kong Gateway, so on Dokploy you would use a Docker Compose application with the file from this page. Dokku deploys container images with its own commands, so the pinned image kong:3.8.0 is what you deploy there.

Self-host Kong Gateway, Kong Gateway docker compose file, deploy Kong Gateway on a VPS: this page lists the pinned image, ports, volumes and the commands for each.
