Skip to main content

Version: 3.2.16.5

Deploy with Docker Compose

This guide will walk you through how to deploy API7 Enterprise Control Plane and Data Plane using Docker Compose.

ee-component-diagram

Prerequisites

  1. Install Docker Compose.

PostgreSQL (Optional)

Please skip this section if using external PostgreSQL.

On the host where you wish to deploy PostgreSQL, create a Compose file:

postgresql.yaml
name: postgresql

services:
postgresql:
image: bitnami/postgresql:15.3.0-debian-11-r0
hostname: postgresql
user: root
volumes:
- ./postgresql_data:/bitnami/postgresql
healthcheck:
test: ["CMD", "pg_isready", "-U", "api7ee"]
interval: 10s
timeout: 10s
retries: 3
start_period: 10s
environment:
POSTGRES_USER: api7ee
POSTGRES_PASSWORD: changeme
ports:
- "5432:5432"

volumes:
postgresql_data:
driver: local

❶ Map ./postgresql_data directory on the host to /bitnami/postgresql directory in the container. Please do not alter or delete the content of this directory.

❷ Configure the PostgreSQL username.

❸ Configure the PostgreSQL password. Please update the password for production use.

Start the container:

docker compose -f postgresql.yaml up -d

Suppose the current PostgreSQL server IP is 192.168.31.10. You should now be able to connect to the server at 192.168.31.10:5432.

Prometheus (Optional)

Please skip this section if using external Prometheus.

On the host where you wish to deploy Prometheus, create a Compose file:

prometheus.yaml
name: prometheus

services:
prometheus:
image: bitnami/prometheus:2.44.0-debian-11-r7
hostname: prometheus
user: root
volumes:
- ./prometheus_data:/opt/bitnami/prometheus/data
command:
- --config.file=/opt/bitnami/prometheus/conf/prometheus.yml
- --web.enable-remote-write-receiver
healthcheck:
test: ["CMD", "/opt/bitnami/prometheus/bin/promtool", "check", "healthy"]
interval: 10s
timeout: 10s
retries: 3
start_period: 10s
ports:
- "9090:9090"

❶ Map ./prometheus_data directory on the host to /opt/bitnami/prometheus/data directory in the container. Please do not alter or delete the content of this directory.

Start the container:

docker compose -f prometheus.yaml up -d

Suppose the current Prometheus server IP is 192.168.31.11. You should now be able to connect to the server at 192.168.31.11:9090.

API7 Deployment

In this section, you will be creating two configuration files, one for the Control Plane and the other for the Data Plane, and mount them when starting API7 Enterprise.

On the host where you wish to deploy API7 Enterprise, create a configuration file for the Control Plane:

dashboard_conf/conf.yaml
server:
listen:
disable: true
host: "0.0.0.0"
port: 7080
tls:
disable: false
host: "0.0.0.0"
port: 7443
key_file: ""
cert_file: ""
status:
disable: false
host: "127.0.0.1"
port: 7081

log:
level: warn
output: stderr

database:
dsn: "postgres://api7ee:changeme@192.168.31.10:5432/api7ee"

session_options_config:
same_site: "lax" # means the value SameSiteLaxMode
secure: false
max_age: 86400

prometheus:
addr: "http://192.168.31.11:9090"
whitelist:
- "/api/v1/query_range"
- "/api/v1/query"
- "/api/v1/format_query"
- "/api/v1/series"
- "/api/v1/labels"
- "/api/v1/labels/.*/values"
# basic_auth: # access the prometheus with basic-auth
# username: "" # Basic-auth username. If the username is empty, basic-auth authentication is not performed when requesting prometheus.
# password: ""
# tls:
# server_name: ""
# insecure_skip_verify: false
# enable_client_cert: false
# key_file: "" # the file path of the private key for requesting prometheus, (e.g. /app/prometheus/certs/tls.key)
# cert_file: "" # the file path of the certificate for requesting prometheus, (e.g. /app/prometheus/certs/tls.crt)
# ca_file: "" # the file path of the ca to verify the prometheus tls server. (e.g. /app/prometheus/certs/ca.crt)

consumer_proxy:
enable: false
cache_success_count: 512
cache_success_ttl: 60
cache_failure_count: 512
cache_failure_ttl: 60

❶ Configure PostgreSQL connection information.

❷ Configure Prometheus connection information.

On the host where you wish to deploy API7 Enterprise, create a configuration file for the Data Plane:

dp_manager_conf/conf.yaml
server:
listen:
host: "0.0.0.0"
port: 7900
tls:
host: "0.0.0.0"
port: 7943
status:
disable: false
host: "127.0.0.1"
port: 7901

log:
level: warn
output: stderr

database:
dsn: "postgres://api7ee:changeme@192.168.31.10:5432/api7ee"

prometheus:
addr: "http://192.168.31.11:9090"
# basic_auth: # access the prometheus with basic-auth
# username: "" # Basic-auth username. If the username is empty, basic-auth authentication is not performed when requesting prometheus.
# password: ""
# tls:
# server_name: ""
# insecure_skip_verify: false
# enable_client_cert: false
# key_file: "" # the file path of the private key for requesting prometheus, (e.g. /app/prometheus/certs/tls.key)
# cert_file: "" # the file path of the certificate for requesting prometheus, (e.g. /app/prometheus/certs/tls.crt)
# ca_file: "" # the file path of the ca to verify the prometheus tls server. (e.g. /app/prometheus/certs/ca.crt)

rate_limit:
enable: false
time_window: 1 # unit: second
count: 1000

❶ Configure PostgreSQL connection information.

❷ Configure Prometheus connection information.

Create a Compose file:

api7.yaml
name: api7

services:
api7-ee-dashboard:
image: api7/api7-ee-3-integrated:v3.2.16.4
hostname: dashboard
restart: always
volumes:
- ./dashboard_conf/conf.yaml:/usr/local/api7/conf/conf.yaml:ro
command:
- sh
- -c
- node server.js & /usr/local/api7/api7-ee-dashboard -c /usr/local/api7/conf/conf.yaml
ports:
- "7080:7080"
- "7443:7443"
healthcheck:
test: ["CMD", "nc", "-z", "127.0.0.1", "7443"]
interval: 10s
timeout: 5s
retries: 12

api7-ee-dp-manager:
image: api7/api7-ee-dp-manager:v3.2.16.4
hostname: dp-manager
restart: always
volumes:
- ./dp_manager_conf/conf.yaml:/usr/local/api7/conf/conf.yaml:ro
command:
- /usr/local/api7/api7-ee-dp-manager
- -c
- /usr/local/api7/conf/conf.yaml
ports:
- "7900:7900"
- "7943:7943"

Start API7 Enterprise:

docker compose -f postgresql.yaml up -d

Suppose the current API7 Enterprise server IP is 192.168.31.12. You should now find the Dashboard at https://192.168.31.12:7443 and the Control Plane at https://192.168.31.12:7943.

tip

The Control Plane address should be manually filled out on the Dashboard before deploying the Gateway, to ensure that the generated deployment script is correct. To find the Control Plane address configuration, go to Organizations > Settings > Gateway Settings > Deployment on the Dashboard.

High Availability

API7’s Dashboard and DP Manager are stateless services that can be replicated across multiple instances on various virtual machines, exposing services through a front-end load balancer to achieve high availability.

For more information, see API7 High Availability.

Gateway

See Add a Gateway Instance to learn how to add a new gateway instance.


API7.ai Logo

API Management for Modern Architectures with Edge, API Gateway, Kubernetes, and Service Mesh.

Product

API7 Cloud

SOC2 Type IIISO 27001HIPAAGDPRRed Herring

Copyright © APISEVEN Ltd. 2019 – 2024. Apache, Apache APISIX, APISIX, and associated open source project names are trademarks of the

Apache Software Foundation