Docker Remote APIIntroduction and practical sharing:HaproxyRemote management

Release time:2022-01-18 12:27:11 Number of views:227

be familiar withDockerMy friends all know that,DockerIt is possible to enable remote controlAPIof,Default listeningTCP 2375port,It has a very rich range of interface methods,Can be used for remote controlDocker DaemonTo do many operations。DockerVersion iteration is fast,Therefore, different versions of the official also provide different versions ofAPIdocument,This article is mainly based on the latestv1.40Briefly introduce some common operations and best practices。


one、installDocker

Centos The system can be directly usedyumCommand online installation,You can refer to the official documentation for details,Below is a list ofLinuxA universal online installation method for the system:


1、Foreign hosts:

curl -sSL https://get.docker.com | sh

2、Domestic hosts:

curl -sSL https://get.daocloud.io/docker | sh

For more installation methods of the system, please refer to the documents compiled by predecessors,After successful installation,Executable docker info、docker version、docker ps Wait for the command to test if it is normal,The specific process will not be elaborated further。


3、Mirror acceleration

If it is a domestic host,In order to make the subsequent practical operations smoother,You can configure it hereDaoCloudProvidedDockerMirror acceleration,Execute as follows2Commands are sufficient:


# Configuration accelerationcurl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io# restartDockersystemctl restart docker

two、EnableAPI

To ensure safety,DockerRemote will not be enabled by default after installationAPIservice,Because this service does not perform permission authentication by default。This article is mainly for practical sharing,And it is used for internal network production environment,There will be security guarantees,If it is an external production environment, it is recommended to do a good jobiptablesSecure reinforcement or burn or use immediately after useTLSSecurity certification,Not shown here。


The activation method is relatively simple,Only share hereCentOS 7System Enabling Steps:


1、Modify configuration:

vi /lib/systemd/system/docker.service

findExecStartConfiguration items,The default is as follows:


ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Insert listening options in it:-H tcp://0.0.0.0:2375(If it is an internal network production environment,Please add0.0.0.0Change to internal networkIP),Finally, for:


ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375 --containerd=/run/containerd/containerd.sock

2、restartDocker:

systemctl daemon-reloadsystemctl restart docker

3、View Results,The following is considered successful:

[root@centos ~]# netstat -nutlp | grep 2375tcp6       0      0 :::2375                 :::*                    LISTEN      3586/dockerd

4、checkAPIversion:

[root@centos ~]# docker versionClient: Docker Engine - CommunityVersion:           19.03.2API version:       1.40  # Local machineDockerAs the client versionGo version:        go1.12.8Git commit:        6a30dfcBuilt:             Thu Aug 29 05:28:55 2019OS/Arch:           linux/amd64Experimental:      falseServer: Docker Engine - CommunityEngine:Version:          19.03.2API version:      1.40 (minimum version 1.12) # Local machineDockerAs a server-side versionGo version:       go1.12.8Git commit:       6a30dfcBuilt:            Thu Aug 29 05:27:34 2019OS/Arch:          linux/amd64Experimental:     falsecontainerd:Version:          1.2.6GitCommit:        894b81a4b802e4eb2a91d1ce216b8817763c29fbrunc:Version:          1.0.0-rc8GitCommit:        425e105d5a03fabd737a126ad93d62a9eeede87fdocker-init:Version:          0.18.0GitCommit:        fec3683

three、Docker APIPreliminary Exploration

After completing the above steps,DockerIt already supports remote control,Let's first refer to the official documentation and try pulling up an image(The following operations are all completed locally,thereforeIPAll are127.0.0.1):


1、callAPIPullingcentosLatest Mirror:

curl -XPOST "http://127.0.0.1:2375/v1.40/images/create?fromImage=centos&tag=latest"

2、callAPICreate a container,Specify a front-end blocking command tail -f /dev/null:

curl -H "Content-Type: application/json" http://127.0.0.1:2375/containers/create?name=demo1 -d '{"Image": "centos:latest","HostConfig": {"NetworkMode": "host","Binds": ["/tmp:/tmp"]},"Cmd": ["tail","-f","/dev/null"]}'

Successfully returned as follows:


{"Id":"b88c7c986ecd5fdf174f79b00e024087b47241cd40653bcb05df70fba5cc398f","Warnings":[]}

3、callAPIStart the newly created container:

# Can use the previous step to returnidTo start:curl -XPOST http://127.0.0.1:2375/containers/b88c7c986ecd5fdf174f79b00e024087b47241cd40653bcb05df70fba5cc398f/start# You can also use the container name defined in the previous stepdemo1To start:curl -XPOST http://127.0.0.1:2375/demo1/start

4、View containers in startup:

[root@centos ~]# docker ps | grep demo1ed9f2150f8d5        centos:latest       "tail -f /dev/null"   About a minute ago   Up About a minute                       demo1

5、Calling containers to execute commands:

callAPI,For existing containersdemo1Create Command Instance:


curl -H "Content-Type: application/json" http://127.0.0.1:2375/containers/demo1/exec -d '{  "AttachStdin": false,"AttachStdout": true,"AttachStderr": true,"DetachKeys": "ctrl-p,ctrl-q","Tty": false,"Cmd": ["sh","-c","date | tee /tmp/test_exec.log"],"Env": ["FOO=bar","BAZ=quux"]}'

The return result is a command instanceId:


{"Id":"08552937782f6c5b696454d5524b140337fb0652d5f39142ac57ceaf46732bb4"}

Continue callingAPIStart this command instance:


curl -XPOST -H "Content-Type: application/json" http://127.0.0.1:2375/exec/08552937782f6c5b696454d5524b140337fb0652d5f39142ac57ceaf46732bb4/start  -d '{             "Detach": false,"Tty": false}'Fri Oct  4 03:21:36 UTC 2019

As mentioned above, adateEchoing of commands,And it will be mounted on the/tmpCatalog generationtest_exec.logtext,The content is consistent with the previous step's echo:


[root@centos ~]# cat /tmp/test_exec.log Fri Oct  4 03:21:36 UTC 2019

Indicates that the command was successfully executed!


The above steps,A simple demonstrationDocker APICommon scenarios,It can be said thatDocker APIGreatly simplified operation and maintenance work,For example, as we often sayCI/CDYou can no longer rely on itsshChannel or self builtagentNow,One interface can handle the entire lifecycle of an application,He is simply the savior of operations and maintenance!


Ps:moreDocker APIThe usage of can refer to official documents。


four、Python-SDKPreliminary Exploration

DockerIt's so popular,Definitely not without language matchingSDK,The most commonly used high-level language for operations and maintenance isPython,So here's a brief introductionDockerofPython SDK,And use itPythonofSDKTo implement the previous textAPIThe tedious operation of:


1、installSDK:

# If notpip,Install firstpip:yum install python-pippip install --upgrade pip# installSDKpip install docker

2、A few lines of code can complete the tedious process of the third step:

# -- coding: utf8 --import docker# initialization,Here, based on the goaldockerVersion ExecutionAPIversion,If an error occurs later, it is necessary to adjust this to the same or lower version of the targetclient = docker.DockerClient(version='1.40', base_url='tcp://127.0.0.1:2375')# Pull imageclient.images.pull('centos:latest')# Pulling up the containerclient.containers.run(image='centos:latest', name='demo1', command='tail -f /dev/null',volumes={'/data': {'bind': '/tmp', 'mode': 'rw'}}, detach=True)# First, obtain the object through the container namecontainer = client.containers.get('demo1')# Execute commands through objectsresult = container.exec_run(cmd='sh -c "date | tee /tmp/test_sdk.log"', detach=False, tty=True, stdin=True, stdout=True)# Output the return code and result of executing the commandprint(result.exit_code)print(result.output.decode())

Save the above code as test_sdk.py,implement python test_sdk.py View results later:


[root@centos ~]# python test_sdk.py 0Sun Oct  6 01:48:58 UTC 2019[root@centos ~]# cat /data/test_sdk.log Fri Oct  4 03:35:14 UTC 2019

adoptSDKOperation demonstration,It is evident that the operation steps have been greatly simplified,The overall process becomes smoother!


Ps:For more gameplay, please refer to the official documentation。


five、actual combatHaproxyRemote management

Practical proof from the previous text,With itDocker Remote APIThis maintenance tool(passageway),Many traditional operation and maintenance methods can be innovated,Here's a brief introduction,How do we utilizeDocker Remote APITo achieveHaoproxyRemote management of(All code and images have been uploaded toGitHubandDockerHub)。


1、Introduction to Principles

first,We build aHaporxyConfigure centralized management services,Used for interface managementHaproxyallocation,And provide an interface that can be pulled to the specified configuration content,such as:


curl -s --max-time 120 --retry 3 -w %{http_code} -o 192.168.1.100.cfg http://192.168.1.1/haproxy/192.168.1.100

then,stayHaproxyIntegrate one in the imageshellscript,Used for pulling、comparison、updateHaproxyConfiguration file for。


last,Remote callDocker Remote API implementHaproxyInside the containershellScript updateHaproxyallocation,If the update is successful, continue to callDocker API heavy loadHaproxyallocation,You can complete it nowHaproxySmooth update of configuration。


2、Quickly build central configuration management services

To quickly demonstrate the effect,Directly use hereNginxDeploy aHaproxyConfiguration download service,In practical use, it is necessary to build a more comprehensive management platform。


# installNginxyum install -y nginx# start-upNginx/sbin/nginx# Create a minimalisthaproxyconfiguration filecat > /usr/share/nginx/html/127.0.0.1 <<EOFglobalnbproc 1pidfile /usr/local/haproxy/logs/127.0.0.1.piddefaultstimeout connect  300stimeout client   300stimeout server   300slisten admin_statbind 0.0.0.0:8080mode httpstats refresh 60sstats uri /haproxystats auth admin:123456stats admin if TRUE################################################## status end ###############################################EOF# Request testing,The above content is considered successfulcurl http://127.0.0.1/127.0.0.1

3、makeHaproxyimage:

This is directly based on the official image,Additional integration for updatingHaproxyConfiguration scripts and some commonly used commands(curl、vim、ps):


DockerfileThe content is as follows:


FROM haproxy:latestRUN apt-get update \&& apt-get install -y curl vim procps \&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=falseCOPY update_cfg.sh /opt/COPY docker-entrypoint.sh /CMD ["haproxy","-f","/etc/haproxy.cfg"]

update_cfg.sh Used for downloading、comparison、updateHaproxyallocation,grammar、The logic is relatively simple,Interested parties can take a look:


#!/bin/bashsource /etc/profileif [ -z $VIP ];thenecho 'ENV ${VIP} is not SET, Plz check!'exit 1fi# Define and create storage directoryetc_dir=${STORAGE_DIR:-/usr/local/haproxy/etc}temp_dir=${etc_dir}/tempback_dir=${etc_dir}/backupmkdir -p ${back_dir} ${temp_dir}# Define the configration filecurrent_cfg=${etc_dir}/${VIP}.cfgbackup_cfg=${back_dir}/${VIP}_$(date +%F-%H%M%S).cfgtemp_cfg=${temp_dir}/${VIP}.cfg# Define file download configrationcurl_bin=$(which curl)cfg_manage_api=${CFG_GET_URL:-http://your_haporxy_download_svr/haproxy/}${VIP} # Here, it is necessary to modify the address based on the actual situation of the configuration management service# console logreport_log(){echo "[$(date '+%F %H:%M:%S')] $*"}# backup current configration filebackup_cfg(){if [ -f ${current_cfg} ];thencp -a ${current_cfg} ${backup_cfg} && \report_log "Backup ${current_cfg} to ${backup_cfg} success." || \report_log "Backup ${current_cfg} to ${backup_cfg} failed."elsereport_log "${current_cfg} is not exist, maybe the first release, skiped."fi}# update current configration filecover_cfg(){   if [ -f ${temp_cfg} ];thencp -a ${temp_cfg} ${current_cfg} && \report_log "Cover ${temp_cfg} to ${current_cfg} success." || (report_log "Cover ${temp_cfg} to ${current_cfg} failed."exit 1)elsereport_log "${temp_cfg} is not exist, Unknow Error, exited."exit 1fi}# download latest configration file from download svrdownload_cfg(){report_log "Starting Download configration file to ${temp_cfg} ..."ret_code=$(${curl_bin} -s --max-time 120 --retry 3 -w %{http_code} -o ${temp_cfg} ${cfg_manage_api})if [ $ret_code -eq 200 ] && [ $? -eq 0 ];thenreport_log "Download configration file ${temp_cfg} success."elsereport_log "Download configration file ${temp_cfg} failed."exit 1fi}# check the latest configration check_cfg(){old_md5=$(test -f ${current_cfg} && md5sum ${current_cfg} | awk '{print $1}' 2>/dev/null )new_md5=$(md5sum ${temp_cfg}|awk '{print $1}')if [ "$old_md5" = "$new_md5" ];thenreport_log "The configuration file ${VIP}.cfg is the same, no need update."return 2fiif haproxy -c -W -f ${temp_cfg} >/dev/null ;thenreport_log "Configuration file ${temp_cfg} is valid."return 0elsereport_log "Configuration file ${temp_cfg} is invalid."return 1fi}download_cfgif check_cfg;thenbackup_cfgcover_cfg && \report_log "${current_cfg} is updated success!"elseexit $?fi

docker-entrypoint.sh Change fromHaproxyOfficial image,Added support to the default logical blockVIPJudgment of environmental variables、Updating and downloading configuration files、Establishment of configuration file soft link、Configure syntax validation and other logic:


#!/bin/sh# first arg is `-f` or `--some-option`if [ "${1#-}" != "$1" ]; thenset -- haproxy "$@"fiif [ "$1" = 'haproxy' ]; thenif [ -z $VIP ];thenecho echo "[$(date '+%F %H:%M:%S')] ENV \${VIP} is not SET, Plz check!"exit 1fibash /opt/update_cfg.shln -sf /usr/local/haproxy/etc/${VIP}.cfg /etc/haproxy.cfghaproxy -W -c -f /etc/haproxy.cfg || (echo "[$(date '+%F %H:%M:%S')] Haproxy Configuration file check failed, Plz check!"exit 1)shift # "haproxy"# if the user wants "haproxy", let's add a couple useful flags#   -W  -- "master-worker mode" (similar to the old "haproxy-systemd-wrapper"; allows for reload via "SIGUSR2")#   -db -- disables background modeset -- haproxy -W -db "$@"fiexec "$@"

After preparing the above documents,Execute the following command in the same level directory of the file to buildHaproxyimage(Actually, this step can also be achieved throughAPITo operate,I won't go into further detail here,See official documentation for details):


# Script granting execution permissions:chmod +x *.sh# If there is a private warehouse, you can transfer to a private warehouse,This article mainly shares,Build directly locally here:docker build -t "haproxy-plus:latest" ./

4、Pulling upHaproxycontainer

In order to fit the theme of the article,So continue to use it hereDocker APIRemote lifting of containers:


# -- coding: utf8 --import dockerclient = docker.DockerClient(version='1.40', base_url='tcp://127.0.0.1:2375')#client.images.pull('haproxy-plus:latest') # Local testing,So there's no need to pull the image hereclient.containers.run(image='haproxy-plus:latest', name='demo2', volumes={'/data/images/haproxy/etc': {'bind': '/usr/local/haproxy/etc', 'mode': 'rw'}}, network_mode='host', environment=["VIP=127.0.0.1", "CFG_GET_URL=http://127.0.0.1/"], detach=True)

Several key setting instructions:


Mount local directory /data/images/haproxy/etc To container /usr/local/haproxy/etc catalogue,Used for persistent configuration;


environment variable VIP,Used to specifyhaproxyConfiguration Name(On our side, it's actuallyVIPaddress),It is also to pull the specified configuration through the interface;


environment variable CFG_GET_URL,PullingHaproxyConfigured address,combinationVIPNext is http://127.0.0.1/127.0.01,The temporary download address provided in the previous text


above-mentionedPythonSave code asstart.py,The execution results are as follows:


[root@centos haproxy]# python start.py [root@centos haproxy]# docker logs -f demo2 # View execution logs[2019-10-04 04:32:10] Starting Download configration file to /usr/local/haproxy/etc/temp/127.0.0.1.cfg ...[2019-10-04 04:32:10] Download configration file /usr/local/haproxy/etc/temp/127.0.0.1.cfg success.[2019-10-04 04:32:10] Configuration file /usr/local/haproxy/etc/temp/127.0.0.1.cfg is valid.[2019-10-04 04:32:10] /usr/local/haproxy/etc/127.0.0.1.cfg is not exist, maybe the first release, skiped.[2019-10-04 04:32:10] Cover /usr/local/haproxy/etc/temp/127.0.0.1.cfg to /usr/local/haproxy/etc/127.0.0.1.cfg success.[2019-10-04 04:32:10] /usr/local/haproxy/etc/127.0.0.1.cfg is updated success!Configuration file is valid[NOTICE] 276/043210 (1) : New worker #1 (27) forked

adoptDockerLog of,The startup process is analyzed as follows:


Download through interfaceHaproxyallocation,Save as /usr/local/haporxy/etc/temp/127.0.0.1.cfg;


implementHaproxyConfigure syntax validation:haproxy -c -W /usr/local/haproxy/etc/temp/127.0.0.1.cfg;


After successful grammar verification,adoptMD5Compare the values to see if the configuration has been updated,Found that the original configuration cannot be found,Explanation: This is the first startup;


Copy temporary configuration files to formal configuration files:/usr/local/haproxy/etc/127.0.0.1.cfg


start-upHaproxysuccess:New worker #1 (27) forked


here,Access ConfigurationhaproxyStatus page http://<IP>:8080/haproxy,Enter account password:admin/123456 See the effect:


Docker Remote APIIntroduction and practical sharing:HaproxyRemote managementHaproxy Status page


The result meets expectations,Now let's try updating the configuration,The update script is written as follows,rightDocker APIofSDKSlightly done some packaging:


# -- coding: utf8 --import dockerclass dockerApi():def __init__(self,ip,port=2375):self.base_url = 'tcp://%s:%s' % (ip,port)self.client = docker.DockerClient(version='1.40', base_url=self.base_url)def exec_cmd(self,container_name, cmd='echo ok',decode=True):container = self.client.containers.get(container_name)result = container.exec_run(cmd=cmd, detach=False, tty=True, stdin=True, stdout=True)ret_code = result.exit_codeif decode:ret_info = result.output.decode()else:ret_info = result.outputreturn ret_code, ret_infodef send_kill(self, container_name):container = self.client.containers.get(container_name)container.kill('SIGUSR2')# definitionhaproxyHostIP,It can be multipleld_list = ['127.0.0.1']# Define commands for updating configurationscmd = 'bash /opt/update_cfg.sh'# Define container namescontainer_name = 'demo2' # Start updatingfor i in ld_list:obj = dockerApi(i)ret_code,ret_info = obj.exec_cmd(container_name, cmd)print '%s exec %s ret_code is: %s, exec ret_info:' % (i, cmd, ret_code)print ret_infoif int(ret_code) == 0:obj.send_kill(container_name)

Save as update.py,The execution results are as follows:


[root@centos haproxy]# python update.py 127.0.0.1 exec bash /opt/update_cfg.sh ret_code is: 2, exec ret_info:[2019-10-04 04:55:41] Starting Download configration file to /usr/local/haproxy/etc/temp/127.0.0.1.cfg ...[2019-10-04 04:55:41] Download configration file /usr/local/haproxy/etc/temp/127.0.0.1.cfg success.[2019-10-04 04:55:41] The configuration file 127.0.0.1.cfg is the same, no need update.

The log prompt is,The configuration has not changed,So there's no need to upgrade,Meets expectations。below,We modify the center configuration,Remove the listening port from the8080Change to8181:


cat > /usr/share/nginx/html/127.0.0.1 <<EOFglobalnbproc 1pidfile /usr/local/haproxy/logs/127.0.0.1.piddefaultstimeout connect  300stimeout client   300stimeout server   300slisten admin_stat_8181bind 0.0.0.0:8181mode httpstats refresh 60sstats uri /haproxystats auth admin:123456stats admin if TRUE################################################## status end ###############################################EOF# Request testing,The above content is considered successfulcurl http://127.0.0.1/127.0.0.1

The results of re execution are as follows:


[root@centos haproxy]# python update.py 127.0.0.1 exec bash /opt/update_cfg.sh ret_code is: 0, exec ret_info:[2019-10-04 05:03:43] Starting Download configration file to /usr/local/haproxy/etc/temp/127.0.0.1.cfg ...[2019-10-04 05:03:43] Download configration file /usr/local/haproxy/etc/temp/127.0.0.1.cfg success.[2019-10-04 05:03:43] Configuration file /usr/local/haproxy/etc/temp/127.0.0.1.cfg is valid.[2019-10-04 05:03:43] Backup /usr/local/haproxy/etc/127.0.0.1.cfg to  /usr/local/haproxy/etc/backup/127.0.0.1_2019-10-04-050343.cfg success.[2019-10-04 05:03:43] Cover /usr/local/haproxy/etc/temp/127.0.0.1.cfg to /usr/local/haproxy/etc/127.0.0.1.cfg success.[2019-10-04 05:03:43] /usr/local/haproxy/etc/127.0.0.1.cfg is updated success!

Compared to the first startup log,The process of updating the configuration is as follows:


Download through interfaceHaproxyallocation,Save as /usr/local/haporxy/etc/temp/127.0.0.1.cfg;


implementHaproxyConfigure syntax validation:haproxy -c -W /usr/local/haproxy/etc/temp/127.0.0.1.cfg;


After successful grammar verification,adoptMD5Compare the values to see if the configuration has been updated,If there are any updates,Back up the original configuration file first /usr/local/haproxy/etc/backup/127.0.0.1_2019-10-04-050343.cfg;


Copy temporary configuration files to formal configuration files:/usr/local/haproxy/etc/127.0.0.1.cfg


Due to the presence ofupdate_cfg.shScript only updates configuration files,thereforePythonThe final step of the script will also verify the script return code,If it meets expectations, a will be sentkillinstructions,Smooth overloadHaproxy,This is mainly used forHaproxyof-Wparameter,The official explanation is as follows:


If you used a bind mount for the config and have edited your haproxy.cfg file, you can use HAProxy's graceful reload feature by sending a SIGHUP to the container:


$ docker kill -s HUP my-running-haproxy


The entrypoint script in the image checks for running the command haproxy and replaces it with haproxy-systemd-wrapper from HAProxy upstream which takes care of signal handling to do the graceful reload. Under the hood this uses the -sf option of haproxy so "there are two small windows of a few milliseconds each where it is possible that a few connection failures will be noticed during high loads" (see Stopping and restarting HAProxy). Image Variants


Continue to view container logs,You can see that there are2Duan log,The first paragraph is the first startup,The second paragraph is after updating the configuration,sendkillinstructions,HaproxyOverloaded logs:


[root@centos haproxy]# docker logs -f demo2[2019-10-04 05:03:19] Starting Download configration file to /usr/local/haproxy/etc/temp/127.0.0.1.cfg ...[2019-10-04 05:03:20] Download configration file /usr/local/haproxy/etc/temp/127.0.0.1.cfg success.[2019-10-04 05:03:20] Configuration file /usr/local/haproxy/etc/temp/127.0.0.1.cfg is valid.[2019-10-04 05:03:20] /usr/local/haproxy/etc/127.0.0.1.cfg is not exist, maybe the first release, skiped.[2019-10-04 05:03:20] Cover /usr/local/haproxy/etc/temp/127.0.0.1.cfg to /usr/local/haproxy/etc/127.0.0.1.cfg success.[2019-10-04 05:03:20] /usr/local/haproxy/etc/127.0.0.1.cfg is updated success!Configuration file is valid[NOTICE] 276/050320 (1) : New worker #1 (27) forked[WARNING] 276/050343 (1) : Reexecuting Master process[NOTICE] 276/050343 (1) : New worker #1 (53) forked[WARNING] 276/050343 (27) : Stopping proxy admin_stat in 0 ms.[WARNING] 276/050343 (27) : Stopping frontend GLOBAL in 0 ms.[WARNING] 276/050343 (27) : Proxy admin_stat stopped (FE: 0 conns, BE: 0 conns).[WARNING] 276/050343 (27) : Proxy GLOBAL stopped (FE: 0 conns, BE: 0 conns).[WARNING] 276/050343 (1) : Former worker #1 (27) exited with code 0 (Exit)

last,Visit againHaporxyThe status page of http://<IP>:8181/haproxy Verification effect,Port successfully updated to8181,Meets expectations:


Docker Remote APIIntroduction and practical sharing:HaproxyRemote managementHaproxyStatus page


The above updated configuration、The process of reloading has been tested by me,Confirmed to be smooth and undamaged。In the production environment,We only need to centrally manage on the operations platformHaproxyConfiguration of,Can be achieved throughDockerofAPITo controlHaproxyA second level configuration update has been made!Is it quite awesome?


Docker Remote APIIntroduction and practical sharing:HaproxyRemote managementHaproxyMocha ITOM


By the way, I would like to share some good news here:HaproxyLatest2.0SupportedDataplaneapiI'm here to remotely manage the configuration,Interested parties can take a look at the official documentation。


But due to historical baggage,If we want to cut toDataplaneapiThe management mode requires a significant investment of development resources,Therefore, giving up,Temporarily continue the management plan shared above,After sufficient manpower, consider switching to another optionDataplaneapiMore detailed management mode。


six、Summary

This article starts withDockerinstall、Docker Remote APIas well asPython SDKUse of,Provided a more detailed presentationDocker Remote APICommon scenarios for,Finally, based onDocker Remote APIShared a quick landing experienceHaproxyBest practices for remote management,Hope to be helpful to friends in need。


comment 0

Recommended posts

more »

Related products

Warm prompt ×
The product has been successfully added to the shopping cart!
Shopping Cart Total 0 Items
GoCart