Basically, many of my services in my deployment are single task. The proxies are deployed in pairs with one proxy being primary and the other proxy for backup. I run these proxies as single task services with a constraint specifying different nodes in the cluster. I have a proxy pair sitting in front of nginx/php service (which has multiple replicas). The php service has a local haproxy to connect to a pair of database proxies (primary/backup) for mysql and redis databases. The pair of database proxies are also single task as I want to have all connections go through a single proxy (in the case of mysql, the proxy is implemented with ProxySQL and for redis, the proxy is HAProxy).
There are 5 clusters of 2 MySQL servers sitting behind each ProxySQL proxy. One of the MySQL servers in a cluster is the Master, while the other is a replication Slave. I run these database clusters with 10 single task services with a constraint specifying the node where the database data resides on the host using very fast NVMe SSDs on the host.
A final MySQL server is deployed to consolidate the 5 clusters’ databases into one instance using MySQL 5.7 multi-source replication. In the early morning, admin tasks update this consolidated database using the changes made during the day and produce new content for the next day. At 5am, the website is marked as OFFLINE for maintenance and the 5 clusters are taken offline to resync the databases with the consolidated database and the clusters are restarted with the updated databases. The 5 clusters are not resync’d all at the same time as 1 cluster is taken down, resync’d, and then restarted in a rolling update so only 1 cluster is offline at a time.
I also have similar proxies for IMAP and LMTP with the proxy routing connections to the appropriate Dovecot backend servers. Each backend Dovecot server is deployed as a pair of single task services (one for primary user access and the second one for backup). There are many pairs of Dovecot servers that will be deployed. Each pair is also replicated to a single consolidated Dovecot multi-source server that is used to perform mailbox maintenance during the night and resync’d back to the pairs of live Dovecot servers.
Anyway, the entire swarm is fairly large but primarily consists of pairs of single task services (some managing traffic through the system and some managing persistent data). My swarm is currently in development and hasn’t been put into production yet.
As for my feature request, I primarily want the “docker service create ...
” command to deploy these pairs of single task services where there is no possibility that someone in production will attempt to scale one of these services by mistake.
As “docker service create...
” already supports the --mode
option to select whether the service is replicated
or global
, I figure this option should be extended to support more modes. In this case, I’m suggesting single
as a mode choice.
I would also like to see a mode that would allow me to specify the service is deployed as a pair of tasks with the first task being primary and the second task being backup, but having DNS requests return the primary task’s IP if it is online or return the second task’s IP. This would allow me to probably deploy my proxy/database pairs as a single service rather than two single task services and have to use a local proxy for failover. If Docker were to add such a mode, the service should support 2 or more replicas so that the task IP selected cascades to the next replica if all the first replicas are OFFLINE.