The purpose of this article is to describe how to update the backend (API) of HUMBLE.
Environments
There are several HUMBLE backend environments. All the environments are available as a container service (ECS) in AWS. Below the list of environments
URL API endpoint | Cluster | Service |
---|---|---|
prd-api.humble-online.com | Humble-multi-tenant | |
acc-api.humble-online.com | Development | |
test.humble-online.com | HUMBLE-Development | |
cwd-prd-api.humble-online.com | CroonWolterenDrosProductieOmgeving |
Goto AWS to the Elastic Container Service (ECS) to see all the clusters and there details https://eu-west-1.console.aws.amazon.com/ecs/home?region=eu-west-1#/clusters
Branches
Before the update can be performed the latest version of the code must be committed to the appropriate branch.
Three branches are used:
develop
master
release/release-XXXX
When committing to these branches a automatic pipeline is started. The pipeline will create a new ECR Repository and places it in the AWS Elastic Container Registry
URL | Repository directory name | |
---|---|---|
humble-master | ||
acc-api.humble-online.com | humble-release | |
test.humble-online.com | humble-development |
Each commit creates a new repository file in the repository directory name as described. The Repo file is tagged with the commit number and pipeline id.
Pipelines
Pipelines are running automatically and can also be started by hand.
branch | Pipeline | Description |
---|---|---|
develop | build_and_deploy_test_api | Creates ECR Repo and restarts the ECS Service and task automatically. Every night at 3 am the latest version will be deployed automatically. |
release | build_and_deploy_acc_api | Creates ECR Repo and restarts the ECS Service and task automatically |
master | master | Creates ECR Repo only. ECS Service and task is not automatically restarted |
publish_to_escrow |
Restart an ECS Service / Task
On the production API the new version must be installed by restarting the ECS Service and task.
Go to AWS ECS
Go to the cluster
Click on the Tab sheet Tasks
Check the checkbox and click on the Stop button
Read the popup message and click again on the red Stop button
The tasks will be stopped and restarted, the latest version of the ECR Repo will be loaded
Synchronize the database structure and data
The master database contains a set of data that must be synchronised with all the different environments. During the startup of the backend API the synchronise will be performed.
Between 00-06:00 am a complete synchronisation is performed meaning database structure and data.
Outside these times only the structure will be updated.
Synchronize data during the day
When new data is added to the Master database and the other API’s have to be synchronised an employee must do this by hand.
Startup the VPN
Different VPN for HUMBLE and for the CWD environment
Both are using the same SSH key : DGKey1.pem
Default user is : ec2-user
Create an SSH connection to the instance where the cluster is running on
The instance can be found on the tabsheet ECS instances at the ECS Cluster
Click in the ECS instance name in the grid
This will open the EC2 grid
Check the checkbox
The IP addresses are shown
Command : docker ps
Get the CONTAINER ID number
Command : docker exec -it <CONTAINER_ID> bash
Now you are in the container
Perform on of the commands
syntax : php index.php sysadmin/db_builder command <api_url> <debugmode>
php index.php sysadmin/db_builder checkdatabase <api_url> false
structure only
php index.php sysadmin/db_builder doall <api_url> false
structure and data (takes approx an hour)