{"id":275825,"date":"2016-03-10T11:23:02","date_gmt":"2016-03-10T08:23:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=275825"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=275825","title":{"rendered":"\u041d\u0430\u0448 \u043e\u043f\u044b\u0442 \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u0430 \u0441 Docker"},"content":{"rendered":"<br \/>\n<h2>\u0412\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u044f<\/h2>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"https:\/\/habrastorage.org\/files\/7c4\/e49\/e94\/7c4e49e94a5d454a89e33bae89fd4771.jpg\"\/><\/div>\n<blockquote><p><i>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u0440\u0438\u0441\u043d\u0438\u043b\u0441\u044f \u0441\u043e\u043d, \u043a\u0430\u043a-\u0431\u0443\u0434\u0442\u043e \u043c\u0435\u043d\u044f \u0443\u0436\u0430\u043b\u0438 \u0434\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445<br \/>  \u043a\u0438\u043b\u043e\u0431\u0430\u0439\u0442, \u0437\u0430\u0441\u0443\u043d\u0443\u043b\u0438 \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0441\u043e\u043a\u0435\u0442 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435.<br \/>  \u0412\u044b\u0434\u0435\u043b\u0438\u043b\u0438 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442 \u0432 \u043e\u0432\u0435\u0440\u043b\u0435\u0439\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0438 \u043f\u0443\u0441\u0442\u0438\u043b\u0438<br \/>  \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u0445\u2026<br \/>  \u041f\u043e\u043a\u0430 \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 docker rm<\/i><\/p><\/blockquote>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u041d\u0435 \u0442\u0430\u043a \u0434\u0430\u0432\u043d\u043e \u043c\u043d\u0435 \u043f\u043e\u0441\u0447\u0430\u0441\u0442\u043b\u0438\u0432\u0438\u043b\u043e\u0441\u044c \u0441\u0442\u0430\u0442\u044c \u0447\u043b\u0435\u043d\u043e\u043c \u043e\u0447\u0435\u043d\u044c \u043a\u0440\u0443\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b <br \/>  <a href=\"http:\/\/centos-admin.ru\">centos-admin.ru<\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044f \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0441\u044f \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0436\u0435, \u043a\u0430\u043a \u044f: \u0435\u0434\u0438\u043d\u043e\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u0438\u043a\u0430\u043c\u0438 \u0441\u043e \u0441\u0442\u0440\u0430\u0441\u0442\u044c\u044e \u043a \u043d\u043e\u0432\u044b\u043c \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f\u043c, \u044d\u043d\u0442\u0443\u0437\u0438\u0430\u0441\u0442\u0430\u043c\u0438 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u043d\u044f\u043c\u0438. \u0418 \u0432\u043e\u0442, \u0443\u0436\u0435 \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u0434\u0435\u043d\u044c \u043c\u0435\u043d\u044f \u0441 \u043a\u043e\u043b\u043b\u0435\u0433\u043e\u0439 \u043f\u043e\u0441\u0430\u0434\u0438\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430\u0434 \u043e\u0434\u043d\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u00ab\u0434\u043e\u043a\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0451, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u043a\u0435\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u00bb \u0438 \u0431\u044b\u043b\u043e \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0430\u0436\u043d\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0432\u044b\u0441\u043e\u043a\u0443\u044e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432. <\/p>\n<p>  \u0421\u043a\u0430\u0436\u0443 \u0441\u0440\u0430\u0437\u0443, \u0447\u0442\u043e \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u044f \u0431\u044b\u043b \u043e\u0431\u044b\u0447\u043d\u044b\u043c \u043a\u043e\u043c\u043d\u0430\u0442\u043d\u044b\u043c Linux-\u0430\u0434\u043c\u0438\u043d\u043e\u043c: \u043c\u0435\u0440\u0438\u043b\u0441\u044f \u0430\u043f\u0442\u0430\u0439\u043c\u0430\u043c\u0438, \u0430\u043f\u0442-\u0433\u0435\u0442-\u0438\u043d\u0441\u0442\u0430\u043b\u043b\u0438\u043b \u043f\u0430\u043a\u0435\u0442\u044b, \u043f\u0440\u0430\u0432\u0438\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0438, \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b \u0441\u0435\u0440\u0432\u0438\u0441\u044b, \u0442\u0430\u0439\u043b\u0438\u043b \u043b\u043e\u0433\u0438. \u0412 \u043e\u0431\u0449\u0435\u043c, \u043d\u0435 \u0438\u043c\u0435\u043b \u043e\u0441\u043e\u0431\u043e \u0432\u044b\u0434\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043d\u0430\u0432\u044b\u043a\u043e\u0432, \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u043b \u043e \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 <a href=\"http:\/\/www.tomsitpro.com\/articles\/openstack-pets-and-cattle,1-1759.html\">The Pets vs. Cattle<\/a>, \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u0431\u044b\u043b \u0437\u043d\u0430\u043a\u043e\u043c \u0441 Docker \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043e\u0447\u0435\u043d\u044c \u0441\u043b\u0430\u0431\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u043b, \u043a\u0430\u043a\u0438\u0435 \u0448\u0438\u0440\u043e\u043a\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043e\u043d \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442. \u0410 \u0438\u0437 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043b\u0438\u0448\u044c ansible \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 bash-\u0441\u043a\u0440\u0438\u043f\u0442\u044b. <\/p>\n<p>  \u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u043e\u043f\u044b\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u043c \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u044d\u0442\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c, \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u043c \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f.<\/p>\n<h3>\u041a\u0430\u043a\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u043b \u0440\u0435\u0448\u0430\u0442\u044c \u043d\u0430\u0448 \u0434\u043e\u043a\u0435\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440:<\/h3>\n<p>   \u2014 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430.<br \/>   \u2014 \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439.<br \/>   \u2014 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n<h3>\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c:<\/h3>\n<p>   \u2014 Docker<br \/>   \u2014 Docker swarm (agent + manage)<br \/>   \u2014 Consul<br \/>   \u2014 Registrator<br \/>   \u2014 Consul Template<br \/>   \u2014 Docker compose<br \/>   \u2014 \u0440\u0443\u043a\u0438<\/p>\n<h2>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432:<\/h2>\n<h3>Docker<\/h3>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"https:\/\/habrastorage.org\/files\/d03\/11a\/9fc\/d0311a9fc1c542ecb8ed97e47d184583.jpg\"\/><\/div>\n<p>  \u041e Docker \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u043d\u0435\u043c\u0430\u043b\u043e \u0441\u0442\u0430\u0442\u0435\u0439, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u043d\u0430 \u0445\u0430\u0431\u0440\u0435. \u042f \u0434\u0443\u043c\u0430\u044e \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0432 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u044f\u0445 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0442\u0430\u043a\u043e\u0435. <br \/>  \u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0436\u0438\u0437\u043d\u044c \u0432\u0441\u0435\u043c. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443, \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0443, \u0441\u0438\u0441\u0430\u0434\u043c\u0438\u043d\u0443, \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u043e\u0440\u0443.<br \/>  Docker \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c, \u0434\u0435\u043f\u043b\u043e\u0438\u0442\u044c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043b\u044e\u0431\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435. <br \/>  Docker \u043c\u043e\u0436\u043d\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c \u0441 git, \u043d\u043e \u043d\u0435 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u043e\u0434\u043e\u043c, \u0430 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0432 \u0446\u0435\u043b\u043e\u043c.<\/p>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u043b\u0433\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043e \u043f\u0440\u0435\u043b\u0435\u0441\u0442\u044f\u0445 \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430.<\/p>\n<h3>Docker swarm<\/h3>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"https:\/\/habrastorage.org\/files\/22e\/8c7\/7d6\/22e8c77d62cc4829b7d8e7b4b4a27c1e.gif\"\/><\/div>\n<p>  Swarm \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u043d\u0430\u0448\u0438\u0445 \u0445\u043e\u0441\u0442\u043e\u0432 (node) \u0432 \u043e\u0434\u0438\u043d \u043a\u043b\u0430\u0441\u0442\u0435\u0440.<br \/>  \u041e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0435 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0434\u0443\u043c\u0430\u0442\u044c \u043e \u0442\u043e\u043c, \u043d\u0430 \u043a\u0430\u043a\u043e\u0439 \u043d\u043e\u0434\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0442\u043e\u0442 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440. Swarm \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0437\u0430 \u043d\u0430\u0441. \u041c\u044b \u043b\u0438\u0448\u044c \u0445\u043e\u0442\u0438\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u00ab\u0433\u0434\u0435-\u0442\u043e \u0442\u0430\u043c\u00bb.<br \/>  \u0420\u0430\u0431\u043e\u0442\u0430\u044f \u0441\u043e Swarm \u2014 \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u043f\u0443\u043b\u043e\u043c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432. Swarm \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 Docker API \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u043c\u0438. <\/p>\n<p>  \u041e\u0431\u044b\u0447\u043d\u043e, \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435, \u0431\u044b\u0432\u0430\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e<\/p>\n<pre>export DOCKER_HOST=tcp:\/\/&lt;my_swarm_ip&gt;:3375<\/pre>\n<p>  \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b docker \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e, \u043d\u043e \u0443\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044f \u043d\u0435 \u0441 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043d\u043e\u0434\u043e\u0439, \u0430 \u0441 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043e\u043c \u0432 \u0446\u0435\u043b\u043e\u043c.<\/p>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <i>&#8212;label<\/i>. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0433\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u043e\u0434\u0435 \u043c\u0435\u0442\u043a\u0438. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043c\u0430\u0448\u0438\u043d\u0430 \u0441 SSD-\u0434\u0438\u0441\u043a\u0430\u043c\u0438 \u0438 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0441 PosrgreSQL \u0443\u0436\u0435 \u043d\u0435 \u00ab\u0433\u0434\u0435-\u0442\u043e \u0442\u0430\u043c\u00bb, \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435, \u0430 \u043d\u0430 \u0442\u043e\u0439 \u043d\u043e\u0434\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u0431\u044b\u0441\u0442\u0440\u044b\u0435 \u0434\u0438\u0441\u043a\u0438.<\/p>\n<p>  \u041d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u043c \u0434\u0435\u043c\u043e\u043d\u0443 \u043d\u043e\u0434\u044b \u043c\u0435\u0442\u043a\u0443:<\/p>\n<pre>docker daemon --label com.example.storage=&quot;ssd&quot;<\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c PostgreSQL \u0441 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u043c \u0443 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u043c\u0435\u0442\u043a\u0435:<\/p>\n<pre>docker run -d -e constraint:com.example.storage=&quot;ssd&quot; postgres<\/pre>\n<p>  <a href=\"https:\/\/docs.docker.com\/swarm\/scheduler\/filter\/#swarm-filters\">\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0445<\/a><\/p>\n<p>  \u0421\u0442\u043e\u0438\u0442 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043a\u0430\u043a <i>startegy <\/i>\u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 Swarm. \u042d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043c\u0435\u0436\u0434\u0443 \u043d\u043e\u0434\u0430\u043c\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430. <br \/>  \u041d\u043e\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u0442\u0440\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <i>strategy<\/i>:<\/p>\n<p>   \u2014 spread<br \/>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <i>strategy<\/i>. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, swarm \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440, \u0435\u0441\u043b\u0438 \u043d\u0430 \u044d\u0442\u043e\u0439 \u043d\u043e\u0434\u0435 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432, \u0447\u0435\u043c \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u043d\u043e\u0434\u0430\u0445. \u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432. \u041e\u043d\u0438 \u0432\u0441\u0435 \u0434\u0430\u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b, \u043d\u043e \u044d\u0442\u0430 \u043d\u043e\u0434\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0431\u0440\u0430\u043d\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u043d\u0430 \u043d\u0435\u0439. <\/p>\n<p>   \u2014 binpack<br \/>  \u0421 \u044d\u0442\u0438\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c, \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, swarm \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0431\u0438\u0442\u044c \u043a\u0430\u0436\u0434\u0443\u044e \u043d\u043e\u0434\u0443 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u043c\u0438 \u043f\u043e\u0434 \u0437\u0430\u0432\u044f\u0437\u043a\u0443. \u0417\u0434\u0435\u0441\u044c \u0442\u0430\u043a\u0436\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b. <\/p>\n<p>   \u2014 random<br \/>  \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0441\u0430\u043c\u043e \u0437\u0430 \u0441\u0435\u0431\u044f.<\/p>\n<h3>Consul<\/h3>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"https:\/\/habrastorage.org\/files\/9a9\/4f3\/eae\/9a94f3eaeb3247a7bdeb62112b16a029.png\"\/><\/div>\n<p>  Consul \u2014 \u044d\u0442\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0434\u0443\u043a\u0442 \u043e\u0442 \u0431\u0430\u043d\u0434\u044b \u041c\u0438\u0442\u0447\u0435\u043b\u043b\u0430 \u0425\u0430\u0448\u0438\u043c\u043e\u0442\u043e, \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 <a href=\"https:\/\/www.hashicorp.com\/\">Hashicorp<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0430\u0434\u0443\u0435\u0442 \u043d\u0430\u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u043a\u0430\u043a Vagrant \u0438 \u043c\u043d\u043e\u0433\u0438\u043c\u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438. <br \/>  Consul \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0440\u043e\u043b\u044c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 registrator&#8217;\u043e\u043c. <br \/>  \u0421\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0430\u0433\u0435\u043d\u0442\u043e\u0432 \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 (\u043a\u0432\u043e\u0440\u0443\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 N\/2+1). \u0410\u0433\u0435\u043d\u0442\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043d\u043e\u0434\u0430\u0445 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0435\u0439 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0438 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445 Consul-server.<br \/>  \u0422\u0430\u043a\u0436\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Consul \u043a\u0430\u043a <a href=\"https:\/\/www.consul.io\/intro\/getting-started\/kv.html\">key-value \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435<\/a>, \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0433\u0438\u0431\u043a\u043e\u0433\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0432\u044f\u0437\u0435\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432.<br \/>  \u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e Consul \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u0435\u0442 \u043a\u0430\u043a health-checker \u043f\u043e \u0438\u043c\u0435\u044e\u0449\u0435\u043c\u0443\u0441\u044f \u0443 \u043d\u0435\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0430\u043a \u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0432 \u043d\u0435\u043c Registrator.<br \/>  \u0418\u043c\u0435\u0435\u0442\u0441\u044f web-UI, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a, \u043d\u043e\u0434, \u043d\u0443 \u0438, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, REST API.<\/p>\n<p>  \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430\u0445:<\/p>\n<p>  <b>Script <\/b><\/p>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c. \u0421\u043a\u0440\u0438\u043f\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441 \u043a\u043e\u0434:<\/p>\n<p>   \u2014 Exit code 0 \u2014 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432 \u0441\u0442\u0430\u0442\u0443\u0441\u0435 passing (\u0442. \u0435. \u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e)<br \/>   \u2014 Exit code 1 \u2014 \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432 \u0441\u0442\u0430\u0442\u0443\u0441\u0435 warning<br \/>   \u2014 Any other code \u2014 \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432 \u0441\u0442\u0430\u0442\u0443\u0441\u0435 failing<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440:  <\/p>\n<pre><code class=\"bash\">#!\/usr\/bin\/with-contenv sh  RESULT=`redis-cli ping`  if [ &quot;$RESULT&quot; = &quot;PONG&quot; ]; then     exit 0 fi  exit 2  <\/code><\/pre>\n<p>  \u0412 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0447\u0435\u0433\u043e-\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435\u0433\u043e \u043d\u0430 nagios-\u043f\u043b\u0430\u0433\u0438\u043d\u044b  <\/p>\n<pre><code>{   &quot;check&quot;: {     &quot;id&quot;: &quot;mem-util&quot;,     &quot;name&quot;: &quot;Memory utilization&quot;,     &quot;script&quot;: &quot;\/usr\/local\/bin\/check_mem.py&quot;,     &quot;interval&quot;: &quot;10s&quot;   } }  <\/code><\/pre>\n<p>  <a href=\"https:\/\/gist.github.com\/mtchavez\/e367db8b69aeba363d21\">gist.github.com\/mtchavez\/e367db8b69aeba363d21<\/a><\/p>\n<p>  <b>TCP <\/b><\/p>\n<p>  \u0421\u0442\u0443\u0447\u0438\u0442\u0441\u044f \u043d\u0430 \u0441\u043e\u043a\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0445\u043e\u0441\u0442\u043d\u0435\u0439\u043c\u0430\/IP-\u0430\u0434\u0440\u0435\u0441\u0430. \u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code>{     &quot;id&quot;: &quot;ssh&quot;,     &quot;name&quot;: &quot;SSH TCP on port 22&quot;,     &quot;tcp&quot;: &quot;127.0.0.1:22&quot;,     &quot;interval&quot;: &quot;10s&quot;,     &quot;timeout&quot;: &quot;1s&quot; } <\/code><\/pre>\n<p>  <b>HTTP <\/b><\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 HTTP-\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438:<\/p>\n<p>  \u041f\u043e\u043c\u0438\u043c\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0447\u0435\u0440\u0435\u0437 REST API Consul, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0432\u0435\u0448\u0438\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 -l (<i>label<\/i>)<br \/>  \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u044f \u0437\u0430\u043f\u0443\u0449\u0443 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0441 django+uwsgi \u0432\u043d\u0443\u0442\u0440\u0438:<\/p>\n<p>  <code>docker run -p 8088:3000 -d --name uwsgi-worker --link consul:consul -l &quot;SERVICE_NAME=uwsgi-worker&quot; -l &quot;SERVICE_TAGS=django&quot; \\<br \/>  -l &quot;SERVICE_3000_CHECK_HTTP=\/&quot; -l &quot;SERVICE_3000_CHECK_INTERVAL=15s&quot; -l &quot;SERVICE_3000_CHECK_TIMEOUT=1s&quot; uwsgi-worker<\/code><\/p>\n<p>  \u0412 UI \u041a\u043e\u043d\u0441\u0443\u043b\u0430 \u0443\u0432\u0438\u0434\u0438\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b django. \u0412\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0441\u0442\u0430\u0442\u0443\u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u2014 passing, \u0437\u043d\u0430\u0447\u0438\u0442, \u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c \u0432\u0441\u0451 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/e39\/10c\/043\/e3910c043a7941fb8ad299a9356eaddd.png\"\/><\/p>\n<p>  \u0418\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043a REST API \u043f\u043e http:<\/p>\n<pre>curl http:\/\/&lt;consul_ip&gt;:8500\/v1\/health\/service\/uwsgi-worker | jq .<\/pre>\n<pre><code>[   {     &quot;Node&quot;: {       &quot;Node&quot;: &quot;docker0&quot;,       &quot;Address&quot;: &quot;127.0.0.1&quot;,       &quot;CreateIndex&quot;: 370,       &quot;ModifyIndex&quot;: 159636     },     &quot;Service&quot;: {       &quot;ID&quot;: &quot;docker0:uwsgi-worker:3000&quot;,       &quot;Service&quot;: &quot;uwsgi-worker&quot;,       &quot;Tags&quot;: [         &quot;django&quot;       ],       &quot;Address&quot;: &quot;127.0.0.1&quot;,       &quot;Port&quot;: 8088,       &quot;EnableTagOverride&quot;: false,       &quot;CreateIndex&quot;: 159631,       &quot;ModifyIndex&quot;: 159636     },     &quot;Checks&quot;: [       {         &quot;Node&quot;: &quot;docker0&quot;,         &quot;CheckID&quot;: &quot;serfHealth&quot;,         &quot;Name&quot;: &quot;Serf Health Status&quot;,         &quot;Status&quot;: &quot;passing&quot;,         &quot;Notes&quot;: &quot;&quot;,         &quot;Output&quot;: &quot;Agent alive and reachable&quot;,         &quot;ServiceID&quot;: &quot;&quot;,         &quot;ServiceName&quot;: &quot;&quot;,         &quot;CreateIndex&quot;: 370,         &quot;ModifyIndex&quot;: 370       },       {         &quot;Node&quot;: &quot;docker0&quot;,         &quot;CheckID&quot;: &quot;service:docker1:uwsgi-worker:3000&quot;,         &quot;Name&quot;: &quot;Service 'uwsgi-worker' check&quot;,         &quot;Status&quot;: &quot;passing&quot;,         &quot;Notes&quot;: &quot;&quot;,         &quot;Output&quot;: &quot;&quot;,         &quot;ServiceID&quot;: &quot;docker0:uwsgi-worker:3000&quot;,         &quot;ServiceName&quot;: &quot;uwsgi-worker&quot;,         &quot;CreateIndex&quot;: 159631,         &quot;ModifyIndex&quot;: 159636       }     ]   } ]  <\/code><\/pre>\n<p>  \u041f\u043e\u043a\u0430 \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u043e HTTP \u043e\u0442\u0434\u0430\u0451\u0442 \u0441\u0442\u0430\u0442\u0443\u0441 \u043e\u0442\u0432\u0435\u0442\u0430 2xx, Consul \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0435\u0433\u043e \u0436\u0438\u0432\u044b\u043c \u0438 \u0437\u0434\u043e\u0440\u043e\u0432\u044b\u043c. \u0415\u0441\u043b\u0438 \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430 429 (Too Many Request) \u2014 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 Warning, \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u0434\u044b \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043c\u0435\u0447\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a Failed \u0438 Consul \u043f\u043e\u043c\u0435\u0442\u0438\u0442 \u044d\u0442\u043e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441 \u043a\u0430\u043a failure. <br \/>  \u041f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b http-\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u2014 10 \u0441\u0435\u043a\u0443\u043d\u0434. \u041c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 timeout.<br \/>  Consul Template, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u044f\u0441\u044c \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0443, \u0441 N-\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u00ab\u0437\u0434\u043e\u0440\u043e\u0432\u044b\u0445\u00bb \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 \u0438 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a \u0432\u043e\u0440\u043a\u0435\u0440\u0430\u043c. <\/p>\n<p>  \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043d\u043e\u0432\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0432 \u043a\u043e\u043d\u0441\u0443\u043b\u0435:<\/p>\n<pre>curl -XPUT -d @_ssh_check.json http:\/\/&lt;consul_ip&gt;:8500\/v1\/agent\/check\/register<\/pre>\n<p>  \u0413\u0434\u0435 \u0432 \u0444\u0430\u0439\u043b\u0435 <i>ssh_check.json<\/i> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438:<\/p>\n<pre><code>{     &quot;id&quot;: &quot;ssh&quot;,     &quot;name&quot;: &quot;SSH TCP on port 22&quot;,     &quot;tcp&quot;: &quot;&lt;your_ip&gt;:22&quot;,     &quot;interval&quot;: &quot;10s&quot;,     &quot;timeout&quot;: &quot;1s&quot; }  <\/code><\/pre>\n<p>  \u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438:  <\/p>\n<pre>curl http:\/\/&lt;consul_ip&gt;:8500\/v1\/agent\/check\/deregister\/ssh_check<\/pre>\n<p>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 Consul \u043e\u0447\u0435\u043d\u044c \u0432\u0435\u043b\u0438\u043a\u0438 \u0438, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043e\u0445\u0432\u0430\u0442\u0438\u0442\u044c \u0438\u0445 \u0432\u0441\u0435 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u043e.<br \/>  \u0416\u0435\u043b\u0430\u044e\u0449\u0438\u0435 \u043c\u043e\u0433\u0443\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a <a href=\"https:\/\/www.consul.io\/docs\/index.html\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a> \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u0431\u043e \u0432\u0441\u0451\u043c \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u043e.<\/p>\n<h3>Registrator<\/h3>\n<p>  Registrator \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0440\u043e\u043b\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0440\u0430 \u043e\u0431 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u0445 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 Docker. \u041e\u043d \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442 \u0441\u043f\u0438\u0441\u043a\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u0438 \u0432\u043d\u043e\u0441\u0438\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043f\u0440\u0430\u0432\u043a\u0438 \u0432 Consul \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0442\u0430\u0440\u0442\u0430 \u0438\u043b\u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432. \u0412 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u044b\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 Registrator \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0432 Consul.<br \/>  \u0422\u0430\u043a \u0436\u0435 \u043e\u043d \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0438 \u0434\u043b\u044f health-check \u0432 Consul, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432.<br \/>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439<\/p>\n<p>  <code>docker run --restart=unless-stopped -v \/root\/html:\/usr\/share\/nginx\/html:ro --links consul:consul -l &quot;SERVICE_NAME=nginx&quot; -l &quot;SERVICE_TAGS=web&quot; -l &quot;SERVICE_CHECK_HTTP=\/&quot; -l &quot;SERVICE_CHECK_INTERVAL=15s&quot; -l &quot;SERVICE_CHECK_TIMEOUT=1s&quot; <br \/>   -p 8080:80 -d nginx<\/code><\/p>\n<p>  Registrator \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u0432 Consul \u0441\u0435\u0440\u0432\u0438\u0441 nignx \u0438 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 HTTP-\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430.<\/p>\n<p>  <a href=\"http:\/\/gliderlabs.com\/registrator\/latest\/user\/run\/\">\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435<\/a><\/p>\n<h3>Consul Template<\/h3>\n<p>  \u041e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043e\u0442 \u0440\u0435\u0431\u044f\u0442 \u0438\u0437 Hashicorp. \u041e\u043d \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a Consul \u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432\/\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0445\u0441\u044f \u0432 \u043d\u0451\u043c, \u043c\u043e\u0436\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u043f\u043e \u0441\u0432\u043e\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430. Consul Template \u043f\u0440\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Consul \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b.<br \/>  \u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  NGINX:<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b server.conf.ctmpl<\/p>\n<pre><code>upstream fpm {         least_conn;         {{range service &quot;php&quot;}}server {{.Address}}:{{.Port}} max_fails=3 fail_timeout=60 weight=1;         {{else}}server 127.0.0.1:65535{{end}} }  server {         listen   80;          root \/var\/www\/html;         index index.php index.html index.htm;          server_name your.domain.com;          sendfile off;          location \/ {         }           location ~ \\.php$ {                 fastcgi_param SCRIPT_FILENAME $document_root\/$fastcgi_script_name;                 fastcgi_split_path_info ^(.+\\.php)(\/.+)$;                 fastcgi_pass fpm;                 fastcgi_index index.php;                 include fastcgi_params;         } } <\/code><\/pre>\n<p>  \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c Consul Template:<\/p>\n<p>  <code>consul-template -consul &lt;your_consul_ip&gt;:8500 -template server.conf.ctmpl -once -dry<br \/>  <\/code><\/p>\n<p>  \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 -dry \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u043a\u043e\u043d\u0444\u0438\u0433 \u0432 stdout, \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 -once \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442 consul-template \u043e\u0434\u0438\u043d \u0440\u0430\u0437.<\/p>\n<pre><code>upstream fpm {         least_conn;         server 127.0.0.1:9000 max_fails=3 fail_timeout=60 weight=1; }  server {         listen   80;          root \/var\/www\/html;         index index.php index.html index.htm;          server_name your.domain.com;          sendfile off;          location \/ {         }          location ~ \\.php$ {                 fastcgi_param SCRIPT_FILENAME $document_root\/$fastcgi_script_name;                 fastcgi_split_path_info ^(.+\\.php)(\/.+)$;                 fastcgi_pass fpm;                 fastcgi_index index.php;                 include fastcgi_params;         } } <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u043e\u043d \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0443 Consul IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u0438 \u043f\u043e\u0440\u0442\u044b \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c php \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u0438\u0437 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b.<br \/>  \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b nginx:<\/p>\n<p>  <code>consul-template -consul &lt;your_consul_ip&gt;:8500 -template server.conf.ctmpl:\/etc\/nginx\/conf.d\/server.conf:service nginx reload<br \/>  <\/code><\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, Consul Template \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0445 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433 nginx. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0441\u0435\u0440\u0432\u0438\u0441 \u0432\u0434\u0440\u0443\u0433 \u0443\u043f\u0430\u043b \u0438\u043b\u0438 \u0443 \u043d\u0435\u0433\u043e \u0441\u043c\u0435\u043d\u0438\u043b\u0441\u044f \u043f\u043e\u0440\u0442, Consul Template \u043e\u0431\u043d\u043e\u0432\u0438\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u0442 nginx reload.<\/p>\n<p>  \u041e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Consul Template \u0434\u043b\u044f \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 (nginx, haproxy).<br \/>  \u041d\u043e \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043e\u0434\u0438\u043d \u0438\u0437 \u044e\u0437\u043a\u0435\u0439\u0441\u043e\u0432, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442.<\/p>\n<p>  <a href=\"https:\/\/github.com\/hashicorp\/consul-template\">\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e Consul Template<\/a><\/p>\n<h2>\u041f\u0440\u0430\u043a\u0442\u0438\u043a\u0430<\/h2>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"https:\/\/habrastorage.org\/files\/6cc\/f05\/f23\/6ccf05f233de4fe2b99337e027794b7f.jpg\"\/><\/div>\n<p>  \u0418\u0442\u0430\u043a, \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0447\u0435\u0442\u044b\u0440\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d\u044b \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u0445\u043e\u0441\u0442\u0435, \u043d\u0430 \u043d\u0438\u0445 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d Debian 8 Jessie, \u044f\u0434\u0440\u043e \u0432\u0435\u0440\u0441\u0438\u0438 &gt; 3.16 \u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u0434\u0430\u043d\u043d\u044b\u043c \u0441\u0442\u0435\u043a\u043e\u043c \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439 \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 \u043a\u0430\u043a\u043e\u0435-\u043d\u0438\u0431\u0443\u0434\u044c \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. <\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0434\u043d\u0438\u043c\u0435\u043c \u043d\u0430 \u043d\u0438\u0445 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0431\u043b\u043e\u0433 wordpress.<\/p>\n<p>  * <i>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043e\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 TLS* \u043c\u0435\u0436\u0434\u0443 \u043d\u043e\u0434\u0430\u043c\u0438 Swarm \u0438 Consul.<\/i><\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u043d\u043e\u0434\u044b.<\/h3>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043d\u0430 \u043a\u0430\u0436\u0434\u0443\u044e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443 (\u0434\u0430\u043b\u0435\u0435 \u2014 \u043d\u043e\u0434\u0430)<\/p>\n<p>  <code>echo &quot;deb http:\/\/apt.dockerproject.org\/repo debian-jessie main&quot; &gt; \/etc\/apt\/sources.list.d\/docker.list<br \/>  <\/code><\/p>\n<p>  \u0418 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f. <\/p>\n<p>  <code>apt-get update<br \/>  apt-get install ca-certificates<br \/>  apt-key adv --keyserver hkp:\/\/p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D<br \/>  apt-get update<br \/>  apt-get install docker-engine aufs-tools<br \/>  <\/code><\/p>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a \u043e\u0431\u0432\u044f\u0437\u043a\u0438 \u043d\u0430 primary-\u043d\u043e\u0434\u0435:<\/p>\n<p>  <code>docker run --restart=unless-stopped -d -h `hostname` --name consul -v \/mnt:\/data \\<br \/>   -p `ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`:8300:8300 \\<br \/>   -p `ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`:8301:8301 \\<br \/>   -p `ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`:8301:8301\/udp \\<br \/>   -p `ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`:8302:8302 \\<br \/>   -p `ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`:8302:8302\/udp \\<br \/>   -p `ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`:8400:8400 \\<br \/>   -p 8500:8500 \\<br \/>   -p 172.17.0.1:53:53\/udp \\<br \/>   gliderlabs\/consul-server -server -rejoin -advertise `ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'` -bootstrap<br \/>  <\/code><\/p>\n<p>  \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <i>&#8212;restart=unless-stopped<\/i> \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0432 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0434\u0430\u0436\u0435 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0435 docker-daemon, \u0435\u0441\u043b\u0438 \u043e\u043d \u043d\u0435 \u0431\u044b\u043b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0432\u0440\u0443\u0447\u043d\u0443\u044e. <\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 Consul \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430 docker-daemon \u0432 systemd<br \/>  \u0412 \u0444\u0430\u0439\u043b\u0435 \/etc\/systemd\/system\/multi-user.target.wants\/docker.service \u0441\u0442\u0440\u043e\u043a\u0443 ExecStart \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0432\u0438\u0434\u0443:<\/p>\n<p>  <code>ExecStart=\/usr\/bin\/docker daemon -H fd:\/\/ -H tcp:\/\/&lt;your_ip&gt;:2375 --storage-driver=aufs --cluster-store=consul:\/\/&lt;your_ip&gt;:8500 --cluster-advertise &lt;your_ip&gt;:2375<br \/>  <\/code><\/p>\n<p>  \u0418 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0434\u0435\u043c\u043e\u043d<\/p>\n<p>  <code>systemctl daemon-reload<br \/>  service docker restart<br \/>  <\/code><\/p>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0447\u0442\u043e Consul \u043f\u043e\u0434\u043d\u044f\u043b\u0441\u044f \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n<p>  <code>docker ps<\/code><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c swarm-manager \u043d\u0430 primary-\u043d\u043e\u0434\u0435.<\/p>\n<p>  <code>docker run --restart=unless-stopped -d \\<br \/>   -p 3375:2375 \\<br \/>   swarm manage \\<br \/>   --replication \\<br \/>   --advertise `ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`:3375 \\<br \/>   consul:\/\/`ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`:8500\/<br \/>  <\/code><\/p>\n<p>  \u041a\u043e\u043c\u0430\u043d\u0434\u0430 <i>manage <\/i>\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442 Swarm manager \u043d\u0430 \u043d\u043e\u0434\u0435.<br \/>  \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <i>&#8212;replication<\/i> \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044e \u043c\u0435\u0436\u0434\u0443 <i>primary-<\/i> \u0438 <i>secondary-<\/i> \u043d\u043e\u0434\u0430\u043c\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430. <\/p>\n<p>  <code>docker run --restart=unless-stopped -d \\<br \/>   swarm join \\<br \/>   --advertise=`ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`:2375 \\<br \/>   consul:\/\/`ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`:8500\/<br \/>  <\/code><\/p>\n<p>  \u041a\u043e\u043c\u0430\u043d\u0434\u0430 join \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u043d\u043e\u0434\u0443 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 swarm, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u0445.<br \/>  \u041f\u0435\u0440\u0435\u0434\u0430\u0432 \u0430\u0434\u0440\u0435\u0441 Consul, \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c service discovery.<\/p>\n<p>  \u0418, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, Registrator: <br \/>  <code>docker run --restart=unless-stopped -d \\<br \/>   --name=registrator \\<br \/>   --net=host \\<br \/>   --volume=\/var\/run\/docker.sock:\/tmp\/docker.sock \\<br \/>   gliderlabs\/registrator:latest \\<br \/>   consul:\/\/`ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`:8500<br \/>  <\/code><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u043d\u043e\u0434\u0430\u043c.<\/p>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c Consul:<br \/>  <code>docker run --restart=unless-stopped -d -h `hostname` --name consul -v \/mnt:\/data \\<br \/>   -p `ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`:8300:8300 \\<br \/>   -p `ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`:8301:8301 \\<br \/>   -p `ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`:8301:8301\/udp \\<br \/>   -p `ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`:8302:8302 \\<br \/>   -p `ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`:8302:8302\/udp \\<br \/>   -p `ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`:8400:8400 \\<br \/>   -p `ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`:8500:8500 \\<br \/>   -p 172.17.0.1:53:53\/udp \\<br \/>   gliderlabs\/consul-server -server -rejoin -advertise `ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'` -join &lt;primary_node_ip&gt;<br \/>  <\/code><\/p>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435<i> -join<\/i> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0430\u0434\u0440\u0435\u0441 \u043d\u0430\u0448\u0435\u0439 primary-node, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043b\u0438 \u0432\u044b\u0448\u0435.<\/p>\n<p>  Swarm manager: <\/p>\n<p>  <code>docker run --restart=unless-stopped -d \\<br \/>   -p 3375:2375 \\<br \/>   swarm manage \\<br \/>   --advertise `ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`:3375 \\<br \/>   consul:\/\/`ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`:8500\/<br \/>  <\/code><\/p>\n<p>  \u041f\u0440\u0438\u0446\u0435\u043f\u0438\u043c \u043d\u043e\u0434\u0443 \u043a \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0443: <\/p>\n<p>  <code>docker run --restart=unless-stopped -d \\<br \/>   swarm join \\<br \/>   --advertise=`ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`:2375 \\<br \/>   consul:\/\/`ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`:8500\/<br \/>  <\/code><\/p>\n<p>  \u0418 Registrator \u0434\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0432 Consul.<\/p>\n<p>  <code>docker run --restart=unless-stopped -d \\<br \/>   --name=registrator \\<br \/>   --net=host \\<br \/>   --volume=\/var\/run\/docker.sock:\/tmp\/docker.sock \\<br \/>   gliderlabs\/registrator:latest \\<br \/>   -ip `ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'` \\<br \/>   consul:\/\/`ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`:8500<br \/>  <\/code><\/p>\n<h4>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e \u00ab\u0431\u044b\u0441\u0442\u0440\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b\u00bb<\/h4>\n<p>  \u0420\u0435\u0441\u0442\u0430\u0440\u0442 \u0432\u0441\u0435\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432<br \/>  <code>docker stop $(docker ps -aq);docker start $(docker ps -aq)<\/code><\/p>\n<p>  \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432<br \/>  <code>docker stop $(docker ps -aq);docker rm $(docker ps -aq)<\/code><\/p>\n<p>  \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043d\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432:<br \/>  <code>docker stop $(docker ps -a | grep 'Exited' | awk '{print $1}') && docker rm $(docker ps -a | grep 'Exited' | awk '{print $1}')<\/code><\/p>\n<p>  \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0442\u043e\u043c\u043e\u0432 (\u0437\u0430\u043d\u044f\u0442\u044b\u0435 \u043d\u0435 \u0443\u0434\u043b\u044f\u044e\u0442\u0441\u044f) <br \/>  <code>docker volume rm $(docker volume ls -q);<\/code><\/p>\n<p>  \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043e\u0431\u0440\u0430\u0437\u043e\u0432 (\u0437\u0430\u043d\u044f\u0442\u044b\u0435 \u043d\u0435 \u0443\u0434\u043b\u044f\u044e\u0442\u0441\u044f) <br \/>  <code>docker rmi $(docker images -q);<\/code><\/p>\n<h3>Frontend<\/h3>\n<p>  \u0418\u0442\u0430\u043a, \u043d\u0430\u0448 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0433\u043e\u0442\u043e\u0432 \u043a \u0442\u0440\u0443\u0434\u0443 \u0438 \u043e\u0431\u043e\u0440\u043e\u043d\u0435. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043d\u0430 \u043d\u0430\u0448\u0443 primary-\u043d\u043e\u0434\u0443 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a. <br \/>  \u041a\u0430\u043a \u044f \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b \u0432\u044b\u0448\u0435, \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435, \u0431\u044b\u0432\u0430\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e<\/p>\n<p>  <code>export DOCKER_HOST=tcp:\/\/&lt;my_swarm_ip&gt;:3375<\/code><br \/>  \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b docker \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e, \u043d\u043e \u0443\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044f \u043d\u0435 \u0441 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043d\u043e\u0434\u043e\u0439, \u0430 \u0441 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043e\u043c \u0432 \u0446\u0435\u043b\u043e\u043c.<\/p>\n<p>  \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0431\u0440\u0430\u0437\u043e\u043c phusion-baseimage \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0435\u0433\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u044b. \u0412 \u043d\u0435\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c Consul Template \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b nginx \u0432 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0438 \u0434\u0435\u0440\u0436\u0430\u043b \u0432 \u043d\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0436\u0438\u0432\u044b\u0445 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432. \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u0430\u043f\u043a\u0443 nginx-lb \u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0432 \u043d\u0435\u0439 \u0444\u0430\u0439\u043b Dockerfile \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/b><\/p>\n<div class=\"spoiler_text\"><code>FROM phusion\/baseimage:0.9.18<\/p>\n<p>  ENV NGINX_VERSION 1.8.1-1~trusty<\/p>\n<p>  ENV DEBIAN_FRONTEND=noninteractive<\/p>\n<p>  # Avoid ERROR: invoke-rc.d: policy-rc.d denied execution of start.<br \/>  RUN echo &quot;#!\/bin\/sh\\nexit 0&quot; &gt; \/usr\/sbin\/policy-rc.d<\/p>\n<p>  RUN curl -sS http:\/\/nginx.org\/keys\/nginx_signing.key | sudo apt-key add - && \\<br \/>   echo 'deb http:\/\/nginx.org\/packages\/ubuntu\/ trusty nginx' &gt;&gt; \/etc\/apt\/sources.list && \\<br \/>   echo 'deb-src http:\/\/nginx.org\/packages\/ubuntu\/ trusty nginx' &gt;&gt; \/etc\/apt\/sources.list && \\<br \/>   apt-get update -qq && apt-get install -y unzip ca-certificates nginx=${NGINX_VERSION} && \\<br \/>   rm -rf \/var\/lib\/apt\/lists\/* && \\<br \/>   ln -sf \/dev\/stdout \/var\/log\/nginx\/access.log && \\<br \/>   ln -sf \/dev\/stderr \/var\/log\/nginx\/error.log<\/p>\n<p>  EXPOSE 80<\/p>\n<p>  # \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0438 \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0432\u0435\u0440\u0441\u0438\u044e Consul Template<br \/>  ADD https:\/\/releases.hashicorp.com\/consul-template\/0.12.2\/consul-template_0.12.2_linux_amd64.zip \/usr\/bin\/<br \/>  RUN unzip \/usr\/bin\/consul-template_0.12.2_linux_amd64.zip -d \/usr\/local\/bin<\/p>\n<p>  ADD nginx.service \/etc\/service\/nginx\/run<br \/>  RUN chmod a+x \/etc\/service\/nginx\/run<br \/>  ADD consul-template.service \/etc\/service\/consul-template\/run<br \/>  RUN chmod a+x \/etc\/service\/consul-template\/run<\/p>\n<p>  RUN rm -v \/etc\/nginx\/conf.d\/*.conf<br \/>  ADD app.conf.ctmpl \/etc\/consul-templates\/app.conf.ctmpl<\/p>\n<p>  CMD [&quot;\/sbin\/my_init&quot;]<br \/>  <\/code>  <\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 nignx. \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0444\u0430\u0439\u043b nginx.service:<\/p>\n<p>  <code>#!\/bin\/sh<\/p>\n<p>  \/usr\/sbin\/nginx -c \/etc\/nginx\/nginx.conf -t && \\<br \/>  exec \/usr\/sbin\/nginx -c \/etc\/nginx\/nginx.conf -g &quot;daemon off;&quot;<br \/>  <\/code><\/p>\n<p>  \u0418 \u0441\u043a\u0440\u0438\u043f\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 Consul Template:<\/p>\n<p>  <code>#!\/bin\/sh<\/p>\n<p>  exec \/usr\/local\/bin\/consul-template \\<br \/>   -consul consul:8500 \\<br \/>   -template &quot;\/etc\/consul-templates\/app.conf.ctmpl:\/etc\/nginx\/conf.d\/app.conf:sv hup nginx || true&quot;<br \/>  <\/code><\/p>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0448\u0430\u0431\u043b\u043e\u043d \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 nginx \u0434\u043b\u044f Consul Template. \u0421\u043e\u0437\u0434\u0430\u0451\u043c app.conf:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/b><\/p>\n<div class=\"spoiler_text\"><code>upstream fpm {<br \/>   least_conn;<br \/>   {{range service &quot;fpm&quot;}}server {{.Address}}:{{.Port}} max_fails=3 fail_timeout=60 weight=1;<br \/>   {{else}}server 127.0.0.1:65535{{end}}<br \/>  }<\/p>\n<p>  server {<br \/>   listen 80;<br \/>   root \/var\/www\/html;<br \/>   index index.php index.html index.htm;<\/p>\n<p>  server_name domain.example.com;<\/p>\n<p>   sendfile off;<\/p>\n<p>  location \/ {<br \/>   try_files $uri $uri\/ \/index.php?q=$uri&$args;<br \/>   }<\/p>\n<p>  location \/doc\/ {<br \/>   alias \/usr\/share\/doc\/;<br \/>   autoindex on;<br \/>   allow 127.0.0.1;<br \/>   allow ::1;<br \/>   deny all;<br \/>   }<\/p>\n<p>  error_page 500 502 503 504 \/50x.html;<br \/>   location = \/50x.html {<br \/>   root \/usr\/share\/nginx\/www;<br \/>   }<\/p>\n<p>  location ~ \\.php$ {<br \/>   try_files $uri =404;<br \/>   fastcgi_param SCRIPT_FILENAME $document_root\/$fastcgi_script_name;<br \/>   fastcgi_split_path_info ^(.+\\.php)(\/.+)$;<br \/>   fastcgi_pass fpm;<br \/>   fastcgi_index index.php;<br \/>   include fastcgi_params;<br \/>   }<\/p>\n<p>  location ~ \/\\.ht {<br \/>   deny all;<br \/>   }<br \/>  }<br \/>  <\/code>  <\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0437:<br \/>  <code>bocker build -t nginx-lb . <\/code><\/p>\n<p>  \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430: \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043e\u0431\u0440\u0430\u0437 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u043d\u043e\u0434\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0440\u0443\u043a\u0430\u043c\u0438 \u0438\u043b\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u0435 <a href=\"https:\/\/hub.docker.com\">\u043e\u0431\u043b\u0430\u043a\u043e Docker Hub<\/a>, \u043e\u0442\u043a\u0443\u0434\u0430 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0437\u044f\u0442\u044c \u043a\u043e\u0433\u0434\u0430 \u0443\u0433\u043e\u0434\u043d\u043e \u0438 \u0438\u0437 \u043b\u044e\u0431\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430 \u0431\u0435\u0437 \u043b\u0438\u0448\u043d\u0438\u0445 \u0442\u0435\u043b\u043e\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0439. \u0418\u043b\u0438 \u0436\u0435 \u0432 \u0441\u0432\u043e\u0439 \u043b\u0438\u0447\u043d\u044b\u0439 <a href=\"https:\/\/docs.docker.com\/registry\/deploying\/\">Docker Registry.<br \/>  \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 Docker Hub \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 <a href=\"https:\/\/docs.docker.com\/docker-hub\/overview\/\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440:<\/p>\n<p>  <code>docker run -p 80:80 -v \/mnt\/storage\/www:\/var\/www\/html -d --name balancer --link consul:consul -l &quot;SERVICE_NAME=balancer&quot; -l &quot;SERVICE_TAGS=balancer&quot; \\<br \/>  -l &quot;SERVICE_CHECK_HTTP=\/&quot; -l &quot;SERVICE_CHECK_INTERVAL=15s&quot; -l &quot;SERVICE_CHECK_TIMEOUT=1s&quot; nginx-lb<br \/>  <\/code><\/p>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0442\u043a\u043d\u0443\u0432\u0448\u0438\u0441\u044c \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043e\u043c. \u0414\u0430, \u043e\u043d \u043e\u0442\u0434\u0430\u0441\u0442 Bad Gateway, \u0442.\u043a. \u0443 \u043d\u0430\u0441 \u043d\u0435\u0442 \u043d\u0438 \u0441\u0442\u0430\u0442\u0438\u043a\u0438, \u043d\u0438 \u0431\u044d\u043a\u0435\u043d\u0434\u0430.<\/p>\n<h3>Backend<\/h3>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u0441 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u043e\u043c \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c. \u0422\u0435\u043f\u0435\u0440\u044c \u043a\u0442\u043e-\u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c php-\u043a\u043e\u0434. \u0412 \u044d\u0442\u043e\u043c \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0436\u0435\u0442 <a href=\"https:\/\/github.com\/docker-library\/wordpress\/tree\/master\/fpm\">\u043e\u0431\u0440\u0430\u0437 WordPress \u0441 FPM<\/a><br \/>  \u0417\u0434\u0435\u0441\u044c \u043d\u0430\u043c \u0442\u043e\u0436\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0437. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e \u2014 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c Consul Template \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 MySQL. \u041d\u0430\u043c \u0436\u0435 \u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0438\u0441\u043a\u0430\u0442\u044c \u043d\u0430 \u043a\u0430\u043a\u043e\u0439 \u043d\u043e\u0434\u0435 \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u0441\u0435\u0440\u0432\u0435\u0440 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0430\u0434\u0440\u0435\u0441 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043e\u0431\u0440\u0430\u0437\u0430? \u042d\u0442\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043d\u043e \u043c\u044b \u2014 \u043b\u0435\u043d\u0442\u044f\u0438, \u0430 \u00ab\u043b\u0435\u043d\u044c \u2014 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044c \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0430\u00bb (\u0441).<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Dockerfile<\/b><\/p>\n<div class=\"spoiler_text\"><code>FROM php:5.6-fpm<\/p>\n<p>  # install the PHP extensions we need<br \/>  RUN apt-get update && apt-get install -y unzip libpng12-dev libjpeg-dev && rm -rf \/var\/lib\/apt\/lists\/* \\<br \/>   && docker-php-ext-configure gd --with-png-dir=\/usr --with-jpeg-dir=\/usr \\<br \/>   && docker-php-ext-install gd mysqli opcache<\/p>\n<p>  # set recommended PHP.ini settings<br \/>  # see https:\/\/secure.php.net\/manual\/en\/opcache.installation.php<br \/>  RUN { \\<br \/>   echo 'opcache.memory_consumption=128'; \\<br \/>   echo 'opcache.interned_strings_buffer=8'; \\<br \/>   echo 'opcache.max_accelerated_files=4000'; \\<br \/>   echo 'opcache.revalidate_freq=60'; \\<br \/>   echo 'opcache.fast_shutdown=1'; \\<br \/>   echo 'opcache.enable_cli=1'; \\<br \/>   } &gt; \/usr\/local\/etc\/php\/conf.d\/opcache-recommended.ini<\/p>\n<p>  VOLUME \/var\/www\/html<\/p>\n<p>  ENV WORDPRESS_VERSION 4.4.2<br \/>  ENV WORDPRESS_SHA1 7444099fec298b599eb026e83227462bcdf312a6<\/p>\n<p>  # upstream tarballs include .\/wordpress\/ so this gives us \/usr\/src\/wordpress<br \/>  RUN curl -o wordpress.tar.gz -SL https:\/\/wordpress.org\/wordpress-${WORDPRESS_VERSION}.tar.gz \\<br \/>   && echo &quot;$WORDPRESS_SHA1 *wordpress.tar.gz&quot; | sha1sum -c - \\<br \/>   && tar -xzf wordpress.tar.gz -C \/usr\/src\/ \\<br \/>   && rm wordpress.tar.gz \\<br \/>   && chown -R www-data:www-data \/usr\/src\/wordpress<\/p>\n<p>  ADD https:\/\/releases.hashicorp.com\/consul-template\/0.12.2\/consul-template_0.12.2_linux_amd64.zip \/usr\/bin\/<br \/>  RUN unzip \/usr\/bin\/consul-template_0.12.2_linux_amd64.zip -d \/usr\/local\/bin<br \/>  # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0411\u0414.<br \/>  ADD db.conf.php.ctmpl \/db.conf.php.ctmpl<br \/>  # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 consul-template<br \/>  ADD consul-template.sh \/usr\/local\/bin\/consul-template.sh<br \/>  # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f MySQL \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u0430\u0437\u044b \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 WP<br \/>  ADD mysql.ctmpl \/tmp\/mysql.ctmpl<\/p>\n<p>  COPY docker-entrypoint.sh \/entrypoint.sh<\/p>\n<p>  # grr, ENTRYPOINT resets CMD now<br \/>  ENTRYPOINT [&quot;\/entrypoint.sh&quot;]<br \/>  CMD [&quot;php-fpm&quot;]<br \/>  <\/code>  <\/div>\n<\/div>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a MySQL db.conf.php.ctmpl:<\/p>\n<pre><code class=\"php\">&lt;?php {{range service &quot;mysql&quot;}} define('DB_HOST', '{{.Address}}'); {{else}} define('DB_HOST', 'mysql'); {{end}} ?&gt; <\/code><\/pre>\n<p>  \u0418 \u0441\u043a\u0440\u0438\u043f\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 consul-template.sh:<\/p>\n<pre><code class=\"bash\">#!\/bin\/sh echo &quot;Starting Consul Template&quot;  exec \/usr\/local\/bin\/consul-template \\     -consul consul:8500 \\     -template &quot;\/db.conf.php.ctmpl:\/var\/www\/html\/db.conf.php&quot; <\/code><\/pre>\n<p>  \u0428\u0430\u0431\u043b\u043e\u043d \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 MySQL mysql.ctmpl:<\/p>\n<p>  <code>{{range service &quot;mysql&quot;}}{{.Address}} {{.Port}} {{end}}<br \/>  <\/code><\/p>\n<p>  \u0412 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 <i>docker-entrypoint.sh<\/i> \u043d\u0430\u043c \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0449\u0435\u0439. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e \u2014 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c Consul Template \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 MySQL \u0438 \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0438\u0442\u044c fpm \u043d\u0430 <i>0.0.0.0<\/i>, \u0442. \u043a. \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u043d \u0441\u043b\u0443\u0448\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e 127.0.0.1:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"bash\">#!\/bin\/bash set -e  # \u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u043c \u0445\u043e\u0441\u0442 \u0411\u0414 WORDPRESS_DB_HOST=&quot;$(\/usr\/local\/bin\/consul-template --template=\/tmp\/mysql-master.ctmpl --consul=consul:8500 --dry -once | awk '{print $1}' | tail -1)&quot; # \u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0430\u0435\u043c \u043f\u043e\u0440\u0442 \u0411\u0414 WORDPRESS_DB_PORT=&quot;$(\/usr\/local\/bin\/consul-template --template=\/tmp\/mysql-master.ctmpl --consul=consul:8500 --dry -once | awk '{print $2}' | tail -1)&quot;  if [[ &quot;$1&quot; == apache2* ]] || [ &quot;$1&quot; == php-fpm ]; then \tif [ -n &quot;$MYSQL_PORT_3306_TCP&quot; ]; then \t\tif [ -z &quot;$WORDPRESS_DB_HOST&quot; ]; then \t\t\tWORDPRESS_DB_HOST='mysql' \t\telse \t\t\techo &gt;&2 'warning: both WORDPRESS_DB_HOST and MYSQL_PORT_3306_TCP found' \t\t\techo &gt;&2 &quot;  Connecting to WORDPRESS_DB_HOST ($WORDPRESS_DB_HOST)&quot; \t\t\techo &gt;&2 '  instead of the linked mysql container' \t\tfi \tfi  \tif [ -z &quot;$WORDPRESS_DB_HOST&quot; ]; then \t\techo &gt;&2 'error: missing WORDPRESS_DB_HOST and MYSQL_PORT_3306_TCP environment variables' \t\techo &gt;&2 '  Did you forget to --link some_mysql_container:mysql or set an external db' \t\techo &gt;&2 '  with -e WORDPRESS_DB_HOST=hostname:port?' \t\texit 1 \tfi  \t# if we're linked to MySQL and thus have credentials already, let's use them \t: ${WORDPRESS_DB_USER:=${MYSQL_ENV_MYSQL_USER:-root}} \tif [ &quot;$WORDPRESS_DB_USER&quot; = 'root' ]; then \t\t: ${WORDPRESS_DB_PASSWORD:=$MYSQL_ENV_MYSQL_ROOT_PASSWORD} \tfi \t: ${WORDPRESS_DB_PASSWORD:=$MYSQL_ENV_MYSQL_PASSWORD} \t: ${WORDPRESS_DB_NAME:=${MYSQL_ENV_MYSQL_DATABASE:-wordpress}}  \tif [ -z &quot;$WORDPRESS_DB_PASSWORD&quot; ]; then \t\techo &gt;&2 'error: missing required WORDPRESS_DB_PASSWORD environment variable' \t\techo &gt;&2 '  Did you forget to -e WORDPRESS_DB_PASSWORD=... ?' \t\techo &gt;&2 \t\techo &gt;&2 '  (Also of interest might be WORDPRESS_DB_USER and WORDPRESS_DB_NAME.)' \t\texit 1 \tfi  \tif ! [ -e index.php -a -e wp-includes\/version.php ]; then \t\techo &gt;&2 &quot;WordPress not found in $(pwd) - copying now...&quot; \t\tif [ &quot;$(ls -A)&quot; ]; then \t\t\techo &gt;&2 &quot;WARNING: $(pwd) is not empty - press Ctrl+C now if this is an error!&quot; \t\t\t( set -x; ls -A; sleep 10 ) \t\tfi \t\ttar cf - --one-file-system -C \/usr\/src\/wordpress . | tar xf - \t\techo &gt;&2 &quot;Complete! WordPress has been successfully copied to $(pwd)&quot; \t\tif [ ! -e .htaccess ]; then \t\t\t# NOTE: The &quot;Indexes&quot; option is disabled in the php:apache base image \t\t\tcat &gt; .htaccess &lt;&lt;-'EOF' \t\t\t\t# BEGIN WordPress \t\t\t\t&lt;IfModule mod_rewrite.c&gt; \t\t\t\tRewriteEngine On \t\t\t\tRewriteBase \/ \t\t\t\tRewriteRule ^index\\.php$ - [L] \t\t\t\tRewriteCond %{REQUEST_FILENAME} !-f \t\t\t\tRewriteCond %{REQUEST_FILENAME} !-d \t\t\t\tRewriteRule . \/index.php [L] \t\t\t\t&lt;\/IfModule&gt; \t\t\t\t# END WordPress \t\t\tEOF \t\t\tchown www-data:www-data .htaccess \t\tfi \tfi  \t# TODO handle WordPress upgrades magically in the same way, but only if wp-includes\/version.php's $wp_version is less than \/usr\/src\/wordpress\/wp-includes\/version.php's $wp_version  \t# version 4.4.1 decided to switch to windows line endings, that breaks our seds and awks \t# https:\/\/github.com\/docker-library\/wordpress\/issues\/116 \t# https:\/\/github.com\/WordPress\/WordPress\/commit\/1acedc542fba2482bab88ec70d4bea4b997a92e4 \tsed -ri 's\/\\r\\n|\\r\/\\n\/g' wp-config*  \t# FPM \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043b\u0443\u0448\u0430\u0442\u044c  0.0.0.0 \tsed -i 's\/listen = 127.0.0.1:9000\/listen = 0.0.0.0:9000\/g' \/usr\/local\/etc\/php-fpm.d\/www.conf  \tif [ ! -e wp-config.php ]; then \t\tawk '\/^\\\/\\*.*stop editing.*\\*\\\/$\/ && c == 0 { c = 1; system(&quot;cat&quot;) } { print }' wp-config-sample.php &gt; wp-config.php &lt;&lt;'EOPHP'   \/\/ If we're behind a proxy server and using HTTPS, we need to alert WordPress of that fact \/\/ see also http:\/\/codex.wordpress.org\/Administration_Over_SSL#Using_a_Reverse_Proxy if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') { \t$_SERVER['HTTPS'] = 'on'; }  EOPHP \t\t# \u0418\u043d\u043a\u043b\u0443\u0434\u0438\u043c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 Consul Template \u043a\u043e\u043d\u0444\u0438\u0433 \u0441 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u043c MySQL                 DB_HOST_PRE=$(grep 'DB_HOST' wp-config.php)                 sed -i &quot;s\/$DB_HOST_PRE\/include 'db.conf.php';\/g&quot; wp-config.php \t\tchown www-data:www-data wp-config.php \tfi  \t# see http:\/\/stackoverflow.com\/a\/2705678\/433558 \tsed_escape_lhs() { \t\techo &quot;$@&quot; | sed 's\/[]\\\/$*.^|[]\/\\\\&\/g' \t} \tsed_escape_rhs() { \t\techo &quot;$@&quot; | sed 's\/[\\\/&]\/\\\\&\/g' \t} \tphp_escape() { \t\tphp -r 'var_export(('$2') $argv[1]);' &quot;$1&quot; \t} \tset_config() { \t\tkey=&quot;$1&quot; \t\tvalue=&quot;$2&quot; \t\tvar_type=&quot;${3:-string}&quot; \t\tstart=&quot;(['\\&quot;])$(sed_escape_lhs &quot;$key&quot;)\\2\\s*,&quot; \t\tend=&quot;\\);&quot; \t\tif [ &quot;${key:0:1}&quot; = '$' ]; then \t\t\tstart=&quot;^(\\s*)$(sed_escape_lhs &quot;$key&quot;)\\s*=&quot; \t\t\tend=&quot;;&quot; \t\tfi \t\tsed -ri &quot;s\/($start\\s*).*($end)$\/\\1$(sed_escape_rhs &quot;$(php_escape &quot;$value&quot; &quot;$var_type&quot;)&quot;)\\3\/&quot; wp-config.php \t}  \tset_config 'DB_HOST' &quot;$WORDPRESS_DB_HOST&quot; \tset_config 'DB_USER' &quot;$WORDPRESS_DB_USER&quot; \tset_config 'DB_PASSWORD' &quot;$WORDPRESS_DB_PASSWORD&quot; \tset_config 'DB_NAME' &quot;$WORDPRESS_DB_NAME&quot;  \t# allow any of these &quot;Authentication Unique Keys and Salts.&quot; to be specified via \t# environment variables with a &quot;WORDPRESS_&quot; prefix (ie, &quot;WORDPRESS_AUTH_KEY&quot;) \tUNIQUES=( \t\tAUTH_KEY \t\tSECURE_AUTH_KEY \t\tLOGGED_IN_KEY \t\tNONCE_KEY \t\tAUTH_SALT \t\tSECURE_AUTH_SALT \t\tLOGGED_IN_SALT \t\tNONCE_SALT \t) \tfor unique in &quot;${UNIQUES[@]}&quot;; do \t\teval unique_value=\\$WORDPRESS_$unique \t\tif [ &quot;$unique_value&quot; ]; then \t\t\tset_config &quot;$unique&quot; &quot;$unique_value&quot; \t\telse \t\t\t# if not specified, let's generate a random value \t\t\tcurrent_set=&quot;$(sed -rn &quot;s\/define\\((([\\'\\&quot;])$unique\\2\\s*,\\s*)(['\\&quot;])(.*)\\3\\);\/\\4\/p&quot; wp-config.php)&quot; \t\t\tif [ &quot;$current_set&quot; = 'put your unique phrase here' ]; then \t\t\t\tset_config &quot;$unique&quot; &quot;$(head -c1M \/dev\/urandom | sha1sum | cut -d' ' -f1)&quot; \t\t\tfi \t\tfi \tdone  \tif [ &quot;$WORDPRESS_TABLE_PREFIX&quot; ]; then \t\tset_config '$table_prefix' &quot;$WORDPRESS_TABLE_PREFIX&quot; \tfi  \tif [ &quot;$WORDPRESS_DEBUG&quot; ]; then \t\tset_config 'WP_DEBUG' 1 boolean \tfi  \tTERM=dumb php -- &quot;$WORDPRESS_DB_HOST&quot; &quot;$WORDPRESS_DB_USER&quot; &quot;$WORDPRESS_DB_PASSWORD&quot; &quot;$WORDPRESS_DB_NAME&quot; &lt;&lt;'EOPHP' &lt;?php \/\/ database might not exist, so let's try creating it (just to be safe)  $stderr = fopen('php:\/\/stderr', 'w');  list($host, $port) = explode(':', $argv[1], 2);  $maxTries = 10; do { \t$mysql = new mysqli($host, $argv[2], $argv[3], '', (int)$port); \tif ($mysql-&gt;connect_error) { \t\tfwrite($stderr, &quot;\\n&quot; . 'MySQL Connection Error: (' . $mysql-&gt;connect_errno . ') ' . $mysql-&gt;connect_error . &quot;\\n&quot;); \t\t--$maxTries; \t\tif ($maxTries &lt;= 0) { \t\t\texit(1); \t\t} \t\tsleep(3); \t} } while ($mysql-&gt;connect_error);  if (!$mysql-&gt;query('CREATE DATABASE IF NOT EXISTS `' . $mysql-&gt;real_escape_string($argv[4]) . '`')) { \tfwrite($stderr, &quot;\\n&quot; . 'MySQL &quot;CREATE DATABASE&quot; Error: ' . $mysql-&gt;error . &quot;\\n&quot;); \t$mysql-&gt;close(); \texit(1); }  $mysql-&gt;close(); EOPHP fi  # \u0418\u043d\u043a\u043b\u0443\u0434\u0438\u043c consul-template exec \/usr\/local\/sbin\/php-fpm & exec \/usr\/local\/bin\/consul-template.sh exec &quot;$@&quot; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0425\u043e\u0440\u043e\u0448\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0431\u0435\u0440\u0451\u043c \u043e\u0431\u0440\u0430\u0437:<\/p>\n<p>  <code>docker build -t fpm .<br \/>  <\/code><\/p>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u043a\u0430 \u0447\u0442\u043e \u043d\u0435 \u0441\u0442\u043e\u0438\u0442, \u0442. \u043a. \u0443 \u043d\u0430\u0441 \u0435\u0449\u0435 \u043d\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b WordPress<\/p>\n<p>  <code>docker run --name fpm.0 -d -v \/mnt\/storage\/www:\/var\/www\/html \\<br \/>  -e WORDPRESS_DB_NAME=wordpressp -e WORDPRESS_DB_USER=wordpress -e WORDPRESS_DB_PASSWORD=wordpress \\<br \/>  --link consul:consul -l &quot;SERVICE_NAME=php-fpm&quot; -l &quot;SERVICE_PORT=9000&quot; -p 9000:9000 fpm<br \/>  <\/code><\/p>\n<h3>\u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445:<\/h3>\n<h4>Master<\/h4>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043e\u0431\u0440\u0430\u0437\u043e\u043c <a href=\"https:\/\/github.com\/docker-library\/mysql\/tree\/4e022c06314ff6047dabc4abee2f222ae9ce564d\/5.7\">MySQL 5.7<\/a>.<\/p>\n<p>  \u041d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0436\u0435 \u0435\u0433\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e: \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0432\u0430 \u043e\u0431\u0440\u0430\u0437\u0430. \u041e\u0434\u0438\u043d \u2014 \u0434\u043b\u044f Master, \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 \u0434\u043b\u044f Slave.<br \/>  \u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u043e\u0431\u0440\u0430\u0437\u0430 \u0434\u043b\u044f Master. <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041d\u0430\u0448 Dockerfile<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>FROM debian:jessie  # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added RUN groupadd -r mysql && useradd -r -g mysql mysql  RUN mkdir \/docker-entrypoint-initdb.d  # FATAL ERROR: please install the following Perl modules before executing \/usr\/local\/mysql\/scripts\/mysql_install_db: # File::Basename # File::Copy # Sys::Hostname # Data::Dumper RUN apt-get update && apt-get install -y perl pwgen --no-install-recommends && rm -rf \/var\/lib\/apt\/lists\/*  # gpg: key 5072E1F5: public key &quot;MySQL Release Engineering &lt;mysql-build@oss.oracle.com&gt;&quot; imported RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5  ENV MYSQL_MAJOR 5.7 ENV MYSQL_VERSION 5.7.11-1debian8  RUN echo &quot;deb http:\/\/repo.mysql.com\/apt\/debian\/ jessie mysql-${MYSQL_MAJOR}&quot; &gt; \/etc\/apt\/sources.list.d\/mysql.list  # the &quot;\/var\/lib\/mysql&quot; stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already &quot;configured&quot; (ie, stuff in \/var\/lib\/mysql\/mysql) # also, we set debconf keys to make APT a little quieter RUN { \\ \t\techo mysql-community-server mysql-community-server\/data-dir select ''; \\ \t\techo mysql-community-server mysql-community-server\/root-pass password ''; \\ \t\techo mysql-community-server mysql-community-server\/re-root-pass password ''; \\ \t\techo mysql-community-server mysql-community-server\/remove-test-db select false; \\ \t} | debconf-set-selections \\ \t&& apt-get update && apt-get install -y mysql-server=&quot;${MYSQL_VERSION}&quot; && rm -rf \/var\/lib\/apt\/lists\/* \\ \t&& rm -rf \/var\/lib\/mysql && mkdir -p \/var\/lib\/mysql  # comment out a few problematic configuration values # don't reverse lookup hostnames, they are usually another container RUN sed -Ei 's\/^(bind-address|log)\/#&\/' \/etc\/mysql\/my.cnf \\ \t&& echo 'skip-host-cache\\nskip-name-resolve' | awk '{ print } $1 == &quot;[mysqld]&quot; && c == 0 { c = 1; system(&quot;cat&quot;) }' \/etc\/mysql\/my.cnf &gt; \/tmp\/my.cnf \\ \t&& mv \/tmp\/my.cnf \/etc\/mysql\/my.cnf    VOLUME \/var\/lib\/mysql  COPY docker-entrypoint.sh \/entrypoint.sh ENTRYPOINT [&quot;\/entrypoint.sh&quot;]  EXPOSE 3306 CMD [&quot;mysqld&quot;] <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0421\u043a\u0440\u0438\u043f\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 MySQL:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">docker-entrypoint.sh<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"bash\">#!\/bin\/bash set -eo pipefail # if command starts with an option, prepend mysqld if [ &quot;${1:0:1}&quot; = '-' ]; then \tset -- mysqld &quot;$@&quot; fi  if [ &quot;$1&quot; = 'mysqld' ]; then \t# Get config \tDATADIR=&quot;$(&quot;$@&quot; --verbose --help 2&gt;\/dev\/null | awk '$1 == &quot;datadir&quot; { print $2; exit }')&quot;  \tif [ ! -d &quot;$DATADIR\/mysql&quot; ]; then \t\tif [ -z &quot;$MYSQL_ROOT_PASSWORD&quot; -a -z &quot;$MYSQL_ALLOW_EMPTY_PASSWORD&quot; -a -z &quot;$MYSQL_RANDOM_ROOT_PASSWORD&quot; ]; then \t\t\techo &gt;&2 'error: database is uninitialized and password option is not specified ' \t\t\techo &gt;&2 '  You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD' \t\t\texit 1 \t\tfi  \t\tmkdir -p &quot;$DATADIR&quot; \t\tchown -R mysql:mysql &quot;$DATADIR&quot;  \t\techo 'Initializing database' \t\t&quot;$@&quot; --initialize-insecure \t\techo 'Database initialized'  \t\t&quot;$@&quot; --skip-networking & \t\tpid=&quot;$!&quot;  \t\tmysql=( mysql --protocol=socket -uroot )  \t\tfor i in {30..0}; do \t\t\tif echo 'SELECT 1' | &quot;${mysql[@]}&quot; &&gt; \/dev\/null; then \t\t\t\tbreak \t\t\tfi \t\t\techo 'MySQL init process in progress...' \t\t\tsleep 1 \t\tdone \t\tif [ &quot;$i&quot; = 0 ]; then \t\t\techo &gt;&2 'MySQL init process failed.' \t\t\texit 1 \t\tfi  \t\tif [ -n &quot;${REPLICATION_MASTER}&quot; ]; then \t\t\techo &quot;=&gt; Configuring MySQL replication as master (1\/2) ...&quot; \t\t\tif [ ! -f \/replication_set.1 ]; then \t\t        \techo &quot;=&gt; Writting configuration file \/etc\/mysql\/my.cnf with server-id=1&quot; \t\t\t        echo 'server-id = 1' &gt;&gt; \/etc\/mysql\/my.cnf \t\t\t        echo 'log-bin = mysql-bin' &gt;&gt; \/etc\/mysql\/my.cnf \t\t        \ttouch \/replication_set.1 \t    \t\telse \t\t        \techo &quot;=&gt; MySQL replication master already configured, skip&quot; \t\t\tfi \t\tfi \t\t# Set MySQL REPLICATION - SLAVE \t\tif [ -n &quot;${REPLICATION_SLAVE}&quot; ]; then \t\t    echo &quot;=&gt; Configuring MySQL replication as slave (1\/2) ...&quot; \t\t    if [ -n &quot;${MYSQL_PORT_3306_TCP_ADDR}&quot; ] && [ -n &quot;${MYSQL_PORT_3306_TCP_PORT}&quot; ]; then \t\t        if [ ! -f \/replication_set.1 ]; then \t\t            echo &quot;=&gt; Writting configuration file \/etc\/mysql\/my.cnf with server-id=2&quot; \t\t            echo 'server-id = 2' &gt;&gt; \/etc\/mysql\/my.cnf \t\t            echo 'log-bin = mysql-bin' &gt;&gt; \/etc\/mysql\/my.cnf                     echo 'log-bin=slave-bin' &gt;&gt; \/etc\/mysql\/my.cnf \t\t            touch \/replication_set.1 \t\t        else \t\t            echo &quot;=&gt; MySQL replication slave already configured, skip&quot; \t\t        fi \t\t    else \t\t        echo &quot;=&gt; Cannot configure slave, please link it to another MySQL container with alias as 'mysql'&quot; \t\t        exit 1 \t\t    fi \t\tfi  \t\t# Set MySQL REPLICATION - SLAVE \t\tif [ -n &quot;${REPLICATION_SLAVE}&quot; ]; then \t\t    echo &quot;=&gt; Configuring MySQL replication as slave (2\/2) ...&quot; \t\t    if [ -n &quot;${MYSQL_PORT_3306_TCP_ADDR}&quot; ] && [ -n &quot;${MYSQL_PORT_3306_TCP_PORT}&quot; ]; then \t\t        if [ ! -f \/replication_set.2 ]; then \t\t            echo &quot;=&gt; Setting master connection info on slave&quot; \t\t\techo &quot;!!! DEBUG: ${REPLICATION_USER}, ${REPLICATION_PASS}.&quot; \t\t\t\t&quot;${mysql[@]}&quot; &lt;&lt;-EOSQL \t\t\t\t\t-- What's done in this file shouldn't be replicated \t\t\t\t\t--  or products like mysql-fabric won't work \t\t\t\t\tSET @@SESSION.SQL_LOG_BIN=0; \t\t\t\t\tCHANGE MASTER TO MASTER_HOST='${MYSQL_PORT_3306_TCP_ADDR}',MASTER_USER='${REPLICATION_USER}',MASTER_PASSWORD='${REPLICATION_PASS}',MASTER_PORT=${MYSQL_PORT_3306_TCP_PORT}, MASTER_CONNECT_RETRY=30; \t\t\t\t\tSTART SLAVE ; \t\t\t\tEOSQL  \t\t            echo &quot;=&gt; Done!&quot; \t\t            touch \/replication_set.2 \t\t        else \t\t            echo &quot;=&gt; MySQL replication slave already configured, skip&quot; \t\t        fi \t\t    else \t\t        echo &quot;=&gt; Cannot configure slave, please link it to another MySQL container with alias as 'mysql'&quot; \t\t        exit 1 \t\t    fi \t\tfi   \t\tif [ -z &quot;$MYSQL_INITDB_SKIP_TZINFO&quot; ]; then \t\t\t# sed is for https:\/\/bugs.mysql.com\/bug.php?id=20545 \t\t\tmysql_tzinfo_to_sql \/usr\/share\/zoneinfo | sed 's\/Local time zone must be set--see zic manual page\/FCTY\/' | &quot;${mysql[@]}&quot; mysql \t\tfi  \t\tif [ ! -z &quot;$MYSQL_RANDOM_ROOT_PASSWORD&quot; ]; then \t\t\tMYSQL_ROOT_PASSWORD=&quot;$(pwgen -1 32)&quot; \t\t\techo &quot;GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD&quot; \t\tfi \t\t&quot;${mysql[@]}&quot; &lt;&lt;-EOSQL \t\t\t-- What's done in this file shouldn't be replicated \t\t\t--  or products like mysql-fabric won't work \t\t\tSET @@SESSION.SQL_LOG_BIN=0;  \t\t\tDELETE FROM mysql.user ; \t\t\tCREATE USER 'root'@'%' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; \t\t\tGRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION ; \t\t\tDROP DATABASE IF EXISTS test ; \t\t\tFLUSH PRIVILEGES ; \t\tEOSQL  \t\tif [ ! -z &quot;$MYSQL_ROOT_PASSWORD&quot; ]; then \t\t\tmysql+=( -p&quot;${MYSQL_ROOT_PASSWORD}&quot; ) \t\tfi  \t\t# Set MySQL REPLICATION - MASTER \t\tif [ -n &quot;${REPLICATION_MASTER}&quot; ]; then \t\t    echo &quot;=&gt; Configuring MySQL replication as master (2\/2) ...&quot; \t\t    if [ ! -f \/replication_set.2 ]; then \t\t        echo &quot;=&gt; Creating a log user ${REPLICATION_USER}:${REPLICATION_PASS}&quot;  \t\t\t\t&quot;${mysql[@]}&quot; &lt;&lt;-EOSQL \t\t\t\t\t-- What's done in this file shouldn't be replicated \t\t\t\t\t--  or products like mysql-fabric won't work \t\t\t\t\tSET @@SESSION.SQL_LOG_BIN=0;  \t\t\t\t\tCREATE USER '${REPLICATION_USER}'@'%' IDENTIFIED BY '${REPLICATION_PASS}'; \t\t\t\t\tGRANT REPLICATION SLAVE ON *.* TO '${REPLICATION_USER}'@'%' ; \t\t\t\t\tFLUSH PRIVILEGES ; \t\t\t\t\tRESET MASTER ; \t\t\t\tEOSQL  \t\t        echo &quot;=&gt; Done!&quot; \t\t        touch \/replication_set.2 \t\t    else \t\t        echo &quot;=&gt; MySQL replication master already configured, skip&quot; \t\t    fi \t\tfi   \t\tif [ &quot;$MYSQL_DATABASE&quot; ]; then \t\t\techo &quot;CREATE DATABASE IF NOT EXISTS \\`$MYSQL_DATABASE\\` ;&quot; | &quot;${mysql[@]}&quot; \t\t\tmysql+=( &quot;$MYSQL_DATABASE&quot; ) \t\tfi  \t\tif [ &quot;$MYSQL_USER&quot; -a &quot;$MYSQL_PASSWORD&quot; ]; then \t\t\techo &quot;CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD' ;&quot; | &quot;${mysql[@]}&quot;  \t\t\tif [ &quot;$MYSQL_DATABASE&quot; ]; then \t\t\t\techo &quot;GRANT ALL ON \\`$MYSQL_DATABASE\\`.* TO '$MYSQL_USER'@'%' ;&quot; | &quot;${mysql[@]}&quot; \t\t\tfi  \t\t\techo 'FLUSH PRIVILEGES ;' | &quot;${mysql[@]}&quot; \t\tfi  \t\techo \t\tfor f in \/docker-entrypoint-initdb.d\/*; do \t\t\tcase &quot;$f&quot; in \t\t\t\t*.sh)     echo &quot;$0: running $f&quot;; . &quot;$f&quot; ;; \t\t\t\t*.sql)    echo &quot;$0: running $f&quot;; &quot;${mysql[@]}&quot; &lt; &quot;$f&quot;; echo ;; \t\t\t\t*.sql.gz) echo &quot;$0: running $f&quot;; gunzip -c &quot;$f&quot; | &quot;${mysql[@]}&quot;; echo ;; \t\t\t\t*)        echo &quot;$0: ignoring $f&quot; ;; \t\t\tesac \t\t\techo \t\tdone  \t\tif [ ! -z &quot;$MYSQL_ONETIME_PASSWORD&quot; ]; then \t\t\t&quot;${mysql[@]}&quot; &lt;&lt;-EOSQL \t\t\t\tALTER USER 'root'@'%' PASSWORD EXPIRE; \t\t\tEOSQL \t\tfi \t\tif ! kill -s TERM &quot;$pid&quot; || ! wait &quot;$pid&quot;; then \t\t\techo &gt;&2 'MySQL init process failed.' \t\t\texit 1 \t\tfi  \t\techo \t\techo 'MySQL init process done. Ready for start up.' \t\techo \tfi  \tchown -R mysql:mysql &quot;$DATADIR&quot; fi  exec &quot;$@&quot; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0418 \u0441\u0431\u043e\u0440\u043a\u0430:<\/p>\n<p>  <code>docker build -t mysql-master .<br \/>  <\/code><\/p>\n<p>  <code>docker run --name mysql-master.0 -v \/mnt\/volumes\/master:\/var\/lib\/mysql -e MYSQL_ROOT_PASSWORD=rootpass -e MYSQL_USER=wordpress -e MYSQL_PASSWORD=wordpress -e MYSQL_DB=wordpress -e REPLICATION_MASTER=true -e REPLICATION_USER=replica -e REPLICATION_PASS=replica --link consul:consul -l &quot;SERVICE_NAME=master&quot; -l &quot;SERVICE_PORT=3306&quot; -p 3306:3306 -d mysql-master<br \/>  <\/code><\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0412\u044b \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438, \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 MySQL (REPLICATION_USER, REPLICATION_PASS, REPLICATION_MASTER, REPLICATION_SLAVE).<\/p>\n<h4>Slave<\/h4>\n<p>  \u041e\u0431\u0440\u0430\u0437 Slave \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b MySQL \u0441\u0430\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u043b Master-\u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u043b \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044e. \u0417\u0434\u0435\u0441\u044c \u043e\u043f\u044f\u0442\u044c \u0436\u0435 \u043a \u043d\u0430\u043c \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 Consul Template:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Dockerfile<\/b><\/p>\n<div class=\"spoiler_text\"><code>FROM debian:jessie<\/p>\n<p>  # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added<br \/>  RUN groupadd -r mysql && useradd -r -g mysql mysql<\/p>\n<p>  RUN mkdir \/docker-entrypoint-initdb.d<\/p>\n<p>  # FATAL ERROR: please install the following Perl modules before executing \/usr\/local\/mysql\/scripts\/mysql_install_db:<br \/>  # File::Basename<br \/>  # File::Copy<br \/>  # Sys::Hostname<br \/>  # Data::Dumper<br \/>  RUN apt-get update && apt-get install -y perl pwgen --no-install-recommends && rm -rf \/var\/lib\/apt\/lists\/*<\/p>\n<p>  # gpg: key 5072E1F5: public key &quot;MySQL Release Engineering &lt;mysql-build@oss.oracle.com&gt;&quot; imported<br \/>  RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5<\/p>\n<p>  ENV MYSQL_MAJOR 5.7<br \/>  ENV MYSQL_VERSION 5.7.11-1debian8<\/p>\n<p>  RUN echo &quot;deb http:\/\/repo.mysql.com\/apt\/debian\/ jessie mysql-${MYSQL_MAJOR}&quot; &gt; \/etc\/apt\/sources.list.d\/mysql.list<\/p>\n<p>  # the &quot;\/var\/lib\/mysql&quot; stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already &quot;configured&quot; (ie, stuff in \/var\/lib\/mysql\/mysql)<br \/>  # also, we set debconf keys to make APT a little quieter<br \/>  RUN { \\<br \/>   echo mysql-community-server mysql-community-server\/data-dir select ''; \\<br \/>   echo mysql-community-server mysql-community-server\/root-pass password ''; \\<br \/>   echo mysql-community-server mysql-community-server\/re-root-pass password ''; \\<br \/>   echo mysql-community-server mysql-community-server\/remove-test-db select false; \\<br \/>   } | debconf-set-selections \\<br \/>   && apt-get update && apt-get install -y mysql-server=&quot;${MYSQL_VERSION}&quot; && rm -rf \/var\/lib\/apt\/lists\/* \\<br \/>   && rm -rf \/var\/lib\/mysql && mkdir -p \/var\/lib\/mysql<\/p>\n<p>  # comment out a few problematic configuration values<br \/>  # don't reverse lookup hostnames, they are usually another container<br \/>  RUN sed -Ei 's\/^(bind-address|log)\/#&\/' \/etc\/mysql\/my.cnf \\<br \/>   && echo 'skip-host-cache\\nskip-name-resolve' | awk '{ print } $1 == &quot;[mysqld]&quot; && c == 0 { c = 1; system(&quot;cat&quot;) }' \/etc\/mysql\/my.cnf &gt; \/tmp\/my.cnf \\<br \/>   && mv \/tmp\/my.cnf \/etc\/mysql\/my.cnf<\/p>\n<p>  ADD https:\/\/releases.hashicorp.com\/consul-template\/0.12.2\/consul-template_0.12.2_linux_amd64.zip \/usr\/bin\/<br \/>  RUN unzip \/usr\/bin\/consul-template_0.12.2_linux_amd64.zip -d \/usr\/local\/bin<\/p>\n<p>  ADD mysql-master.ctmpl \/tmp\/mysql-master.ctmpl<\/p>\n<p>  VOLUME \/var\/lib\/mysql<\/p>\n<p>  COPY docker-entrypoint.sh \/entrypoint.sh<br \/>  ENTRYPOINT [&quot;\/entrypoint.sh&quot;]<\/p>\n<p>  EXPOSE 3306<br \/>  CMD [&quot;mysqld&quot;]<br \/>  <\/code>  <\/div>\n<\/div>\n<div class=\"spoiler\"><b class=\"spoiler_title\">docker-entrypoint.sh<\/b><\/p>\n<div class=\"spoiler_text\">&lt;source lang=\u00abbash\u00bb.<br \/>  #!\/bin\/bash<br \/>  set -eo pipefail<\/p>\n<p>  # \u0421\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u0443 Consul, \u0433\u0434\u0435 \u0443 \u043d\u0430\u0441 \u0436\u0438\u0432\u043e\u0439 master<br \/>  MYSQL_PORT_3306_TCP_ADDR=&quot;$(\/usr\/bin\/consul-template &#8212;template=\/tmp\/mysql-master.ctmpl &#8212;consul=consul:8500 &#8212;dry -once | awk &#8216;{print $1}&#8217; | tail -1)&quot;<br \/>  MYSQL_PORT_3306_TCP_PORT=&quot;$(\/usr\/bin\/consul-template &#8212;template=\/tmp\/mysql-master.ctmpl &#8212;consul=consul:8500 &#8212;dry -once | awk &#8216;{print $2}&#8217; | tail -1)&quot;<\/p>\n<p>  if [ &quot;${1:0:1}&quot; = &#8216;-&#8216; ]; then<br \/>   set \u2014 mysqld &quot;$@&quot;<br \/>  fi<\/p>\n<p>  if [ &quot;$1&quot; = &#8216;mysqld&#8217; ]; then<br \/>   # Get config<br \/>   DATADIR=&quot;$(&quot;$@&quot; &#8212;verbose &#8212;help 2&gt;\/dev\/null | awk &#8216;$1 == \u00abdatadir\u00bb { print $2; exit }&#8217;)&quot;<\/p>\n<p>  if [! -d &quot;$DATADIR\/mysql&quot; ]; then<br \/>   if [ -z &quot;$MYSQL_ROOT_PASSWORD&quot; -a -z &quot;$MYSQL_ALLOW_EMPTY_PASSWORD&quot; -a -z &quot;$MYSQL_RANDOM_ROOT_PASSWORD&quot; ]; then<br \/>   echo &gt;&#038;2 &#8216;error: database is uninitialized and password option is not specified &#8216;<br \/>   echo &gt;&#038;2 &#8216; You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD&#8217;<br \/>   exit 1<br \/>   fi<\/p>\n<p>  mkdir -p &quot;$DATADIR&quot;<br \/>   chown -R mysql:mysql &quot;$DATADIR&quot;<\/p>\n<p>  echo &#8216;Initializing database&#8217;<br \/>   &quot;$@&quot; &#8212;initialize-insecure<br \/>   echo &#8216;Database initialized&#8217;<\/p>\n<p>  &quot;$@&quot; &#8212;skip-networking &#038;<br \/>   pid=&quot;$!&quot;<\/p>\n<p>  mysql=( mysql &#8212;protocol=socket -uroot )<\/p>\n<p>  for i in {30..0}; do<br \/>   if echo &#8216;SELECT 1&#8217; | &quot;${mysql[@]}&quot; &#038;&gt; \/dev\/null; then<br \/>   break<br \/>   fi<br \/>   echo &#8216;MySQL init process in progress&#8230;&#8217;<br \/>   sleep 1<br \/>   done<br \/>   if [ &quot;$i&quot; = 0 ]; then<br \/>   echo &gt;&#038;2 &#8216;MySQL init process failed.&#8217;<br \/>   exit 1<br \/>   fi<\/p>\n<p>  if [ -n &quot;${REPLICATION_MASTER}&quot; ]; then<br \/>   echo &quot;=&gt; Configuring MySQL replication as master (1\/2) &#8230;&quot;<br \/>   if [! -f \/replication_set.1 ]; then<br \/>   echo &quot;=&gt; Writting configuration file \/etc\/mysql\/my.cnf with server-id=1&quot;<br \/>   echo &#8216;server-id = 1&#8217; &gt;&gt; \/etc\/mysql\/my.cnf<br \/>   echo &#8216;log-bin = mysql-bin&#8217; &gt;&gt; \/etc\/mysql\/my.cnf<br \/>   touch \/replication_set.1<br \/>   else<br \/>   echo &quot;=&gt; MySQL replication master already configured, skip&quot;<br \/>   fi<br \/>   fi<br \/>   # Set MySQL REPLICATION \u2014 SLAVE<br \/>   if [ -n &quot;${REPLICATION_SLAVE}&quot; ]; then<br \/>   echo &quot;=&gt; Configuring MySQL replication as slave (1\/2) &#8230;&quot;<br \/>   if [ -n &quot;${MYSQL_PORT_3306_TCP_ADDR}&quot; ] &#038;&#038; [ -n &quot;${MYSQL_PORT_3306_TCP_PORT}&quot; ]; then<br \/>   if [! -f \/replication_set.1 ]; then<br \/>   echo &quot;=&gt; Writting configuration file \/etc\/mysql\/my.cnf with server-id=2&quot;<br \/>   echo &#8216;server-id = 2&#8217; &gt;&gt; \/etc\/mysql\/my.cnf<br \/>   echo &#8216;log-bin = mysql-bin&#8217; &gt;&gt; \/etc\/mysql\/my.cnf<br \/>   echo &#8216;log-bin=slave-bin&#8217; &gt;&gt; \/etc\/mysql\/my.cnf<br \/>   touch \/replication_set.1<br \/>   else<br \/>   echo &quot;=&gt; MySQL replication slave already configured, skip&quot;<br \/>   fi<br \/>   else<br \/>   echo &quot;=&gt; Cannot configure slave, please link it to another MySQL container with alias as &#8216;mysql&#8217;&quot;<br \/>   exit 1<br \/>   fi<br \/>   fi<\/p>\n<p>  # Set MySQL REPLICATION \u2014 SLAVE<br \/>   if [ -n &quot;${REPLICATION_SLAVE}&quot; ]; then<br \/>   echo &quot;=&gt; Configuring MySQL replication as slave (2\/2) &#8230;&quot;<br \/>   if [ -n &quot;${MYSQL_PORT_3306_TCP_ADDR}&quot; ] &#038;&#038; [ -n &quot;${MYSQL_PORT_3306_TCP_PORT}&quot; ]; then<br \/>   if [! -f \/replication_set.2 ]; then<br \/>   echo &quot;=&gt; Setting master connection info on slave&quot;<br \/>   &quot;${mysql[@]}&quot; &lt;&lt;-EOSQL<br \/>   \u2014 What&#8217;s done in this file shouldn&#8217;t be replicated<br \/>   \u2014 or products like mysql-fabric won&#8217;t work<br \/>   SET @@SESSION.SQL_LOG_BIN=0;<br \/>   CHANGE MASTER TO MASTER_HOST=&#8217;${MYSQL_PORT_3306_TCP_ADDR}&#8217;,MASTER_USER=&#8217;${REPLICATION_USER}&#8217;,MASTER_PASSWORD=&#8217;${REPLICATION_PASS}&#8217;,MASTER_PORT=${MYSQL_PORT_3306_TCP_PORT}, MASTER_CONNECT_RETRY=30;<br \/>   START SLAVE;<br \/>   EOSQL<\/p>\n<p>  echo &quot;=&gt; Done!&quot;<br \/>   touch \/replication_set.2<br \/>   else<br \/>   echo &quot;=&gt; MySQL replication slave already configured, skip&quot;<br \/>   fi<br \/>   else<br \/>   echo &quot;=&gt; Cannot configure slave, please link it to another MySQL container with alias as &#8216;mysql&#8217;&quot;<br \/>   exit 1<br \/>   fi<br \/>   fi<\/p>\n<p>  if [ -z &quot;$MYSQL_INITDB_SKIP_TZINFO&quot; ]; then<br \/>   # sed is for <a href=\"https:\/\/bugs.mysql.com\/bug.php?id=20545\">bugs.mysql.com\/bug.php?id=20545<\/a><br \/>   mysql_tzinfo_to_sql \/usr\/share\/zoneinfo | sed &#8216;s\/Local time zone must be set&#8212;see zic manual page\/FCTY\/&#8217; | &quot;${mysql[@]}&quot; mysql<br \/>   fi<\/p>\n<p>  if [! -z &quot;$MYSQL_RANDOM_ROOT_PASSWORD&quot; ]; then<br \/>   MYSQL_ROOT_PASSWORD=&quot;$(pwgen -1 32)&quot;<br \/>   echo \u00abGENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD\u00bb<br \/>   fi<br \/>   &quot;${mysql[@]}&quot; &lt;&lt;-EOSQL<br \/>   \u2014 What&#8217;s done in this file shouldn&#8217;t be replicated<br \/>   \u2014 or products like mysql-fabric won&#8217;t work<br \/>   SET @@SESSION.SQL_LOG_BIN=0;<\/p>\n<p>  DELETE FROM mysql.user;<br \/>   CREATE USER &#8216;root&#8217;@&#8217;%&#8217; IDENTIFIED BY &#8216;${MYSQL_ROOT_PASSWORD}&#8217;;<br \/>   GRANT ALL ON *.* TO &#8216;root&#8217;@&#8217;%&#8217; WITH GRANT OPTION;<br \/>   DROP DATABASE IF EXISTS test;<br \/>   FLUSH PRIVILEGES;<br \/>   EOSQL<\/p>\n<p>  if [! -z &quot;$MYSQL_ROOT_PASSWORD&quot; ]; then<br \/>   mysql+=( -p&quot;${MYSQL_ROOT_PASSWORD}&quot; )<br \/>   fi<\/p>\n<p>  # Set MySQL REPLICATION \u2014 MASTER<br \/>   if [ -n &quot;${REPLICATION_MASTER}&quot; ]; then<br \/>   echo &quot;=&gt; Configuring MySQL replication as master (2\/2) &#8230;&quot;<br \/>   if [! -f \/replication_set.2 ]; then<br \/>   echo &quot;=&gt; Creating a log user ${REPLICATION_USER}:${REPLICATION_PASS}&quot;<\/p>\n<p>  &quot;${mysql[@]}&quot; &lt;&lt;-EOSQL<br \/>   \u2014 What&#8217;s done in this file shouldn&#8217;t be replicated<br \/>   \u2014 or products like mysql-fabric won&#8217;t work<br \/>   SET @@SESSION.SQL_LOG_BIN=0;<\/p>\n<p>  CREATE USER &#8216;${REPLICATION_USER}&#8217;@&#8217;%&#8217; IDENTIFIED BY &#8216;${REPLICATION_PASS}&#8217;;<br \/>   GRANT REPLICATION SLAVE ON *.* TO &#8216;${REPLICATION_USER}&#8217;@&#8217;%&#8217;;<br \/>   FLUSH PRIVILEGES;<br \/>   RESET MASTER;<br \/>   EOSQL<\/p>\n<p>  echo &quot;=&gt; Done!&quot;<br \/>   touch \/replication_set.2<br \/>   else<br \/>   echo &quot;=&gt; MySQL replication master already configured, skip&quot;<br \/>   fi<br \/>   fi<\/p>\n<p>  if [ &quot;$MYSQL_DATABASE&quot; ]; then<br \/>   echo \u00abCREATE DATABASE IF NOT EXISTS \\`$MYSQL_DATABASE\\` ;\u00bb | &quot;${mysql[@]}&quot;<br \/>   mysql+=( &quot;$MYSQL_DATABASE&quot; )<br \/>   fi<\/p>\n<p>  if [ &quot;$MYSQL_USER&quot; -a &quot;$MYSQL_PASSWORD&quot; ]; then<br \/>   echo \u00abCREATE USER &#8216;$MYSQL_USER&#8217;@&#8217;%&#8217; IDENTIFIED BY &#8216;$MYSQL_PASSWORD&#8217; ;\u00bb | &quot;${mysql[@]}&quot;<\/p>\n<p>  if [ &quot;$MYSQL_DATABASE&quot; ]; then<br \/>   echo \u00abGRANT ALL ON \\`$MYSQL_DATABASE\\`.* TO &#8216;$MYSQL_USER&#8217;@&#8217;%&#8217; ;\u00bb | &quot;${mysql[@]}&quot;<br \/>   fi<\/p>\n<p>  echo &#8216;FLUSH PRIVILEGES ;&#8217; | &quot;${mysql[@]}&quot;<br \/>   fi<\/p>\n<p>  echo<br \/>   for f in \/docker-entrypoint-initdb.d\/*; do<br \/>   case &quot;$f&quot; in<br \/>   *.sh) echo &quot;$0: running $f&quot;;. &quot;$f&quot; ;;<br \/>   *.sql) echo &quot;$0: running $f&quot;; &quot;${mysql[@]}&quot; &lt; &quot;$f&quot;; echo ;;<br \/>   *.sql.gz) echo &quot;$0: running $f&quot;; gunzip -c &quot;$f&quot; | &quot;${mysql[@]}&quot;; echo ;;<br \/>   *) echo &quot;$0: ignoring $f&quot; ;;<br \/>   esac<br \/>   echo<br \/>   done<\/p>\n<p>  if [! -z &quot;$MYSQL_ONETIME_PASSWORD&quot; ]; then<br \/>   &quot;${mysql[@]}&quot; &lt;&lt;-EOSQL<br \/>   ALTER USER &#8216;root&#8217;@&#8217;%&#8217; PASSWORD EXPIRE;<br \/>   EOSQL<br \/>   fi<br \/>   if! kill -s TERM &quot;$pid&quot; ||! wait &quot;$pid&quot;; then<br \/>   echo &gt;&#038;2 &#8216;MySQL init process failed.&#8217;<br \/>   exit 1<br \/>   fi<\/p>\n<p>  echo<br \/>   echo &#8216;MySQL init process done. Ready for start up.&#8217;<br \/>   echo<br \/>   fi<\/p>\n<p>  chown -R mysql:mysql &quot;$DATADIR&quot;<br \/>  fi<\/p>\n<p>  exec &quot;$@&quot;  <\/div>\n<\/div>\n<p>  \u0418 \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f Consul Template, mysql-master.ctmpl:<\/p>\n<p>  <code>{{range service &quot;master&quot;}}{{.Address}} {{.Port}} {{end}}<br \/>  <\/code><\/p>\n<p>  \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c:<\/p>\n<p>  <code>bocker build -t mysql-slave .<br \/>  <\/code><\/p>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c: <\/p>\n<p>  <code>docker run --name mysql-slave.0 -v \/mnt\/volumes\/slave:\/var\/lib\/mysql -e MYSQL_ROOT_PASSWORD=rootpass -e REPLICATION_SLAVE=true -e REPLICATION_USER=replica -e REPLICATION_PASS=replica --link=consul:consul -l &quot;SERVICE_NAME=slave&quot; -l &quot;SERVICE_PORT=3307&quot; -p 3307:3306 -d mysql-slave<br \/>  <\/code><\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430\u0448 \u0431\u044d\u043a\u0435\u043d\u0434.<\/p>\n<p>  <code>docker run --name fpm.0 -d -v \/mnt\/storage\/www:\/var\/www\/html \\<br \/>  -e WORDPRESS_DB_NAME=wordpressp -e WORDPRESS_DB_USER=wordpress -e WORDPRESS_DB_PASSWORD=wordpress \\<br \/>  --link consul:consul -l &quot;SERVICE_NAME=php-fpm&quot; -l &quot;SERVICE_PORT=9000&quot; -l &quot;SERVICE_TAGS=worker&quot; -p 9000:9000 fpm<br \/>  <\/code><\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u0441\u0451 \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0434\u0430\u0447\u043d\u043e, \u0442\u043e, \u043e\u0442\u043a\u0440\u044b\u0432 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0430\u0434\u0440\u0435\u0441 \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430, \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 Wordress \u0441 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0435\u0433\u043e.<br \/>  \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u2014 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043b\u043e\u0433\u0438<\/p>\n<p>  <code>docker logs &lt;container_name&gt;<br \/>  <\/code><\/p>\n<h3>Docker-compose.<\/h3>\n<p>  \u041c\u044b \u0441\u043e\u0431\u0440\u0430\u043b\u0438 \u043e\u0431\u0440\u0430\u0437\u044b \u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c\u0438 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043b\u044e\u0431\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0432 \u043b\u044e\u0431\u043e\u043c \u043c\u0435\u0441\u0442\u0435, \u043d\u043e\u2026 \u0417\u0430\u0447\u0435\u043c \u043d\u0430\u043c \u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043c\u0430\u043d\u0434, \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0437\u0430\u043f\u0443\u0441\u043a\u0430, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432? \u0417\u0434\u0435\u0441\u044c \u043a \u043d\u0430\u043c \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u043a\u043b\u0430\u0441\u0441\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u2014 <a href=\"https:\/\/docs.docker.com\/compose\/\">docker-compose<\/a>. <br \/>  \u042d\u0442\u043e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u0445. Docker-compose \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 YAML, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0441 \u043a\u0430\u043a\u0438\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440. \u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u043b\u0435\u0433\u043a\u043e \u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u0438 \u043f\u0440\u043e\u0441\u0442\u044b \u0434\u043b\u044f \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u044f. <\/p>\n<p>  \u041c\u044b \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u0445 \u0432\u0441\u0451 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f docker-compose.yml. <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>mysql-master:       image: mysql-master       ports:         - &quot;3306:3306&quot;       environment:         - &quot;MYSQL_DATABASE=wp&quot;         - &quot;MYSQL_USER=wordpress&quot;         - &quot;MYSQL_PASSWORD=wordpress&quot;         - &quot;REPLICATION_MASTER=true&quot;         - &quot;REPLICATION_USER=replica&quot;         - &quot;REPLICATION_PASS=replica&quot;       external_links:         - consul:consul       labels:         - &quot;SERVICE_NAME=mysql-master&quot;         - &quot;SERVICE_PORT=3306&quot;         - &quot;SERVICE_TAGS=db&quot;       volumes:         - '\/mnt\/storage\/master:\/var\/lib\/mysql'  mysql-slave:       image: mysql-slave       ports:         - &quot;3307:3306&quot;       environment:         - &quot;REPLICATION_SLAVE=true&quot;         - &quot;REPLICATION_USER=replica&quot;         - &quot;REPLICATION_PASS=replica&quot;       external_links:         - consul:consul       labels:         - &quot;SERVICE_NAME=mysql-slave&quot;         - &quot;SERVICE_PORT=3307&quot;         - &quot;SERVICE_TAGS=db&quot;       volumes:         - '\/mnt\/storage\/slave:\/var\/lib\/mysql'   wordpress:       image: fpm       ports:         - &quot;9000:9000&quot;       environment:         - &quot;WORDPRESS_DB_NAME=wp&quot;         - &quot;WORDPRESS_DB_USER=wordpress&quot;         - &quot;WORDPRESS_DB_PASSWORD=wordpress&quot;       external_links:         - consul:consul       labels:         - &quot;SERVICE_NAME=php-fpm&quot;         - &quot;SERVICE_PORT=9000&quot;         - &quot;SERVICE_TAGS=worker&quot;       volumes:         - '\/mnt\/storage\/www:\/var\/www\/html'  <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043d\u0430\u0448\u0435\u0433\u043e \u00ab\u0434\u043e\u043a\u0435\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e\u00bb \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043e\u0442\u043a\u0438\u043d\u0443\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u043f\u0438\u043d\u043a\u0443 \u043a\u0440\u0435\u0441\u043b\u0430 \u0438 \u043b\u044e\u0431\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c. <\/p>\n<p>  <code>docker-compose up<br \/>  <\/code>  <\/div>\n<\/div>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<h4>\u0418\u0437 \u0434\u043e\u0441\u0442\u043e\u0438\u043d\u0441\u0442\u0432<\/h4>\n<p>   \u2014 \u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<br \/>  Swarm \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0433\u043e\u0434\u043d\u043e \u043a\u043e\u043f\u0438\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043f\u043e\u043a\u0430 \u043d\u0430 \u043d\u043e\u0434\u0430\u0445 \u0435\u0441\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441\u044b. \u0418 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u00ab\u0432 \u043e\u0434\u0438\u043d \u043a\u043b\u0438\u043a\u00bb.<\/p>\n<p>   \u2014 \u041f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<br \/>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u043d\u043e\u0434\u0443 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u2014 \u043f\u0440\u043e\u0449\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043d\u043e\u0434\u0443 \u2014 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441. \u041f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u044d\u0442\u0443 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u043c\u043e\u0436\u043d\u043e \u0435\u0449\u0451 \u0431\u043e\u043b\u044c\u0448\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>   \u2014 \u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<br \/>  \u041a\u0430\u0436\u0434\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u043c\u043e\u0436\u0435\u0442 \u0431\u0435\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u043e\u043c, \u0433\u0434\u0435 \u0447\u0442\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0438 \u0441 \u043a\u0435\u043c \u0435\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c. <\/p>\n<p>   \u2014 \u0417\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u043e\u0434\u043d\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443.<br \/>  \u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439 docker-compose \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0432\u0441\u044e \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438 \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u0432 \u043e\u0434\u043d\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043a\u043d\u043e\u043f\u043a\u0438. <\/p>\n<h4>\u0418\u0437 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432<\/h4>\n<p>  \u041f\u0435\u0440\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.<br \/>  \u041d\u0435 \u0440\u0430\u0437 \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u043e\u0441\u044c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0443 Docker \u043d\u0435 \u0442\u0430\u043a \u0432\u0441\u0451 \u0433\u043b\u0430\u0434\u043a\u043e \u0441 stateful-\u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438. \u041c\u044b \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b\u0438 flocker, \u043d\u043e \u043e\u043d \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0441\u044b\u0440\u044b\u043c, \u043f\u043b\u0430\u0433\u0438\u043d \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u00ab\u043e\u0442\u0432\u0430\u043b\u0438\u0432\u0430\u043b\u0441\u044f\u00bb \u043f\u043e \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c. <br \/>  \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0434\u043b\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0435\u0440\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 glusterfs, \u043f\u043e\u0442\u043e\u043c lsyncd. Glusterfs, \u0432\u0440\u043e\u0434\u0435 \u043a\u0430\u043a, \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e \u0441\u0432\u043e\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439, \u043d\u043e \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435 \u043c\u044b \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043a\u0430 \u043d\u0435 \u0440\u0435\u0448\u0430\u043b\u0438\u0441\u044c. <\/p>\n<p>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0412\u044b \u0437\u043d\u0430\u0435\u0442\u0435 \u0431\u043e\u043b\u0435\u0435 \u0438\u0437\u044f\u0449\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u2014 \u0431\u044b\u043b\u043e \u0431\u044b \u0437\u0434\u043e\u0440\u043e\u0432\u043e \u0435\u0433\u043e \u0443\u0441\u043b\u044b\u0448\u0430\u0442\u044c.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"https:\/\/habrastorage.org\/files\/576\/9c1\/392\/5769c13923b949cf8af85bc1319cddef.jpg\"\/><\/div>\n<p>  <i>P. S.<\/i><br \/>  <i>\u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0438\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u0443\u0435\u0442 \u043d\u0430 \u0432\u0441\u0435\u043e\u0431\u044a\u0435\u043c\u043b\u044e\u0449\u0435\u0435 how-to, \u0430 \u043b\u0438\u0448\u044c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u043c\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u044e\u0437\u043a\u0435\u0439\u0441\u0435.<br \/>  \u0415\u0441\u043b\u0438 \u0443 \u0412\u0430\u0441 \u0435\u0441\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\/\u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438, \u0440\u0435\u0448\u0430\u044e\u0449\u0438\u043c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u0431\u0443\u0434\u0443 \u0440\u0430\u0434 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0438\u0445 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/i><\/a>               <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/278939\/\"> https:\/\/habrahabr.ru\/post\/278939\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<br \/>\n<h2>\u0412\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u044f<\/h2>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"https:\/\/habrastorage.org\/files\/7c4\/e49\/e94\/7c4e49e94a5d454a89e33bae89fd4771.jpg\"\/><\/div>\n<blockquote><p><i>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u0440\u0438\u0441\u043d\u0438\u043b\u0441\u044f \u0441\u043e\u043d, \u043a\u0430\u043a-\u0431\u0443\u0434\u0442\u043e \u043c\u0435\u043d\u044f \u0443\u0436\u0430\u043b\u0438 \u0434\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445<br \/>  \u043a\u0438\u043b\u043e\u0431\u0430\u0439\u0442, \u0437\u0430\u0441\u0443\u043d\u0443\u043b\u0438 \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0441\u043e\u043a\u0435\u0442 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435.<br \/>  \u0412\u044b\u0434\u0435\u043b\u0438\u043b\u0438 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442 \u0432 \u043e\u0432\u0435\u0440\u043b\u0435\u0439\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0438 \u043f\u0443\u0441\u0442\u0438\u043b\u0438<br \/>  \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u0445\u2026<br \/>  \u041f\u043e\u043a\u0430 \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 docker rm<\/i><\/p><\/blockquote>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-275825","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/275825","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=275825"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/275825\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=275825"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=275825"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=275825"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}