Quick Installation
Prerequisites
Before you begin using AREX, please ensure that you have installed the following applications:
Docker and Docker Compose.
Installing AREX
Firstly, clone the AREX repository using the git command:
git clone --depth 1 https://github.com/arextest/deployments.git
cd deployments
Then, start AREX using docker-compose
.
# Start
docker-compose up -d
# Stop
docker-compose down -v
Alternatively, you can also start it using Docker Compose 2.0.
# Start
docker compose -f docker-compose-2x.yml up -d
# Stop
docker compose -f docker-compose-2x.yml down -v
Upon completion of the installation, all components including the UI, Services, Database will be automatically installed. There is only one instance of each component, detailed as follows:
Instance | Model Name | Description |
---|---|---|
1 | Scheduling Service (AREX-Schedule) | Used to send replay requests and retrieve all responses for comparison. |
1 | AREX-API | Provides all API interfaces for the AREX frontend page. |
1 | Storage Service (AREX-Storage) | Offers functionality for AREX Agent to save recordings and retrieve responses in a Mock manner. |
1 | AREX UI (AREX) | The AREX frontend interface. |
1 | MongoDB | Database for data storage and configuration management. |
1 | Redis | High-speed playback cache. |
You can check the running status and ports of each service by executing the command docker-compose ps
on the host machine running Docker.
[~ deployments]# docker-compose ps
Name Command State Ports
------------------------------------------------------------------------------------------
arex-front docker-entrypoint.sh node ... Up 0.0.0.0:8088->8080/tcp
arex-mongodb docker-entrypoint.sh --auth Up 0.0.0.0:27017->27017/tcp
arex-redis docker-entrypoint.sh --app ... Up 0.0.0.0:6379->6379/tcp
arex-api catalina.sh run Up 0.0.0.0:8090->8080/tcp
arex-schedule catalina.sh run Up 0.0.0.0:8092->8080/tcp
arex-storage catalina.sh run Up 0.0.0.0:8093→8080/tcp
Commands to check service logs:
docker-compose logs
docker-compose logs arex
docker-compose logs arex-schedule-service // Check Schedule Service logs
docker-compose logs arex-api // Check API Service logs
docker-compose logs arex-storage-service // Check Storage Service logs
Registering the Application
AREX Agent is the core component for implementing service recording and playback. Before conducting playback testing, it is necessary to configure the AREX Agent for the application under test. For more details, see: Registering Application.
AREX Deployment Scenarios
Single AREX Service Deployment Scenario
If the recording and replay environment, that is, the production and test environments, can communicate with each other or there is a tool Zone, then deploy a single AREX service. As shown in the diagram below, data is recorded in the production environment and stored in AREX (MongoDB), and then played back in the test environment.
Multi AREX Service Deployment Scenario
If the production and test environments cannot communicate with each other, meaning the recording environment and the replay environment are isolated, and the test environment cannot access the database in the production environment, then it is necessary to deploy multiple AREX services.
Deployment Modes
- Deploy AREX A in the production environment to record data, which is then stored in AREX (MongoDB).
- Deploy AREX B in the test environment for data playback.
- The DBA should unidirectionally synchronize database data from AREX A to AREX B.
- Record data with the application in the AREX A environment, and perform playback with the application in the AREX B environment.
Version Upgrade and Update
When starting AREX with Docker Compose, you can check the current version in the environment variable file .env
under the deployments repository. If you need to use a previous version, you can directly modify the AREX_VERSION
in this file.
Go to the directory where docker-compose.yml is located and stop the original service before updating:
cd deployments
docker-compose down -v
Note: If you do not wish to retain the existing MongoDB data or logs, manually delete the arex-data and arex-logs directories in the current running directory (please be cautious, as this action cannot be reversed!)
Update the deployments repository and restart AREX:
git pull
docker-compose up -d
Multi-instance installation
Above we demonstrate how to install all AREX components including AREX UI, services, database by using the docker-compose.yml
file provided by AREX.
If you want to install multiple instances according to your needs, you can use the provided docker-compose-distribute.yml
file for a simple Out-of-the-box setup. Run the following command:
git clone https://github.com/arextest/deployments.git
cd deployments
docker-compose -f docker-compose-distribute.yml up -d
# Stopping command
docker-compose -f docker-compose-distribute.yml down -v
# List running containers and their status
docker-compose -f docker-compose-distribute.yml ps
The default setup of the scheduling and storage service involves 2 instances, with the following specific components:
The default configuration of the scheduling service and storage service is 2 instances, with specific component instances as follows:
ID | Number of Instance | Model Name | Description |
---|---|---|---|
1 | 2 | Schedule Service | A set of schedule APIs that provide replay send and retrieve all responses for comparison. |
2 | 1 | API Service | Provides all the interfaces that AREX-Front needs to use. |
3 | 2 | Storage Service | A set of remote storage APIs that provide Agent Hook Service to save records and get responses as mocks. |
4 | 1 | AREX-Front | A visual web site that provide entry to all operations in your AREX. |
5 | 1 | MongoDB | Data storage and configuration management database |
6 | 1 | Redis | High-speed playback cache |
7 | 1 | Nginx | Schedule Load Balancing Services |
8 | 1 | Nginx | Storage Load Balancing Services |
You can modify the docker-compose-distribute.yml
configuration file to deploy multiple instances of the AREX service according to your needs.