Overview#
This guide outlines the procedure for deploying a clustered Apidog environment using Docker. This architecture employs Nginx as a reverse proxy and load balancer to distribute traffic across multiple Apidog application nodes, ensuring higher availability and horizontal scalability.Requirements & Prerequisites#
To successfully deploy a multi-node cluster, your infrastructure must meet the following requirements:System Requirements#
Docker Version 20.10.0 or higher is required. We recommend the latest stable release (e.g., 26.x).Verify version: docker --version
Hardware & Software: For hardware and software requirement, please refer to the System Requirements documentation. External Dependencies#
Docker Registry Access: Ensure you have the Access Token (received via email) to pull the private image.
Preparation: Image Pull#
Authenticate with Docker Hub using the credentials provided by the Apidog support team to access the private enterprise image.1.
Log in to Docker Hub manually to verify credentials
2.
Pull the Image
Enter your Access Token (password) when prompted for the password and pull the specific image tag:
Database Initialization#
This guide utilizes a MySQL database. If you are using PostgreSQL, please refer to the PostgreSQL Guidelines Apidog does not automatically create the database. You must manually connect to your database instance to initialize the database. Once connected, execute:Apidog Node Setup#
Deployment Script#
Step 1: Create the startup script run-apidog.sh.Step 2: Press i to enter insert mode and paste the following content, ensuring you populate the environment variables with your external database credentials. For more information on the environment variables and how to configure them, please refer to the Environment Variables guide. Save and exit (:wq).Step 3: Execute the script to start the application node.Gateway & Load Balancer Setup (Nginx)#
This section configures an Nginx container to handle SSL termination and distribute traffic to the backend nodes configured in Section 2.Nginx Gateway Setup#
Step 1: Create an initialization script init-nginx.sh.Step 2: Press i to enter insert mode and paste the following contents, then save and exit (:wq).Step 3: Execute the script.Step 4: Copy the configuration files to your host.SSL Configuration#
Prepare your SSL certificates for secure HTTPS access.Step 1: Create the certificate directory:Step 2: Add your certificate and key files:Load Balancer Configuration#
Modify the Nginx default.conf to define the upstream backend pool.Press i to enter insert mode, and replace the file content with the configuration below. Ensure the upstream backend block contains the IP addresses and ports of the Apidog nodes.Start the Gateway#
Create the production startup script for Nginx using the mounted configurations.Press i to enter insert mode and paste the following contents. Save and exit (:wq)Finally, execute the script:Updating Apidog#
Initial deployments, along with subsequent system upgrades, may necessitate modifications to the database schema or involve data migration procedures. It is critical to note that these migration tasks are not designed to be executed concurrently.
To mitigate potential issues, it is advisable to deploy a dedicated container specifically for performing the upgrade operations. Once the migration is successfully completed, the containers responsible for handling live traffic can be updated accordingly.
Run the application#
To run the application, refer to the documentations:Other Resources#