{"id":345526,"date":"2023-02-16T15:03:51","date_gmt":"2023-02-16T15:03:51","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=345526"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=345526","title":{"rendered":"<span>\u0428\u0430\u0431\u043b\u043e\u043d backend \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430 Golang \u2014 \u0447\u0430\u0441\u0442\u044c 3 (Docker, Docker Compose, Kubernetes (kustomize)<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h1 id=\"shablon-backend-servera-na-golang--chast-3-docker-docker-compose-kubernetes-kustomizehttpshabrcomrupost716634\"><a href=\"https:\/\/habr.com\/ru\/post\/716634\/\">\u0428\u0430\u0431\u043b\u043e\u043d backend \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430 Golang \u2014 \u0447\u0430\u0441\u0442\u044c 3 (Docker, Docker Compose, Kubernetes (kustomize)<\/a><\/h1>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/post_images\/110\/b29\/b5b\/110b29b5bc2d9df9e250549adb05268d.jpg\" alt=\"\u0421\u0445\u0435\u043c\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0432 Kubernetes\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/110\/b29\/b5b\/110b29b5bc2d9df9e250549adb05268d.jpg\" data-blurred=\"true\"\/><\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/492062\/\">\u041f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/a> \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 HTTP \u0441\u0435\u0440\u0432\u0435\u0440\u0443.<\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/500554\/\">\u0412\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/a> \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e REST API.<\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/716634\/\">\u0422\u0440\u0435\u0442\u044c\u044f \u0447\u0430\u0441\u0442\u044c<\/a> \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044e \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0432 Docker, Docker Compose, Kubernetes (kustomize).<\/p>\n<p>  <\/p>\n<p>\u0427\u0435\u0442\u0432\u0435\u0440\u0442\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044e \u0432 Kubernetes \u0441 Helm chart \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 Horizontal Autoscaler.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0432 Kubernetes, \u0432 \u0448\u0430\u0431\u043b\u043e\u043d \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0432\u043d\u0435\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f: <\/p>\n<p>  <\/p>\n<ul>\n<li>\u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u2014 YAML, ENV, <a href=\"https:\/\/kustomize.io\/\" rel=\"nofollow noopener noreferrer\">Kustomize<\/a><\/li>\n<li>\u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043a \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u2014 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u0430 <a href=\"https:\/\/github.com\/uber-go\/zap\" rel=\"nofollow noopener noreferrer\">zap<\/a><\/li>\n<li>\u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0441\u0445\u0435\u043c\u044b \u0411\u0414 \u2014 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u0430 <a href=\"https:\/\/www.liquibase.org\/\" rel=\"nofollow noopener noreferrer\">liquibase<\/a><\/li>\n<li>\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a <a href=\"https:\/\/prometheus.io\/\" rel=\"nofollow noopener noreferrer\">prometheus<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043d\u043e\u0432\u044b\u0439 <a href=\"https:\/\/github.com\/romapres2010\/goapp\" rel=\"nofollow noopener noreferrer\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0428\u0430\u0431\u043b\u043e\u043d goapp \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0433\u043e\u0442\u043e\u0432 \u043a \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044e \u0432 Docker, Docker Compose, Kubernetes (kustomize), Kubernetes (helm).<\/p>\n<p>  <\/p>\n<p><em>\u041d\u0430\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439<\/em> <\/p>\n<p>  <\/p>\n<h2 id=\"soderzhanie\">\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<ol>\n<li>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043a \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e<\/li>\n<li>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a <a href=\"https:\/\/prometheus.io\/\" rel=\"nofollow noopener noreferrer\">prometheus<\/a><\/li>\n<li>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043a \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e<\/li>\n<li>\u0420\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0411\u0414<\/li>\n<li>\u0421\u0431\u043e\u0440\u043a\u0430 Docker image<\/li>\n<li>\u0421\u0431\u043e\u0440\u043a\u0430 Docker-Compose <\/li>\n<li>\u0421\u0445\u0435\u043c\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0432 Kubernetes<\/li>\n<li>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 YAML \u0434\u043b\u044f Kubernetes<\/li>\n<li>Kustomization YAML \u0434\u043b\u044f Kubernetes<\/li>\n<li>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 Kubernetes \u0441 kustomize<\/li>\n<\/ol>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"1-izmenenie-podhoda-k-konfigurirovaniyu\">1. \u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043a \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e<\/h2>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u0435\u043d \u0434\u043b\u044f Docker, \u0442\u0430\u043a \u043a\u0430\u043a \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 ENTRYPOINT.<br \/>  \u041d\u043e \u0434\u043b\u044f \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438 \u044d\u0442\u043e\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c.<\/p>\n<p>  <\/p>\n<p>\u0418\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u044f Docker \u0438 Kubernetes \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f ENV. \u0418\u0445 \u043f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u043e\u0434\u043c\u0435\u043d\u044f\u0442\u044c \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u0441\u0440\u0435\u0434\u0430\u043c\u0438 DEV-TEST-PROD.<br \/>  \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0432\u0430\u043b\u0438\u043b\u043e \u0437\u0430 1000 \u2014 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u043d\u0444\u0438\u0433 \u0431\u044b\u043b \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d \u043d\u0430 \u0447\u0430\u0441\u0442\u0438: <\/p>\n<p>  <\/p>\n<ul>\n<li>\u0443\u0441\u043b\u043e\u0432\u043d\u043e \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u0434\u043a\u043e \u2014 \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u0430 \u0432 YAML,<\/li>\n<li>\u0432\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441\u043e \u0441\u0440\u0435\u0434\u0430\u043c\u0438 \u043f\u043e\u0440\u0442\u044b, \u043f\u0443\u0442\u0438, \u0411\u0414 \u2014 \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u044b \u0432 ENV,<\/li>\n<li>\u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 (\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438, \u043f\u0430\u0440\u043e\u043b\u0438) \u2014 \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u044b \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043b\u0438\u0431\u043e \u0447\u0435\u0440\u0435\u0437 ENV, \u043b\u0438\u0431\u043e \u0447\u0435\u0440\u0435\u0437 Secret.<\/li>\n<\/ul>\n<p>  <\/p>\n<h3 id=\"uslovno-postoyannaya-chast-konfiga\">\u0423\u0441\u043b\u043e\u0432\u043d\u043e \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0430<\/h3>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 &#171;\u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e&#187; YAML \u043a\u043e\u043d\u0444\u0438\u0433\u0430 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/config\/app.global.yaml\" rel=\"nofollow noopener noreferrer\">app.global.yaml<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 YAML \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u0432 \u0432 Kubernetes, \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0430\u0440\u0443 \u0437\u0430\u0434\u0430\u0447:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u043a\u0430\u043a \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c YAML \u043a\u043e\u043d\u0444\u0438\u0433 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u0440\u0435\u0434\u044b \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 (DEV-TEST-PROD)<\/li>\n<li>\u043a\u0430\u043a \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c YAML \u043a\u043e\u043d\u0444\u0438\u0433 \u0432 Docker \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440, \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044b\u0439 \u0432 Pod Kubernetes<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c YAML \u043a\u043e\u043d\u0444\u0438\u0433 \u2014 \u044d\u0442\u043e \u0434\u0435\u0440\u0436\u0430\u0442\u044c &#171;\u0431\u0430\u0437\u043e\u0432\u0443\u044e&#187; \u0432\u0435\u0440\u0441\u0438\u044e \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0442 \u043d\u0435\u0435 &#171;\u0440\u0443\u0447\u043d\u044b\u0435 \u043a\u043b\u043e\u043d\u044b&#187; \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u0441\u0440\u0435\u0434 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f.<br \/>  \u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u2014 \u044d\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c YAML \u043a\u043e\u043d\u0444\u0438\u0433\u0438 (\u0432\u0441\u0435\u0445 \u0441\u0440\u0435\u0434) \u0432 \u0441\u0431\u043e\u0440\u043a\u0443 Docker \u043e\u0431\u0440\u0430\u0437\u0430 \u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 ENV \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u0440\u0435\u0434\u044b \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0443\u0441\u043a.<\/p>\n<p>  <\/p>\n<p>\u0411\u043e\u043b\u0435\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2014 \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Kustomize \u0438 overlays \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0437 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e, YAML \u043a\u043e\u043d\u0444\u0438\u0433 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u044b \u0438 \u0434\u0435\u043f\u043b\u043e\u0438\u0442\u044c \u0438\u0445 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u043e\u0432, \u043e\u0442\u043a\u0443\u0434\u0430 \u043e\u043d \u043f\u043e\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043b\u043e\u0436\u0435\u043d \u0432 \u043f\u0440\u0438\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u043a Docker \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440.<\/p>\n<p>  <\/p>\n<h3 id=\"dinamicheskoe-konfigurirovanie-rest-api-entry-point\">\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 REST API entry point<\/h3>\n<p>  <\/p>\n<p>\u0421\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0438\u0441\u044c \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u0430\u0445 \u043d\u0443\u0436\u043d\u043e \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c REST API entry point.<br \/>  \u041c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u043e\u0437\u043b\u043e\u0436\u0438\u0442\u044c \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043d\u0430 nginx proxy, \u043d\u043e \u0440\u0435\u0448\u0438\u043b\u0438 \u0437\u0430\u0434\u0430\u0447\u0443 \u0447\u0435\u0440\u0435\u0437 YAML \u043a\u043e\u043d\u0444\u0438\u0433.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">handlers:     HealthHandler:  # \u0421\u0435\u0440\u0432\u0438\u0441 health - \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 HEALTH         enabled: true                      # \u041f\u0440\u0438\u0437\u043d\u0430\u043a \u0432\u043a\u043b\u044e\u0447\u0435\u043d \u043b\u0438 \u0441\u0435\u0440\u0432\u0438\u0441         application: \"app\"                 # \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0438\u0441         module: \"system\"                   # \u041c\u043e\u0434\u0443\u043b\u044c \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0438\u0441         service: \"health\"                  # \u0418\u043c\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430         version: \"v1.0.0\"                  # \u0412\u0435\u0440\u0441\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430         full_path: \"\/app\/system\/health\"    # URI \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \/Application.Module.Service.APIVersion \u0438\u043b\u0438 \/Application\/APIVersion\/Module\/Service         params: \"\"                         # \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0441 \u0432\u0438\u0434\u0435 {id:[0-9]+}         method: \"GET\"                      # HTTP \u043c\u0435\u0442\u043e\u0434: GET, POST, ...         handler_name: \"HealthHandler\"      # \u0418\u043c\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430     ReadyHandler:   # \u0421\u0435\u0440\u0432\u0438\u0441 ready - handle to test readinessProbe         enabled: true                      # \u041f\u0440\u0438\u0437\u043d\u0430\u043a \u0432\u043a\u043b\u044e\u0447\u0435\u043d \u043b\u0438 \u0441\u0435\u0440\u0432\u0438\u0441         application: \"app\"                 # \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0438\u0441         module: \"system\"                   # \u041c\u043e\u0434\u0443\u043b\u044c \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0438\u0441         service: \"ready\"                   # \u0418\u043c\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430         version: \"v1.0.0\"                  # \u0412\u0435\u0440\u0441\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430         full_path: \"\/app\/system\/ready\"     # URI \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \/Application.Module.Service.APIVersion \u0438\u043b\u0438 \/Application\/APIVersion\/Module\/Service         params: \"\"                         # \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0441 \u0432\u0438\u0434\u0435 {id:[0-9]+}         method: \"GET\"                      # HTTP \u043c\u0435\u0442\u043e\u0434: GET, POST, ...         handler_name: \"ReadyHandler\"       # \u0418\u043c\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0434\u043b\u044f REST API entry point \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/pkg\/common\/httpservice\/httpservice.go#L193\" rel=\"nofollow noopener noreferrer\">\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c reflect<\/a>.<br \/>  \u0412\u0435\u0441\u044c\u043c\u0430 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u2014 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u043a\u0438 \u043a\u043e\u0434\u0430, \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u043d\u044f\u044f \u043a\u043e\u043d\u0444\u0438\u0433. <\/p>\n<p>  <\/p>\n<pre><code class=\"go\">var dummyHandlerFunc func(http.ResponseWriter, *http.Request) for handlerName, handlerCfg := range s.cfg.Handlers {     if handlerCfg.Enabled { \/\/ \u0441\u0435\u0440\u0432\u0438\u0441 \u0432\u043a\u043b\u044e\u0447\u0435\u043d         handler := Handler{}          if handlerCfg.Params != \"\" {             handler.Path = handlerCfg.FullPath + \"\/\" + handlerCfg.Params         } else {             handler.Path = handlerCfg.FullPath         }         handler.Method = handlerCfg.Method          \/\/ \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043c\u0435\u0442\u043e\u0434 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430         method := reflect.ValueOf(s.httpHandler).MethodByName(handlerCfg.HandlerName)          \/\/ \u041c\u0435\u0442\u043e\u0434 \u043d\u0430\u0439\u0434\u0435\u043d         if method.IsValid() {             methodInterface := method.Interface()                                         \/\/ \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043c\u0435\u0442\u043e\u0434 \u0432 \u0432\u0438\u0434\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u043d\u0443\u0436\u043d\u043e\u043c\u0443 \u0442\u0438\u043f\u0443             handlerFunc, ok := methodInterface.(func(http.ResponseWriter, *http.Request)) \/\/ \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u043a \u043d\u0443\u0436\u043d\u043e\u043c\u0443 \u0442\u0438\u043f\u0443             if ok {                 handler.HandlerFunc = s.recoverWrap(handlerFunc) \/\/ \u041e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u043e\u0442 \u043f\u0430\u043d\u0438\u043a\u0438                 _log.Info(\"Register HTTP handler: HandlerName, Method, FullPath\", handlerCfg.HandlerName, handlerCfg.Method, handlerCfg.FullPath)             } else {                 return _err.NewTyped(_err.ERR_INCORRECT_TYPE_ERROR, requestID, \"New\", \"func(http.ResponseWriter, *http.Request)\", reflect.ValueOf(methodInterface).Type().String(), reflect.ValueOf(dummyHandlerFunc).Type().String()).PrintfError()             }         } else {             return _err.NewTyped(_err.ERR_HTTP_HANDLER_METHOD_NOT_FOUND, requestID, handlerCfg.HandlerName).PrintfError()         }          s.Handlers[handlerName] = handler     } }<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"2-dobavlenie-metrik-prometheushttpsprometheusio\">2 \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a <a href=\"https:\/\/prometheus.io\/\" rel=\"nofollow noopener noreferrer\">prometheus<\/a><\/h2>\n<p>  <\/p>\n<p>\u0412 \u0448\u0430\u0431\u043b\u043e\u043d \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u0441\u0431\u043e\u0440\u043a\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043c\u0435\u0442\u0440\u0438\u043a \u0434\u043b\u044f <a href=\"https:\/\/prometheus.io\/\" rel=\"nofollow noopener noreferrer\">prometheus<\/a>:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041c\u0435\u0442\u0440\u0438\u043a\u0438 DB<br \/> \n<ul>\n<li><strong>db_total<\/strong> \u2014 The total number of processed DB by sql statement (CounterVec)<\/li>\n<li><strong>db_duration_ms<\/strong> \u2014 The duration histogram of DB operation in ms by sql statement (HistogramVec)<\/li>\n<\/ul>\n<\/li>\n<li>\u041c\u0435\u0442\u0440\u0438\u043a\u0438 HTTP request<br \/> \n<ul>\n<li><strong>http_requests_total_by_resource<\/strong> \u2014 How many HTTP requests processed, partitioned by resource (CounterVec)<\/li>\n<li><strong>http_requests_error_total_by_resource<\/strong> \u2014 How many HTTP requests was ERRORED, partitioned by resource (CounterVec)<\/li>\n<li><strong>http_request_duration_ms_by_resource<\/strong> \u2014 The duration histogram of HTTP requests in ms by resource (HistogramVec)<\/li>\n<li><strong>http_active_requests_count<\/strong> \u2014 The total number of active HTTP requests (Gauge)<\/li>\n<li><strong>http_request_duration_ms<\/strong> \u2014 The duration histogram of HTTP requests in ms (Histogram)<\/li>\n<\/ul>\n<\/li>\n<li>\u041c\u0435\u0442\u0440\u0438\u043a\u0438 HTTP client call<br \/> \n<ul>\n<li><strong>http_client_call_total_by_resource<\/strong> \u2014 How many HTTP client call processed, partitioned by resource (CounterVec)<\/li>\n<li><strong>http_client_call_duration_ms_by_resource<\/strong> \u2014 The duration histogram of HTTP client call in ms by resource (HistogramVec)<\/li>\n<\/ul>\n<\/li>\n<li>\u041c\u0435\u0442\u0440\u0438\u043a\u0438 WorkerPoolVec<br \/> \n<ul>\n<li><strong>wp_task_queue_buffer_len_vec<\/strong> \u2014 The len of the worker pool buffer (GaugeVec)<\/li>\n<li><strong>wp_add_task_wait_count_vec<\/strong> \u2014 The number of the task waiting to add to worker pool queue (GaugeVec)<\/li>\n<li><strong>wp_worker_process_count_vec<\/strong> \u2014 The number of the working worker (GaugeVec)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0414\u043e\u0441\u0442\u0443\u043f \u043a \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u043f\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u043c\u0443 \u043f\u0443\u0442\u0438 HTTP GET <a href=\"http:\/\/127.0.0.1:3000\/metrics\" rel=\"nofollow noopener noreferrer\">\/metrics<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \/ \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 YAML \u043a\u043e\u043d\u0444\u0438\u0433 <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\"># \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0441\u0431\u043e\u0440\u0430 \u043c\u0435\u0442\u0440\u0438\u043a metrics:     metrics_namespace: com     metrics_subsystem: go_app     collect_db_count_vec: true     collect_db_duration_vec: false     collect_http_requests_count_vec: true     collect_http_error_requests_count_vec: true     collect_http_requests_duration_vec: true     collect_http_active_requests_count: true     collect_http_requests_duration: true     collect_http_client_call_count_vec: true     collect_http_client_call_duration_vec: true     collect_wp_task_queue_buffer_len_vec: true     collect_wp_add_task_wait_count_vec: true     collect_wp_worker_process_count_vec: true<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"3-izmenenie-podhoda-k-logirovaniyu\">3. \u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043a \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e<\/h2>\n<p>  <\/p>\n<p>\u041b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 Kubernetes \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0432\u044b\u0432\u043e\u0434 \u0432 stdout, stderr \u2014 \u044d\u0442\u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c, \u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0432 Kubernetes stdout, stderr Docker \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043c\u0435\u044e\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c\u0441\u044f. <\/li>\n<li>\u0432\u044b\u0432\u043e\u0434 \u0432 \u0444\u0430\u0439\u043b \u043d\u0430 \u043f\u0440\u0438\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a Docker \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0443 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0440\u0435\u0441\u0443\u0440\u0441.<\/li>\n<li>\u0432\u044b\u0432\u043e\u0434 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0441\u0435\u0440\u0432\u0438\u0441, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, Kafka. <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0412\u0441\u0435\u043c \u044d\u0442\u0438\u043c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <a href=\"https:\/\/github.com\/uber-go\/zap\" rel=\"nofollow noopener noreferrer\">zap<\/a>. \u041e\u043d\u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u043b\u043e\u0433\u0433\u0435\u0440\u043e\u0432 (ZapCore), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0438.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0430\u043a\u0435\u0442\u0435 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/tree\/master\/pkg\/common\/logger\" rel=\"nofollow noopener noreferrer\">logger<\/a> \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 ZapCore \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 YAML \u043a\u043e\u043d\u0444\u0438\u0433.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u0436\u0435 \u0432 \u043f\u0430\u043a\u0435\u0442\u0435 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/tree\/master\/pkg\/common\/logger\" rel=\"nofollow noopener noreferrer\">logger<\/a> \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f <a href=\"https:\/\/github.com\/uber-go\/zap\" rel=\"nofollow noopener noreferrer\">zap<\/a> \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 <a href=\"https:\/\/gopkg.in\/natefinch\/lumberjack.v2\" rel=\"nofollow noopener noreferrer\">lumberjack<\/a> \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0446\u0438\u043a\u043b\u043e\u043c \u0440\u043e\u0442\u0430\u0446\u0438\u0438 \u0438 \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043b\u043e\u0433 \u0444\u0430\u0439\u043b\u043e\u0432. <\/p>\n<p>  <\/p>\n<p>\u041b\u044e\u0431\u043e\u0439 \u0438\u0437 ZapCore \u043c\u043e\u0436\u043d\u043e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c\/\u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0447\u0435\u0440\u0435\u0437 HTTP POST: <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/pkg\/common\/httpservice\/handler_logger_set_config.go\" rel=\"nofollow noopener noreferrer\">\/system\/config\/logger<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u044b 4 ZapCore.<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0432\u0441\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0442 DEBUG \u0434\u043e INFO \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b app.debug.log<br \/> \n<ul>\n<li>\u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u043b\u043e\u0433 \u0444\u0430\u0439\u043b\u0430 \u0432 10 MB<\/li>\n<li>\u0432\u0440\u0435\u043c\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043b\u043e\u0433 \u0444\u0430\u0439\u043b\u043e\u0432 7 \u0434\u043d\u0435\u0439<\/li>\n<li>\u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u0440\u0445\u0438\u0432\u043d\u044b\u0445 \u043b\u043e\u0433\u043e\u0432 \u2014 10 \u0431\u0435\u0437 \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/li>\n<\/ul>\n<\/li>\n<li>\u0432\u0441\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0442 ERROR \u0434\u043e FATAL \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b app.error.log<\/li>\n<li>\u0432\u0441\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0432 stdout<\/li>\n<li>\u0432\u0441\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0442 ERROR \u0434\u043e FATAL \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0432 stderr<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"plaintext\"># \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f logger:     enable: true                        # \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f 'true', 'false'     global_level: INFO                  # debug, info, warn, error, dpanic, panic, fatal - \u0432\u0441\u0435 \u043b\u043e\u0433\u0433\u0435\u0440\u044b \u043d\u0438\u0436\u0435 \u044d\u0442\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u044b     global_filename: \/app\/log\/app.log   # \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u043c\u044f \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f     zap:         enable: true                # \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f 'true', 'false'         disable_caller: false       # \u0437\u0430\u043f\u0440\u0435\u0442\u0438\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u0432 \u043b\u043e\u0433 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e caller         disable_stacktrace: false   # \u0437\u0430\u043f\u0440\u0435\u0442\u0438\u0442\u044c \u0432\u044b\u0432\u043e\u0434 stacktrace         development: false          # \u0440\u0435\u0436\u0438\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u043b\u044f \u0443\u0440\u043e\u0432\u043d\u044f dpanic         stacktrace_level: error     # \u0434\u043b\u044f \u043a\u0430\u043a\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c stacktrace debug, info, warn, error, dpanic, panic, fatal         core:             -   enable: true        # \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f 'true', 'false'                 min_level: null     # \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f debug, info, warn, error, dpanic, panic, fatal                 max_level: INFO     # \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f debug, info, warn, error, dpanic, panic, fatal                 log_to: lumberjack  # \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 'file', 'stderr', 'stdout', 'url', 'lumberjack'                 encoding: \"console\" # \u0444\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430 'console', 'json'                 file:                     filename: \".debug.log\"       # \u0438\u043c\u044f \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043e, \u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u043c\u044f                     max_size: 10                 # \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u043b\u043e\u0433 \u0444\u0430\u0439\u043b\u0430 \u0432 MB                     max_age: 7                   # \u0432\u0440\u0435\u043c\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043b\u043e\u0433 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u0434\u043d\u044f\u0445                     max_backups: 10              # \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u0440\u0445\u0438\u0432\u043d\u044b\u0445 \u043b\u043e\u0433\u043e\u0432                     local_time: true             # \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0432 \u0438\u043c\u0435\u043d\u0438 \u0430\u0440\u0445\u0438\u0432\u043d\u044b\u0445 \u043b\u043e\u0433 \u0444\u0430\u0439\u043b\u043e\u0432                     compress: false              # \u0441\u0436\u0438\u043c\u0430\u0442\u044c \u0430\u0440\u0445\u0438\u0432\u043d\u044b\u0435 \u043b\u043e\u0433 \u0444\u0430\u0439\u043b\u044b \u0432 zip \u0430\u0440\u0445\u0438\u0432             -   enable: true        # \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f 'true', 'false'                 min_level: ERROR    # \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f debug, info, warn, error, dpanic, panic, fatal                 max_level: null     # \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f debug, info, warn, error, dpanic, panic, fatal                 log_to: lumberjack  # \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 'file', 'stderr', 'stdout', 'url', 'lumberjack                 encoding: \"console\" # \u0444\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430 'console', 'json'                 file:                     filename: \".error.log\"       # \u0438\u043c\u044f \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043e, \u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u043c\u044f                     max_size: 10                 # \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u043b\u043e\u0433 \u0444\u0430\u0439\u043b\u0430 \u0432 MB                     max_age: 7                   # \u0432\u0440\u0435\u043c\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043b\u043e\u0433 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u0434\u043d\u044f\u0445                     max_backups: 10              # \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u0440\u0445\u0438\u0432\u043d\u044b\u0445 \u043b\u043e\u0433\u043e\u0432                     local_time: true             # \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0432 \u0438\u043c\u0435\u043d\u0438 \u0430\u0440\u0445\u0438\u0432\u043d\u044b\u0445 \u043b\u043e\u0433 \u0444\u0430\u0439\u043b\u043e\u0432                     compress: false              # \u0441\u0436\u0438\u043c\u0430\u0442\u044c \u0430\u0440\u0445\u0438\u0432\u043d\u044b\u0435 \u043b\u043e\u0433 \u0444\u0430\u0439\u043b\u044b \u0432 zip \u0430\u0440\u0445\u0438\u0432             -   enable: true        # \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f 'true', 'false'                 min_level: null     # \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f debug, info, warn, error, dpanic, panic, fatal                 max_level: null     # \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f debug, info, warn, error, dpanic, panic, fatal                 log_to: stdout      # \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 'file', 'stderr', 'stdout', 'url', 'lumberjack                 encoding: \"console\" # \u0444\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430 'console', 'json'             -   enable: true        # \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f 'true', 'false'                 min_level: ERROR    # \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f debug, info, warn, error, dpanic, panic, fatal                 max_level: null     # \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f debug, info, warn, error, dpanic, panic, fatal                 log_to: stderr      # \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 'file', 'stderr', 'stdout', 'url', 'lumberjack                 encoding: \"console\" # \u0444\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430 'console', 'json'<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"4-razvertyvanie-shemy-bd\">4. \u0420\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0411\u0414<\/h2>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0441\u0445\u0435\u043c\u044b \u0411\u0414 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438 DDL \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 Git \u0432\u0435\u043b\u0438\u043a\u043e\u043b\u0435\u043f\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 <a href=\"https:\/\/www.liquibase.org\/\" rel=\"nofollow noopener noreferrer\">liquibase<\/a>.<\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/www.liquibase.org\/\" rel=\"nofollow noopener noreferrer\">Liquibase<\/a> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c DDL \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0411\u0414. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u2014 \u044d\u0442\u043e\u0433\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442, \u043d\u043e \u0435\u0441\u043b\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043d\u043a\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0411\u0414 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0439, Blob storage) \u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c DDL \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438.<br \/>  \u0414\u043b\u044f Postgres \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 TOAD DataModeler. \u0414\u043b\u044f Oracle \u2014 Oracle SQL Developer Data Modeler. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, TOAD DataModeler \u0443\u043c\u0435\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c DDL \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f not null \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0432 \u0443\u0436\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443. <\/p>\n<p>  <\/p>\n<p>\u0412\u0435\u0441\u044c\u043c\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <a href=\"https:\/\/www.liquibase.org\/\" rel=\"nofollow noopener noreferrer\">Liquibase<\/a> \u2014 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0434\u043b\u044f \u043e\u0442\u043a\u0430\u0442\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439. \u0415\u0441\u043b\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0430\u0442\u0447\u0430 \u043d\u0430 \u0411\u0414 \u043f\u0440\u043e\u0448\u043b\u0430 \u043d\u0435\u0443\u0441\u043f\u0435\u0448\u043d\u043e (\u0441\u0431\u043e\u0439 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 PK, FK), \u0442\u043e \u043b\u0435\u0433\u043a\u043e \u043e\u0442\u043a\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c\u0443 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e. <\/p>\n<p>  <\/p>\n<p>\u0412 \u0448\u0430\u0431\u043b\u043e\u043d \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u043f\u0440\u0438\u043c\u0435\u0440\u044b <a href=\"https:\/\/github.com\/romapres2010\/goapp\/tree\/master\/db\/liquibase\/changelog\" rel=\"nofollow noopener noreferrer\">liquibase\/changelog<\/a> \u0438 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/tree\/master\/db\/sql\" rel=\"nofollow noopener noreferrer\">DDL \u0441\u043a\u0440\u0438\u043f\u0442\u044b<\/a> \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446 Country \u0438 Currency \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u043c \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c. <\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u0436\u0435 \u043a\u0430\u043a \u0438 \u0441 YAML \u043a\u043e\u043d\u0444\u0438\u0433\u0430\u043c\u0438, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f <a href=\"https:\/\/www.liquibase.org\/\" rel=\"nofollow noopener noreferrer\">Liquibase<\/a> Changelog \u0432 Docker \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 Liquibase, \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044b\u0439 \u0432 Job Pod Kubernetes:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0441\u043a\u0440\u0438\u043f\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0432 Liquibase \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 (\u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0440\u0430\u0437\u043c\u0435\u0440 Docker \u0441 Liquibase \u0431\u043e\u043b\u0435\u0435 300 \u041c\u0431\u0430\u0439\u0442), <\/li>\n<li>\u0441\u043a\u0440\u0438\u043f\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0432 \u043f\u0440\u0438\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u043a Docker \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0438 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 ENV \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c Changelog \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0412 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u043e\u0431\u0430 \u044d\u0442\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430.<\/p>\n<p>  <\/p>\n<h2 id=\"5-sborka-docker-image\">5. \u0421\u0431\u043e\u0440\u043a\u0430 Docker image<\/h2>\n<p>  <\/p>\n<p>Docker \u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u0432\u044b\u043b\u043e\u0436\u0435\u043d\u044b \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/tree\/master\/deploy\/docker\" rel=\"nofollow noopener noreferrer\">deploy\/docker<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Docker Desktop \u2014 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c push Docker image \u2014 \u043e\u043d\u0438 \u0432\u0441\u0435 \u043a\u0435\u0448\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435.<\/p>\n<p>  <\/p>\n<h3 id=\"sborka-docker-image-dlya-go-api\">\u0421\u0431\u043e\u0440\u043a\u0430 Docker image \u0434\u043b\u044f Go Api<\/h3>\n<p>  <\/p>\n<p>\u0421\u0431\u043e\u0440\u043a\u0430 Docker image \u0434\u043b\u044f Go Api <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/docker\/app-api.Dockerfile\" rel=\"nofollow noopener noreferrer\">app-api.Dockerfile<\/a> \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>git commit, \u0432\u0440\u0435\u043c\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u0438 \u0431\u0430\u0437\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b docker<\/li>\n<li>\u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u0447\u043a\u0438 \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0438 \u043f\u0440\u0435\u0434\u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 YAML \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u0432 \u0438 log \u0444\u0430\u0439\u043b\u043e\u0432<\/li>\n<li>\u0441\u0431\u043e\u0440\u043a\u0430 \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043f\u0438\u0438 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a .\/vendor<\/li>\n<li>\u043f\u0440\u0435\u0434\u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 YAML \u043a\u043e\u043d\u0444\u0438\u0433\u0438 \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0440\u0435\u0434 DEV-TEST-PROD \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432 \u0441\u0431\u043e\u0440\u043a\u0443 \u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 ENV \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435<\/li>\n<li>git commit, \u0432\u0440\u0435\u043c\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u0438 \u0431\u0430\u0437\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u043f\u0430\u043a\u0435\u0442 main<\/li>\n<li>\u0434\u043b\u044f \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 distroless \u043e\u0431\u0440\u0430\u0437<\/li>\n<li>\u0442\u043e\u0447\u043a\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u2014 \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 ENV \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"plaintext\">## ## Build stage ##  FROM golang:1.19-buster AS build  # git commit, \u0432\u0440\u0435\u043c\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u0438 \u0431\u0430\u0437\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b docker ARG APP_COMMIT ARG APP_BUILD_TIME ARG APP_VERSION  WORKDIR \/app  # \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u0447\u043a\u0438 \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0438 \u043f\u0440\u0435\u0434\u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 YAML \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u0432 \u0438 log \u0444\u0430\u0439\u043b\u043e\u0432 RUN mkdir .\/run &amp;&amp; mkdir .\/run\/defcfg &amp;&amp; mkdir .\/run\/log &amp;&amp; mkdir .\/run\/cfg  COPY .\/go.mod .\/go.mod COPY .\/go.sum .\/go.sum COPY .\/pkg .\/pkg COPY .\/cmd\/app\/main.go .\/cmd\/app\/main.go  # \u0441\u0431\u043e\u0440\u043a\u0430 \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043f\u0438\u0438 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a .\/vendor COPY .\/vendor .\/vendor  # \u043f\u0440\u0435\u0434\u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 YAML \u043a\u043e\u043d\u0444\u0438\u0433\u0438 \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0440\u0435\u0434 DEV-TEST-PROD \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432 \u0441\u0431\u043e\u0440\u043a\u0443 \u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 ENV \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 COPY .\/deploy\/config\/. .\/run\/defcfg\/  # git commit, \u0432\u0440\u0435\u043c\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u0438 \u0431\u0430\u0437\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u043f\u0430\u043a\u0435\u0442 main RUN go build -v -mod vendor -ldflags \"-X main.commit=${APP_COMMIT} -X main.buildTime=${APP_BUILD_TIME} -X main.version=${APP_VERSION}\" -o .\/run\/main .\/cmd\/app\/main.go  RUN echo \"Based on commit: $APP_COMMIT\" &amp;&amp; echo \"Build Time: $APP_BUILD_TIME\" &amp;&amp; echo \"Version: $APP_VERSION\"  ## ## Deploy stage ## FROM gcr.io\/distroless\/base-debian10  WORKDIR \/app  COPY --from=build \/app\/run\/. .  EXPOSE 8080\/tcp  # \u0442\u043e\u0447\u043a\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 - \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 ENV \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 ENTRYPOINT [ \"\/app\/main\"]<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0440\u0443\u0447\u043d\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0438 Docker \u0432\u044b\u043b\u043e\u0436\u0435\u043d \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 shell \u0441\u043a\u0440\u0438\u043f\u0442 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/docker\/app-api-build.sh\" rel=\"nofollow noopener noreferrer\">app-api-build.sh<\/a>:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0441\u0431\u043e\u0440\u043a\u0430 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a \u0432\u0441\u0435\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0442 \u043a\u043e\u0440\u043d\u044f \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f<\/li>\n<li>\u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u044b\u0432\u043e\u0434\u0430 \u0432\u0441\u0435\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0438\u0434\u0435\u0442 \u0432 \u0444\u0430\u0439\u043b\u044b<\/li>\n<li>\u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u0441\u0438\u0435\u0439, \u0438\u043c\u0435\u043d\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 docker tag \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0432 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u0447\u0435\u0440\u0435\u0437 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/tree\/master\/deploy\" rel=\"nofollow noopener noreferrer\">deploy<\/a><br \/> \n<ul>\n<li>\u0431\u0430\u0437\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u0444\u0430\u0439\u043b\u0435 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/version\" rel=\"nofollow noopener noreferrer\">version<\/a>. \u0414\u043b\u044f CI\/CD \u0447\u0435\u0440\u0435\u0437 github action \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u043a\u0432\u043e\u0437\u043d\u0430\u044f \u043d\u0443\u043c\u0435\u0440\u0430\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438. <\/li>\n<li>\u0438\u043c\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u0444\u0430\u0439\u043b\u0435 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/app_api_app_name\" rel=\"nofollow noopener noreferrer\">app_api_app_name<\/a>\u0432\u0435\u0434\u0435\u0442\u0441\u044f \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u0444\u0430\u0439\u043b\u0435 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/app_api_app_name\" rel=\"nofollow noopener noreferrer\">app_api_app_name<\/a><\/li>\n<li>\u0438\u043c\u044f \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u0434\u043b\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u0444\u0430\u0439\u043b\u0435 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/default_repository\" rel=\"nofollow noopener noreferrer\">default_repository<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"plaintext\">echo \"Current directory:\" pwd  export LOG_FILE=$(pwd)\/app-api-build.log  echo \"Go to working directory:\" pushd .\/..\/..\/  export APP_VERSION=$(cat .\/deploy\/version) export APP_API_APP_NAME=$(cat .\/deploy\/app_api_app_name) export APP_REPOSITORY=$(cat .\/deploy\/default_repository) export APP_BUILD_TIME=$(date -u '+%Y-%m-%d_%H:%M:%S') export APP_COMMIT=$(git rev-parse --short HEAD)  docker build --build-arg APP_VERSION=$APP_VERSION --build-arg APP_BUILD_TIME=$APP_BUILD_TIME --build-arg APP_COMMIT=$APP_COMMIT -t $APP_REPOSITORY\/$APP_API_APP_NAME:$APP_VERSION -f .\/deploy\/docker\/app-api.Dockerfile . 1>$LOG_FILE 2>&amp;1  echo \"Go to current directory:\" popd<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"sborka-docker-image-dlya-liquibase\">\u0421\u0431\u043e\u0440\u043a\u0430 Docker image \u0434\u043b\u044f liquibase<\/h3>\n<p>  <\/p>\n<p>\u0421\u0431\u043e\u0440\u043a\u0430 Docker image \u0434\u043b\u044f Liquibase <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/docker\/app-liquibase.Dockerfile\" rel=\"nofollow noopener noreferrer\">liquibase.Dockerfile<\/a> \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>Changelog \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0440\u0435\u0434 DEV-TEST-PROD \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432 \u0441\u0431\u043e\u0440\u043a\u0443 \u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 ENV \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435<\/li>\n<li>DDL \u0438 DML \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432 \u0441\u0431\u043e\u0440\u043a\u0443 \u043b\u0438\u0431\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u044e\u044e \u0442\u043e\u0447\u043a\u0443 \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"plaintext\">## ## Deploy stage ## FROM liquibase\/liquibase:4.9.1  # Changelog \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0440\u0435\u0434 DEV-TEST-PROD \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432 \u0441\u0431\u043e\u0440\u043a\u0443 \u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 ENV \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 COPY .\/db\/liquibase\/changelog\/. \/liquibase\/changelog\/  # DDL \u0438 DML \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432 \u0441\u0431\u043e\u0440\u043a\u0443 COPY .\/db\/sql \/sql <\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"6-sborka-docker-compose\">6. \u0421\u0431\u043e\u0440\u043a\u0430 Docker Compose<\/h2>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0438 \u0443\u0434\u043e\u0431\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Docker Compose. \u0421\u043a\u0440\u0438\u043f\u0442 \u0441\u0431\u043e\u0440\u043a\u0438 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/compose\/compose-app.yaml\" rel=\"nofollow noopener noreferrer\">compose-app.yaml<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/tree\/master\/deploy\/run\/local.compose.global.config\" rel=\"nofollow noopener noreferrer\">\/deploy\/run\/local.compose.global.config<\/a> \u0432\u044b\u043b\u043e\u0436\u0435\u043d\u044b \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Docker Compose.<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0432\u0441\u0435 ENV \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/run\/local.compose.global.config\/.env\" rel=\"nofollow noopener noreferrer\">.env \u0444\u0430\u0439\u043b<\/a><\/li>\n<li>\u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u044b (API, \u0411\u0414, UI) \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0442\u044c \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<br \/> \n<ul>\n<li><a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/run\/local.compose.global.config\/compose-app-api-db-reload-up.sh\" rel=\"nofollow noopener noreferrer\">\/deploy\/run\/local.compose.global.config\/compose-app-api-db-reload-up.sh<\/a> \u2014 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0447\u0438\u0441\u0442\u0438\u0442 \u0411\u0414, \u0438 \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 API<\/li>\n<li><a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/run\/local.compose.global.config\/compose-app-ui-up.sh\" rel=\"nofollow noopener noreferrer\">\/deploy\/run\/local.compose.global.config\/compose-app-ui-up.sh<\/a> \u2014 \u043f\u0435\u0440\u0435\u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e UI<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>  <\/p>\n<h3 id=\"docker-compose-dlya-go-api\">Docker Compose \u0434\u043b\u044f Go Api<\/h3>\n<p>  <\/p>\n<p>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f build<\/li>\n<li>\u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0432 Dockerfile (APP_COMMIT, APP_BUILD_TIME, APP_VERSION) \u043f\u0440\u043e\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 ENV \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f<\/li>\n<li>ENV \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u0435\u0440\u0443\u0442\u0441\u044f \u0438\u0437 \u043e\u0434\u043d\u043e\u0438\u043c\u0435\u043d\u043d\u044b\u0445 ENV \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f (\u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430)<\/li>\n<li>\u0432 Docker \u043c\u043e\u043d\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f volum\u0435s \u0434\u043b\u044f \u043a\u043e\u043d\u0444\u0438\u0433 \u0438 \u043b\u043e\u0433\u043e\u0432 (\/app\/cfg:ro, \/app\/log:rw)<\/li>\n<li>\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 (depends_on) \u043e\u0442 \u0411\u0414 \u043d\u0435 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u2014 \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u043e \u043c\u043e\u0433\u043b\u043e \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0440\u0442\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0431\u0435\u0437 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0439 \u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u043e restart_policy: on-failure<\/li>\n<li>\u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d healthcheck \u043d\u0430 GET: \/app\/system\/health<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"plaintext\">  app-api:     build:       context: .\/..\/..\/       dockerfile: .\/deploy\/docker\/app-api.Dockerfile       tags:         - $APP_REPOSITORY\/$APP_API_APP_NAME:$APP_VERSION       args:         - APP_COMMIT=${APP_COMMIT:-unset}         - APP_BUILD_TIME=${APP_BUILD_TIME:-unset}         - APP_VERSION=${APP_VERSION:-unset}     container_name: app-api     hostname: app-api-host     networks:       - app-net     ports:       - $APP_HTTP_OUT_PORT:$APP_HTTP_PORT       - 8001:$APP_HTTP_PORT     environment:       - TZ=\"Europe\/Moscow\"       - APP_CONFIG_FILE=${APP_CONFIG_FILE:-\/app\/defcfg\/app.global.yaml}       - APP_HTTP_LISTEN_SPEC=${APP_HTTP_LISTEN_SPEC:-0.0.0.0:8080}       - APP_LOG_LEVEL=${APP_LOG_LEVEL:-ERROR}       - APP_LOG_FILE=${APP_LOG_FILE:-\/app\/log\/app.log}       - APP_PG_USER=${APP_PG_USER:-postgres}       - APP_PG_PASS=${APP_PG_PASS:?database password not set}       - APP_PG_HOST=${APP_PG_HOST:-app-db-host}       - APP_PG_PORT=${APP_PG_PORT:-5432}       - APP_PG_DBNAME=${APP_PG_DBNAME:-postgres}     volumes:       - \".\/..\/..\/..\/app_volumes\/cfg:\/app\/cfg:ro\"       - \".\/..\/..\/..\/app_volumes\/log:\/app\/log:rw\"     deploy:       restart_policy:         condition: on-failure     healthcheck:       test: [\"curl -f 0.0.0.0:8080\/app\/system\/health\"]       interval: 10s       timeout: 5s       retries: 5<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"docker-compose-dlya-liquibase\">Docker Compose \u0434\u043b\u044f liquibase<\/h3>\n<p>  <\/p>\n<p>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u043e\u0434\u043c\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 Volume \u0434\u043b\u044f \u043b\u043e\u0433\u043e\u0432 (\/liquibase\/mylog:rw) <\/li>\n<li>\u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0442 \u0411\u0414 (depends_on condition: service_healthy)<\/li>\n<li>\u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 Docker \u043c\u043e\u043d\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f volum\u0435s \u0434\u043b\u044f changelog \u0438 sql (\/liquibase\/sql:rw, \/liquibase\/changelog:rw)<\/li>\n<li>changelog \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 ENV \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"plaintext\">  app-liquibase:     build:       context: .\/..\/..\/       dockerfile: .\/deploy\/docker\/app-liquibase.Dockerfile       tags:         - $APP_REPOSITORY\/$APP_LUQUIBASE_APP_NAME:$APP_VERSION     container_name: app-liquibase     depends_on:       app-db:         condition: service_healthy     networks:       - app-net #    volumes: #      - \".\/..\/..\/..\/app_volumes\/log:\/liquibase\/mylog:rw\" #      - \".\/..\/..\/..\/app_volumes\/sql:\/liquibase\/sql:rw\" #      - \".\/..\/..\/..\/app_volumes\/log:\/liquibase\/changelog:rw\" #    command: --changelog-file=.\/changelog\/$APP_PG_CHANGELOG --url=\"jdbc:postgresql:\/\/$APP_PG_HOST:$APP_PG_PORT\/$APP_PG_DBNAME\" --username=$APP_PG_USER --password=$APP_PG_PASS --logFile=\"mylog\/liquibase.log\" --logLevel=info update     command: --changelog-file=.\/changelog\/$APP_PG_CHANGELOG --url=\"jdbc:postgresql:\/\/$APP_PG_HOST:$APP_PG_PORT\/$APP_PG_DBNAME\" --username=$APP_PG_USER --password=$APP_PG_PASS --logLevel=info update<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"docker-compose-dlya-bd\">Docker Compose \u0434\u043b\u044f \u0411\u0414<\/h3>\n<p>  <\/p>\n<p>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0432 Docker \u043c\u043e\u043d\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f volum\u0435 \u0434\u043b\u044f \u0411\u0414 (\/var\/lib\/postgresql\/data:rw)<\/li>\n<li>\u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d healthcheck \u043d\u0430 &#171;CMD-SHELL&#187;, &#171;pg_isready&#187;<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"plaintext\">  app-db:     image: postgres:14.5-alpine     container_name: app-db     hostname: app-db-host     environment:       - POSTGRES_PASSWORD=${APP_PG_PASS:?database password not set}       - PGUSER=${APP_PG_USER:?database user not set}     networks:       - app-net     ports:       - $APP_PG_OUT_PORT:$APP_PG_PORT     volumes:       - \".\/..\/..\/..\/app_volumes\/db:\/var\/lib\/postgresql\/data:rw\"     healthcheck:       test: [\"CMD-SHELL\", \"pg_isready\"]       interval: 10s       timeout: 5s       retries: 5       start_period: 10s     restart: unless-stopped<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"7-shema-razvertyvaniya-v-kubernetes\">7. \u0421\u0445\u0435\u043c\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0432 Kubernetes<\/h2>\n<p>  <\/p>\n<p>\u0421\u0445\u0435\u043c\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0432 <a href=\"https:\/\/kubernetes.io\/ru\/docs\/tutorials\/kubernetes-basics\/\" rel=\"nofollow noopener noreferrer\">Kubernetes<\/a> \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0430 \u0432 \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435, \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 UI (Jmix) \u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043a\u044d\u0448\u0435\u043c (hazelcast).<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/post_images\/110\/b29\/b5b\/110b29b5bc2d9df9e250549adb05268d.jpg\" alt=\"\u0421\u0445\u0435\u043c\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0432 Kubernetes\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/110\/b29\/b5b\/110b29b5bc2d9df9e250549adb05268d.jpg\" data-blurred=\"true\"\/><\/p>\n<p>  <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0432 Kubernetes \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <a href=\"https:\/\/kubernetes.io\/docs\/concepts\/workloads\/pods\/\" rel=\"nofollow noopener noreferrer\">Pod<\/a>.<br \/>  \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u2014 \u044d\u0442\u043e \u0433\u0440\u0443\u043f\u043f\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u0441 \u043e\u0431\u0449\u0438\u043c\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043e\u0442 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 Pod.<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041e\u0431\u044b\u0447\u043d\u043e, \u0432 Pod \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d app \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440, \u0438, \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438, init \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440.<\/li>\n<li>\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c app \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0432 Pod \u043d\u0435\u043b\u044c\u0437\u044f, \u043b\u0438\u0431\u043e \u043e\u043d \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u0430\u043c, \u043b\u0438\u0431\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c Pod (\u0440\u0443\u043a\u0430\u043c\u0438 \u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 Deployment \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0432 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e replicas \u0434o 0).<\/li>\n<li>Pod \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c \u0443\u0437\u043b\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 Kubernetes<\/li>\n<li>\u0414\u043b\u044f Pod \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0435\u0441\u0442\u0430\u0440\u0442\u0430 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0433\u043e Node <a href=\"https:\/\/kubernetes.io\/docs\/concepts\/workloads\/pods\/pod-lifecycle\/#restart-policy\" rel=\"nofollow noopener noreferrer\">restartPolicy<\/a>: Always, OnFailure, Never.<\/li>\n<li>\u0422\u0440\u0435\u043c\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c Pod \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 Kubernetes. \u0412 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, Pod \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0435\u0441\u043b\u0438:<br \/> \n<ul>\n<li>\u0432\u0441\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b \u0432 Pod \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0443 (\u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0438\u043b\u0438 \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u043e)<\/li>\n<li>\u043d\u0430\u0440\u0443\u0448\u0435\u043d\u044b liveness probe \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430<\/li>\n<li>\u043d\u0430\u0440\u0443\u0448\u0435\u043d\u044b limits.memory \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430<\/li>\n<li>Pod \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b\u0430\u0441\u044c \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0438 Horizontal Autoscaler \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e replicas <\/li>\n<\/ul>\n<\/li>\n<li>\u041f\u0440\u0438 <a href=\"https:\/\/kubernetes.io\/docs\/concepts\/workloads\/pods\/pod-lifecycle\/#pod-termination\" rel=\"nofollow noopener noreferrer\">\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 Pod<\/a>:<br \/> \n<ul>\n<li>\u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d STOPSIGNAL<\/li>\n<li>\u043f\u043e \u043f\u0440\u043e\u0448\u0435\u0441\u0442\u0432\u0438\u0438 terminationGracePeriodSeconds \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u0431\u0443\u0434\u0443\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u044b<\/li>\n<li>\u043f\u0440\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 Pod \u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438, \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u043c \u0443\u0437\u043b\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 IP \u0430\u0434\u0440\u0435\u0441\u0430\u043c\u0438 \u0438 \u043f\u043e\u0440\u0442\u0430\u043c\u0438 \u0438 \u043a \u043d\u0435\u043c\u0443 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043d\u043e\u0432\u044b\u0435 Volume<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 stateless \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043b\u044f Kubernetes \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0443:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u0432 \u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442<br \/> \n<ul>\n<li>\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c &#171;\u0447\u0438\u0441\u0442\u043e\u0439&#187; \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0438 grace period (\u0437\u0430\u043a\u0440\u044b\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0411\u0414, \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c (\u0438\u043b\u0438 \u043d\u0435\u0442) \u0442\u0435\u043a\u0443\u0449\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u0437\u0430\u043a\u0440\u044b\u0442\u044c HTTP \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, &#8230;)<\/li>\n<li>\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c &#171;\u0436\u0435\u0441\u0442\u043a\u043e\u0439&#187; \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438, \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441\u043e stateful \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438, \u0442\u043e \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u043e\u043c\u043f\u0435\u043d\u0441\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0432\u043e\u0437\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435<\/li>\n<li>\u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u0438\u043c\u0438\u0442 \u043f\u043e \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f <\/li>\n<\/ul>\n<\/li>\n<li>\u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435\/\u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u0442\u0435\u0440\u044f\u043d\u044b<\/li>\n<li>\u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435\/\u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u043f\u0440\u0438\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 Volume \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0442\u0430\u043a \u0436\u0435 \u043f\u043e\u0442\u0435\u0440\u044f\u043d\u044b<\/li>\n<li>\u043f\u0440\u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f \u043a stdout \u0438 stderr \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043c\u043e\u0436\u043d\u043e, \u043d\u043e \u0435\u0441\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u2014 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043b\u043e\u0433\u0438 \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0440\u0430\u0437\u0443 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0438\u043b\u0438 \u043d\u0430 Volume, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u043e\u0447\u043d\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u0430\u043b\u0435\u043d <\/li>\n<li>\u0432 Kubernetes \u043d\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u044f\u0432\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0442\u0430\u0440\u0442\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 Pod<br \/> \n<ul>\n<li>\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043e \u0440\u0430\u043d\u044c\u0448\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 <\/li>\n<li>\u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0433\u043e (\u0438\u043b\u0438 \u043b\u0438\u043c\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0440\u0430\u0437) \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0438 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432<\/li>\n<li>\u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445 liveness\/readiness probe, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0433\u043e\u0442\u043e\u0432\u043e \u043a \u0440\u0430\u0431\u043e\u0442\u0435<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>  <\/p>\n<h2 id=\"8-podgotovka-yaml-dlya-kubernetes\">8. \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 YAML \u0434\u043b\u044f Kubernetes<\/h2>\n<p>  <\/p>\n<h3 id=\"konfigurirovanie\">\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h3>\n<p>  <\/p>\n<p>\u0412 Kubernetes \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e \u0434\u043b\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f <a href=\"https:\/\/kubernetes.io\/docs\/concepts\/configuration\/configmap\/\" rel=\"nofollow noopener noreferrer\">ConfigMaps<\/a> \u0434\u043b\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0438 <a href=\"https:\/\/kubernetes.io\/docs\/concepts\/configuration\/secret\/\" rel=\"nofollow noopener noreferrer\">Secrets<\/a> \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a, \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/kubernates\/base\/app-configmap.yaml\" rel=\"nofollow noopener noreferrer\">\/deploy\/kubernates\/base\/app-configmap.yaml<\/a>, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438. \u0412 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u0445, \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0438 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0438 \u0438\u0437 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0444\u0430\u0439\u043b \u0431\u0435\u0437 &#171;\u0440\u0430\u0437\u0431\u043e\u0440\u0430&#187;.<\/p>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u044b Kubernetes \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0440\u0430\u0437\u0443 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c namespace <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/kubernates\/base\/app-namespase.yaml\" rel=\"nofollow noopener noreferrer\">\/deploy\/kubernates\/base\/app-namespase.yaml<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u0430 \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043a\u0438 \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0430 \u043e\u0434\u043d\u0430 \u043c\u0435\u0442\u043a\u0430 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c &#8216;app&#8217; \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c &#8216;app&#8217;.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">apiVersion: v1 kind: ConfigMap metadata:   name: app-config   labels:     app: app   namespace: go-app data:   APP_CONFIG_FILE: \/app\/defcfg\/app.global.yaml   APP_HTTP_PORT: \"8080\"   APP_HTTP_LISTEN_SPEC: 0.0.0.0:8080   APP_LOG_LEVEL: ERROR   APP_LOG_FILE: \/app\/log\/app.log   APP_PG_HOST: dev-app-db   APP_PG_PORT: \"5432\"   APP_PG_DBNAME: postgres   APP_PG_CHANGELOG: db.changelog-1.0_recreate_testdatamdg.xml   <\/code><\/pre>\n<p>  <\/p>\n<p>&#171;\u0421\u0435\u043a\u0440\u0435\u0442\u043d\u044b\u0435&#187; \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0432 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/kubernates\/base\/app-secret.yaml\" rel=\"nofollow noopener noreferrer\">\/deploy\/kubernates\/base\/app-secret.yaml<\/a>.<br \/>  \u0414\u0430\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u044b\u0439 \u2014 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0435\u0435 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435. <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">apiVersion: v1 kind: Secret metadata:   name: app-secret   labels:     app: app   namespace: go-app type: Opaque stringData:   APP_PG_USER: postgres   APP_PG_PASS: postgres<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"bd\">\u0411\u0414<\/h3>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0411\u0414 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043e \u0432 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e\u043c stateless \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 (\u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f dev).<br \/>  \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0434\u043b\u044f \u043f\u0440\u043e\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u043e\u0439 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438 \u2014 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/github.com\/zalando\/postgres-operator\" rel=\"nofollow noopener noreferrer\">zalando<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e, \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0434\u043b\u044f <a href=\"https:\/\/kubernetes.io\/docs\/concepts\/storage\/persistent-volumes\/\" rel=\"nofollow noopener noreferrer\">Persistent Volumes<\/a> \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u0444\u0430\u0439\u043b\u044b \u0441 \u0411\u0414.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 PersistentVolumeClaim \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f, \u0442\u043e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 Persistent Volumes \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 persistentVolumeReclaimPolicy, \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u0430\u043b\u0435\u043d, \u043e\u0447\u0438\u0449\u0435\u043d \u0438\u043b\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d.<\/p>\n<p>  <\/p>\n<p><em>\u0425\u043e\u0440\u043e\u0448\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/serveradmin.ru\/hranilishha-dannyh-persistent-volumes-v-kubernetes\/\" rel=\"nofollow noopener noreferrer\">\u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449 \u0434\u0430\u043d\u043d\u044b\u0445 (Persistent Volumes) \u0432 Kubernetes<\/a><\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">apiVersion: v1 kind: PersistentVolumeClaim metadata:     name: app-db-claim     labels:         app: app     namespace: go-app spec:     accessModes:         - ReadWriteOnce     resources:         requests:             storage: 100Mi<\/code><\/pre>\n<p>  <\/p>\n<p>\u0423\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c Pod \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/kubernetes.io\/docs\/concepts\/workloads\/controllers\/deployment\/\" rel=\"nofollow noopener noreferrer\">Deployments<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0434\u0430\u0435\u0442 \u0448\u0430\u0431\u043b\u043e\u043d \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f Pod.<br \/>  \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/kubernates\/base\/app-db-deployment.yaml\" rel=\"nofollow noopener noreferrer\">\/deploy\/kubernates\/base\/app-db-deployment.yaml<\/a>:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e replicas: 1 \u2014 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u0411\u0414 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e, \u043d\u043e \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438 \u0443 \u043a\u0430\u0436\u0434\u043e\u0439 \u0411\u0414 \u0431\u0443\u0434\u0443\u0442 \u0441\u0432\u043e\u0438 \u0444\u0430\u0439\u043b\u044b.<\/li>\n<li>template.metadata.labels \u0437\u0430\u0434\u0430\u043d\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043c\u0435\u0442\u043a\u0430 tier: app-db, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043b\u0435\u0433\u043a\u043e \u043d\u0430\u0439\u0442\u0438 Pod \u0411\u0414<\/li>\n<li>ENV \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0438\u0437 \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 ConfigMap \u0438 Secret<\/li>\n<li>\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b readinessProbe \u0438 livenessProbe<\/li>\n<li>resources.limits \u0434\u043b\u044f \u0411\u0414 \u043d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f<\/li>\n<li>\u043a \/var\/lib\/postgresql\/data \u043f\u0440\u0438\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d volume, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0447\u0435\u0440\u0435\u0437 \u0440\u0430\u043d\u0435\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 persistentVolumeClaim.claimName: app-db-claim<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"plaintext\">apiVersion: apps\/v1 kind: Deployment metadata:     name: app-db     labels:         tier: app-db     namespace: go-app spec:     replicas: 1     selector:         matchLabels:             tier: app-db     strategy:         type: Recreate     template:         metadata:             labels:                 app_net: \"true\"                 tier: app-db         spec:             containers:                 - name: app-db                   env:                     - name: POSTGRES_PASSWORD                       valueFrom:                         secretKeyRef:                           name: app-secret                           key: APP_PG_PASS                     - name: POSTGRES_DB                       valueFrom:                         configMapKeyRef:                           name: app-config                           key: APP_PG_DBNAME                     - name: POSTGRES_USER                       valueFrom:                         secretKeyRef:                           name: app-secret                           key: APP_PG_USER                     - name: PGUSER                       valueFrom:                         secretKeyRef:                           name: app-secret                           key: APP_PG_USER                   image: postgres:14.5-alpine                   imagePullPolicy: IfNotPresent                   readinessProbe:                     exec:                       command:                         - pg_isready                     initialDelaySeconds: 30  # Time to create a new DB                     failureThreshold: 5                     periodSeconds: 10                     timeoutSeconds: 5                   livenessProbe:                     exec:                       command:                         - pg_isready                     failureThreshold: 5                     periodSeconds: 10                     timeoutSeconds: 5                   ports:                     - containerPort: 5432                   volumeMounts:                     - mountPath: \/var\/lib\/postgresql\/data                       name: app-db-volume             hostname: app-db-host             restartPolicy: Always             volumes:               - name: app-db-volume                 persistentVolumeClaim:                   claimName: app-db-claim<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0411\u0414 \u043d\u0443\u0436\u0435\u043d \u0432\u043d\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c <a href=\"https:\/\/kubernetes.io\/docs\/concepts\/services-networking\/service\/\" rel=\"nofollow noopener noreferrer\">Service<\/a> \u0441 \u0442\u0438\u043f\u043e\u043c NodePort \u2014 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/kubernates\/base\/app-db-service.yaml\" rel=\"nofollow noopener noreferrer\">\/deploy\/kubernates\/base\/app-db-service.yaml<\/a>. <\/p>\n<p>  <\/p>\n<ul>\n<li>\u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0443\u0437\u043b\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u0433\u0434\u0435 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442 Pod \u0441 \u0411\u0414 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043a\u0440\u044b\u0442 &#171;\u0440\u0430\u043d\u0434\u043e\u043c\u043d\u044b\u0439&#187; \u043f\u043e\u0440\u0442, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043c\u0430\u043f\u043b\u0435\u043d \u043f\u043e\u0440\u0442 5432 \u0438\u0437 Docker \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0441 \u0411\u0414<\/li>\n<li>\u043f\u043e \u044d\u0442\u043e\u043c\u0443 &#171;\u0440\u0430\u043d\u0434\u043e\u043c\u043d\u043e\u043c\u0443&#187; \u043f\u043e\u0440\u0442\u0443 \u0438 IP \u0430\u0434\u0440\u0435\u0441\u0443 \u0443\u0437\u043b\u0430 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0411\u0414.<\/li>\n<li>\u043d\u0430\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u0411\u0414 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043f\u043e\u0440\u0442 \u043d\u0435\u043b\u044c\u0437\u044f. \u041f\u0440\u0438 \u043f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 Pod \u0447\u0435\u0440\u0435\u0437 stateless Deployment, \u043f\u043e\u0440\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0436\u0435 \u0434\u0440\u0443\u0433\u0438\u043c.<\/li>\n<li>\u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b Service \u0431\u044b\u043b \u0441\u043c\u0430\u043f\u043b\u0435\u043d \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u043c \u0447\u0435\u0440\u0435\u0437 Deployment Pod \u0411\u0414, \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c Service.spec.selector.tier: app-db \u0438 Deployment.spec.template.metadata.labels.tier: app-db<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"plaintext\">apiVersion: v1 kind: Service metadata:     name: app-db     labels:         tier: app-db     namespace: go-app spec:     type: NodePort   # A port is opened on each node in your cluster via Kube proxy.     ports:         - port: 5432           targetPort: 5432     selector:         tier: app-db<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"liquibase\">Liquibase<\/h3>\n<p>  <\/p>\n<p>Liquibase \u0441\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430\u043c\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437, \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0441\u0442\u0430\u0440\u0442\u0430 \u0411\u0414: <\/p>\n<p>  <\/p>\n<ul>\n<li>\u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u043a, \u043f\u043e\u043a\u0430 \u0411\u0414 \u043d\u0435 \u043f\u043e\u0434\u043d\u0438\u043c\u0435\u0442\u0441\u044f<\/li>\n<li>\u0432\u0442\u043e\u0440\u043e\u0439 \u0440\u0430\u0437 Liquibase \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f <\/li>\n<li>\u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u043a\u0438 \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0439 \u0438\u043d\u0441\u0442\u0430\u043b\u043b\u044f\u0446\u0438\u0438 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 DDL \u0438 DML \u043d\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0411\u0414.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Helm, \u0437\u0430\u043f\u0443\u0441\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0432 \u0432\u0438\u0434\u0435 \u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u043e\u0433\u043e Pod \u2014 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/kubernates\/base\/app-liquibase-pod.yaml\" rel=\"nofollow noopener noreferrer\">\/deploy\/kubernates\/base\/app-liquibase-pod.yaml<\/a><\/p>\n<p>  <\/p>\n<ul>\n<li>ENV \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0438\u0437 \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 ConfigMap \u0438 Secret<\/li>\n<li>template.metadata.labels \u0437\u0430\u0434\u0430\u043d\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043c\u0435\u0442\u043a\u0430 tier: app-liquibase, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043b\u0435\u0433\u043a\u043e \u043d\u0430\u0439\u0442\u0438 Pod Liquibase<\/li>\n<li>\u0437\u0430\u0434\u0430\u043d \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 initContainers \u0441 image: busybox:1.28, \u0437\u0430\u0434\u0430\u0447\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u2014 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b (\u043b\u0443\u0447\u0448\u0435 \u0435\u0433\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c, \u0438\u043d\u0430\u0447\u0435 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0440\u0443\u043a\u0430\u043c\u0438 \u0443\u0434\u0430\u043b\u044f\u0442\u044c Pod) \u2014 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0440\u0442\u0430 5432 postgres \u0432 Pod c \u0411\u0414.<br \/> \n<ul>\n<li>\u0434\u043b\u044f \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0440\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 nc -w<\/li>\n<li>\u0437\u0434\u0435\u0441\u044c \u043d\u0430\u043c \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u043b\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0440\u0430\u043d\u0435\u0435 Service \u0434\u043b\u044f \u0411\u0414. <\/li>\n<li>\u0412 \u0440\u0430\u043c\u043a\u0430\u0445 Kubernetes \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u0440\u0430\u0442\u043a\u043e\u0433\u043e DNS \u0438\u043c\u0435\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e Service.metadata.name, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u043a\u0430\u043a &#8216;app-db&#8217;. <\/li>\n<li>\u042d\u0442\u043e \u0436\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u044b \u0437\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0432 ConfigMap.data.APP_PG_HOST<\/li>\n<li>ConfigMap.data.APP_PG_HOST \u0441\u043c\u0430\u043f\u043b\u0435\u043d \u043d\u0430 ENV \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e initContainers.env.APP_PG_HOST<\/li>\n<li>ENV \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e initContainers.env.APP_PG_HOST \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 nc -w<\/li>\n<\/ul>\n<\/li>\n<li>\u0432 command \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0442\u0440\u043e\u043a\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 Liquibase \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0447\u0435\u0440\u0435\u0437 ENV \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e initContainers.env.APP_PG_CHANGELOG \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 &#8216;&#8212;changelog-file=.\/changelog\/$(APP_PG_CHANGELOG)&#8217;<\/li>\n<li>\u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a Liquibase Pod \u0443\u043a\u0430\u0437\u0430\u043d\u043e spec.restartPolicy: Never<\/li>\n<li>tag \u0434\u043b\u044f Docker \u043e\u0431\u0440\u0430\u0437\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0432 kustomize \u0447\u0435\u0440\u0435\u0437 \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 image: app-liquibase <\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"plaintext\">apiVersion: v1 kind: Pod metadata:     name: app-liquibase     labels:         tier: app-liquibase     namespace: go-app spec:     initContainers:         - name: init-app-liquibase           env:             - name: APP_PG_HOST               valueFrom:                 configMapKeyRef:                   name: app-config                   key: APP_PG_HOST             - name: APP_PG_PORT               valueFrom:                 configMapKeyRef:                   name: app-config                   key: APP_PG_PORT           image: busybox:1.28           command: ['sh', '-c', \"until nc -w 2 $(APP_PG_HOST) $(APP_PG_PORT); do echo Waiting for $(APP_PG_HOST):$(APP_PG_PORT) to be ready; sleep 5; done\"]     containers:         - name: app-liquibase           env:             - name: APP_PG_USER               valueFrom:                 secretKeyRef:                   name: app-secret                   key: APP_PG_USER             - name: APP_PG_PASS               valueFrom:                 secretKeyRef:                   name: app-secret                   key: APP_PG_PASS             - name: APP_PG_HOST               valueFrom:                 configMapKeyRef:                   name: app-config                   key: APP_PG_HOST             - name: APP_PG_PORT               valueFrom:                 configMapKeyRef:                   name: app-config                   key: APP_PG_PORT             - name: APP_PG_DBNAME               valueFrom:                 configMapKeyRef:                   name: app-config                   key: APP_PG_DBNAME             - name: APP_PG_CHANGELOG               valueFrom:                 configMapKeyRef:                   name: app-config                   key: APP_PG_CHANGELOG           image: app-liquibase # image: romapres2010\/app-liquibase:2.0.0           command: ['sh', '-c', \"docker-entrypoint.sh --changelog-file=.\/changelog\/$(APP_PG_CHANGELOG) --url=jdbc:postgresql:\/\/$(APP_PG_HOST):$(APP_PG_PORT)\/$(APP_PG_DBNAME) --username=$(APP_PG_USER) --password=$(APP_PG_PASS) --logLevel=info update\"]           imagePullPolicy: IfNotPresent     restartPolicy: Never<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"go-api\">Go Api<\/h3>\n<p>  <\/p>\n<p>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/kubernates\/base\/app-api-deployment.yaml\" rel=\"nofollow noopener noreferrer\">\/deploy\/kubernates\/base\/app-api-deployment.yaml<\/a>:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e replicas: 1, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0431\u0443\u0434\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f Horizontal Autoscaler<\/li>\n<li>template.metadata.labels \u0437\u0430\u0434\u0430\u043d\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043c\u0435\u0442\u043a\u0430 tier: app-api, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043b\u0435\u0433\u043a\u043e \u043d\u0430\u0439\u0442\u0438 Pod Go App<\/li>\n<li>ENV \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0438\u0437 \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 ConfigMap \u0438 Secret<\/li>\n<li>\u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 Liquibase \u0437\u0430\u0434\u0430\u043d \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 initContainers \u0434\u043b\u044f \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0440\u0442\u0430 5432 postgres \u0432 Pod c \u0411\u0414<br \/> \n<ul>\n<li>\u0442\u0430\u043a \u043a\u0430\u043a \u0432\u0441\u0435 Pod (\u0411\u0414, Liquibase, Go Api) \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u044b \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e, \u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u0411\u0414 \u0443\u0436\u0435 \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u0430\u043b\u0430, \u043d\u043e Liquibase \u0435\u0449\u0435 \u043d\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b DDL \u0438 DML \u0441\u043a\u0440\u0438\u043f\u0442\u044b. \u0418\u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b \u0438\u0445 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e. <\/li>\n<li>\u0432 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0441 Go Api (\u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u0435) \u0431\u0443\u0434\u0435\u0442 \u043f\u0430\u0434\u0430\u0442\u044c \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u0438 \u043f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f.<\/li>\n<li>\u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c readinessProbe \u0434\u043b\u044f Go Api, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0441 \u043a\u0430\u043a\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0433\u043e\u0442\u043e\u0432\u043e \u043a \u0440\u0430\u0431\u043e\u0442\u0435<\/li>\n<li>\u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0438\u043c\u0435\u0442\u044c \u0432 \u0411\u0414 \u043c\u0435\u0442\u043a\u0443 \u0438\u043b\u0438 \u0441\u0438\u0433\u043d\u0430\u043b, \u043e\u0431 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u043f\u0430\u0442\u0447\u0435\u0439 \u043d\u0430 \u0411\u0414 \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 Go Api \u0431\u0443\u0434\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u0430 \u043a \u0440\u0430\u0431\u043e\u0442\u0435 <\/li>\n<\/ul>\n<\/li>\n<li>\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b readinessProbe \u0438 livenessProbe \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 httpGet<\/li>\n<li>\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u043f\u0435\u0440\u0438\u043e\u0434 \u043c\u044f\u0433\u043a\u043e\u0439 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u2014 terminationGracePeriodSeconds: 45<\/li>\n<li>\u0437\u0430\u0434\u0430\u043d\u044b resources.requests \u2014 \u044d\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b, \u0434\u043b\u044f \u0441\u0442\u0430\u0440\u0442\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0431\u0440\u0430\u043d \u0443\u0437\u0435\u043b \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0441\u043e \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u043c\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438.<\/li>\n<li>\u0437\u0430\u0434\u0430\u043d\u044b resources.limits<br \/> \n<ul>\n<li>\u0435\u0441\u043b\u0438 \u043f\u0440\u0435\u0432\u044b\u0448\u0435\u043d limits.memory, \u0442\u043e Pod \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u0430\u043b\u0435\u043d \u0438 \u043f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u043d<\/li>\n<li>limits.cpu \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043e\u043c \u2014 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043e. <\/li>\n<\/ul>\n<\/li>\n<li>tag \u0434\u043b\u044f Docker \u043e\u0431\u0440\u0430\u0437\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0432 kustomize \u0447\u0435\u0440\u0435\u0437 \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 image: app-api<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"plaintext\">apiVersion: apps\/v1 kind: Deployment metadata:     name: app-api     labels:         tier: app-api     namespace: go-app spec:     replicas: 1     selector:         matchLabels:             tier: app-api     strategy:         type: Recreate     template:         metadata:             labels:                 app_net: \"true\"                 tier: app-api         spec:             initContainers:                 - name: init-app-api                   env:                     - name: APP_PG_HOST                       valueFrom:                         configMapKeyRef:                           name: app-config                           key: APP_PG_HOST                     - name: APP_PG_PORT                       valueFrom:                         configMapKeyRef:                           name: app-config                           key: APP_PG_PORT                   image: busybox:1.28                   command: ['sh', '-c', \"until nc -w 2 $(APP_PG_HOST) $(APP_PG_PORT); do echo Waiting for $(APP_PG_HOST):$(APP_PG_PORT) to be ready; sleep 5; done\"]             terminationGracePeriodSeconds: 45             containers:                 - name: app-api                   env:                     - name: APP_CONFIG_FILE                       valueFrom:                         configMapKeyRef:                           name: app-config                           key: APP_CONFIG_FILE                     - name: APP_HTTP_LISTEN_SPEC                       valueFrom:                         configMapKeyRef:                           name: app-config                           key: APP_HTTP_LISTEN_SPEC                     - name: APP_LOG_LEVEL                       valueFrom:                         configMapKeyRef:                           name: app-config                           key: APP_LOG_LEVEL                     - name: APP_LOG_FILE                       valueFrom:                         configMapKeyRef:                           name: app-config                           key: APP_LOG_FILE                     - name: APP_PG_USER                       valueFrom:                         secretKeyRef:                           name: app-secret                           key: APP_PG_USER                     - name: APP_PG_PASS                       valueFrom:                         secretKeyRef:                           name: app-secret                           key: APP_PG_PASS                     - name: APP_PG_HOST                       valueFrom:                         configMapKeyRef:                           name: app-config                           key: APP_PG_HOST                     - name: APP_PG_PORT                       valueFrom:                         configMapKeyRef:                           name: app-config                           key: APP_PG_PORT                     - name: APP_PG_DBNAME                       valueFrom:                         configMapKeyRef:                           name: app-config                           key: APP_PG_DBNAME                   image: app-api # image: romapres2010\/app-api:2.0.0                   imagePullPolicy: IfNotPresent                   readinessProbe:                     httpGet:                       path: \/app\/system\/health                       port: 8080                       scheme: HTTP                     initialDelaySeconds: 30  # Time to start                     failureThreshold: 5                     periodSeconds: 10                     timeoutSeconds: 5                   livenessProbe:                     httpGet:                       path: \/app\/system\/health                       port: 8080                       scheme: HTTP                     failureThreshold: 5                     periodSeconds: 10                     timeoutSeconds: 5                   ports:                     - containerPort: 8080                   resources:                     requests:                       cpu: 500m                       memory: 256Mi                     limits:                       cpu: 2000m                       memory: 2000Mi             hostname: app-api-host             restartPolicy: Always<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043e\u0441\u0442\u0443\u043f \u043a Go Api \u043d\u0443\u0436\u0435\u043d \u0432\u043d\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u043f\u0440\u0438\u0447\u0435\u043c \u0442\u0430\u043a \u043a\u0430\u043a Pod \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e, \u0442\u043e \u043d\u0443\u0436\u0435\u043d LoadBalancer \u2014 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/kubernates\/base\/app-api-service.yaml\" rel=\"nofollow noopener noreferrer\">\/deploy\/kubernates\/base\/app-api-service.yaml<\/a>.<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043f\u043e\u0440\u0442 3000 \u043d\u0430 IP \u0430\u0434\u0440\u0435\u0441 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430<\/li>\n<li>\u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b Service \u0431\u044b\u043b \u0441\u043c\u0430\u043f\u043b\u0435\u043d \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u043c \u0447\u0435\u0440\u0435\u0437 Deployment Pod Go APi (\u043f\u0440\u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438\u0445 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e), \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c Service.spec.selector.tier: app-api \u0438 Deployment.spec.template.metadata.labels.tier: app-api<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"plaintext\">apiVersion: v1 kind: Service metadata:     name: app-api     labels:         tier: app-api     namespace: go-app spec:     type: LoadBalancer     ports:         - port: 3000           targetPort: 8080     selector:         tier: app-api<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"9-kustomization-yaml-dlya-kubernetes\">9. Kustomization YAML \u0434\u043b\u044f Kubernetes<\/h2>\n<p>  <\/p>\n<p>Kubernetes \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u0435 ENV \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u2014 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043d\u0443\u0436\u043d\u043e \u043c\u0435\u043d\u044f\u0442\u044c YAML \u0438 \u0437\u0430\u043d\u043e\u0432\u043e &#171;\u043d\u0430\u043a\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e&#187;.<\/p>\n<p>  <\/p>\n<p>\u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u043d\u043e\u0441\u0438\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 YAML \u0444\u0430\u0439\u043b\u044b \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u0440\u0435\u0434 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f DEV-TEST-PROD \u2014 \u044d\u0442\u043e <a href=\"https:\/\/kustomize.io\/\" rel=\"nofollow noopener noreferrer\">Kustomize<\/a>.<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f &#171;\u0431\u0430\u0437\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f&#187; (\u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0443 \u0441\u0440\u0435\u0434) YAML \u0434\u043b\u044f Kubernetes \u2014 \u043e\u043d\u0430 \u0432\u044b\u043b\u043e\u0436\u0435\u043d\u0430 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/tree\/master\/deploy\/kubernates\/base\" rel=\"nofollow noopener noreferrer\">\/deploy\/kubernates\/base<\/a><\/li>\n<li>\u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u0441\u0440\u0435\u0434 (\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f) \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 YAML, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u044b \u043f\u043e\u0432\u0435\u0440\u0445 &#171;\u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438&#187;. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/github.com\/romapres2010\/goapp\/tree\/master\/deploy\/kubernates\/overlays\/dev\" rel=\"nofollow noopener noreferrer\">\/deploy\/kubernates\/overlays\/dev<\/a>. <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0421\u043e\u0441\u0442\u0430\u0432 YAML &#171;\u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438&#187; \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0432 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/kubernates\/base\/kustomization.yaml\" rel=\"nofollow noopener noreferrer\">\/deploy\/kubernates\/base\/kustomization.yaml<\/a>. <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">commonLabels:   app: app   variant: base resources: - app-namespase.yaml - app-net-networkpolicy.yaml - app-configmap.yaml - app-secret.yaml - app-db-persistentvolumeclaim.yaml - app-db-deployment.yaml - app-db-service.yaml - app-api-deployment.yaml - app-api-service.yaml - app-liquibase-pod.yaml<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0441\u0442\u0430\u0432 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u043b\u044f \u0441\u0440\u0435\u0434\u044b DEV \u043a &#171;\u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438&#187; \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0432 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/kubernates\/overlays\/dev\/kustomization.yaml\" rel=\"nofollow noopener noreferrer\">\/deploy\/kubernates\/overlays\/dev\/kustomization.yaml<\/a>.<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0432 \u0438\u043c\u0435\u043d\u0430 \u0432\u0441\u0435\u0445 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u043e\u0432 Kubernetes \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u0435\u0444\u0438\u043a\u0441 namePrefix: dev- <\/li>\n<li>\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u043d\u043e\u0432\u0430\u044f \u043c\u0435\u0442\u043a\u0430, \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0432\u0441\u0435\u0445 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u043e\u0432 \u0441\u0440\u0435\u0434\u044b \u2014 commonLabels.variant: dev<\/li>\n<li>\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 Docker \u043e\u0431\u0440\u0430\u0437\u043e\u0432 \u0434\u043b\u044f app-api \u0438 app-liquibase<\/li>\n<li>\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u043f\u0430\u0442\u0447\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0432\u0435\u0440\u0445 &#171;\u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438&#187;<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"plaintext\">namePrefix: dev- commonLabels:   variant: dev commonAnnotations:   note: This is development resources: - ..\/..\/base images: - name: app-api   newName: romapres2010\/app-api   newTag: 2.0.0 - name: app-liquibase   newName: romapres2010\/app-liquibase   newTag: 2.0.0 patches: - app-configmap.yaml - app-secret.yaml - app-api-deployment.yaml<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"patchi-poverh-bazovoy-versii\">\u041f\u0430\u0442\u0447\u0438 \u043f\u043e\u0432\u0435\u0440\u0445 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438<\/h3>\n<p>  <\/p>\n<p>\u0412\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435 \u0434\u043b\u044f \u0441\u0440\u0435\u0434: IP, \u043f\u043e\u0440\u0442\u044b, \u0438\u043c\u0435\u043d\u0430 \u0441\u0445\u0435\u043c \u0411\u0414, \u043f\u0430\u0440\u043e\u043b\u0438, \u0440\u0435\u0441\u0443\u0440\u0441\u044b, \u043b\u0438\u043c\u0438\u0442\u044b.<\/p>\n<p>  <\/p>\n<p>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 Secret<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">apiVersion: v1 kind: Secret metadata:   name: app-secret   labels:     app: app   namespace: go-app type: Opaque stringData:   APP_PG_USER: postgres   APP_PG_PASS: postgres<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 ConfigMap<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">apiVersion: v1 kind: ConfigMap metadata:   name: app-config   labels:     app: app   namespace: go-app data:   APP_CONFIG_FILE: \/app\/defcfg\/app.global.yaml   APP_HTTP_PORT: \"8080\"   APP_HTTP_LISTEN_SPEC: 0.0.0.0:8080   APP_LOG_LEVEL: ERROR   APP_LOG_FILE: \/app\/log\/app.log   APP_PG_HOST: dev-app-db   APP_PG_PORT: \"5432\"   APP_PG_DBNAME: postgres   APP_PG_CHANGELOG: db.changelog-1.0_recreate_testdatamdg.xml   <\/code><\/pre>\n<p>  <\/p>\n<p>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 Deployment Go Api \u2014 \u0437\u0430\u0434\u0430\u043d\u044b \u0434\u0440\u0443\u0433\u0438\u0435 \u043b\u0438\u043c\u0438\u0442\u044b, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u043f\u043b\u0438\u043a \u0438 \u0432\u0440\u0435\u043c\u044f &#171;\u0447\u0438\u0441\u0442\u043e\u0439&#187; \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">apiVersion: apps\/v1 kind: Deployment metadata:     name: app-api     labels:         tier: app-api     namespace: go-app spec:     replicas: 2     template:         spec:             terminationGracePeriodSeconds: 60             containers:                 - name: app-api                   resources:                       limits:                           cpu: 4000m                           memory: 4000Mi             restartPolicy: Always<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"10-testirovanie-kubernetes-s-kustomize\">10. \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 Kubernetes \u0441 kustomize<\/h2>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/tree\/master\/deploy\/kubernates\" rel=\"nofollow noopener noreferrer\">\/deploy\/kubernates<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0434 Windows \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c Docker Desktop \u0438 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0432 \u043d\u0435\u043c \u043e\u043f\u0446\u0438\u044e Enable Kubernetes.<\/p>\n<p>  <\/p>\n<p><em>\u0441\u043a\u0440\u0438\u043f\u0442\u044b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0446\u0435\u043b\u0435\u0439<\/em><\/p>\n<p>  <\/p>\n<h3 id=\"sborka-docker-obrazov\">\u0421\u0431\u043e\u0440\u043a\u0430 Docker \u043e\u0431\u0440\u0430\u0437\u043e\u0432<\/h3>\n<p>  <\/p>\n<p>\u0412 \u0444\u0430\u0439\u043b\u0435 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/default_repository\" rel=\"nofollow noopener noreferrer\">\/deploy\/default_repository<\/a> \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043c\u0435\u043d\u0438\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443 \u043d\u0430 \u0441\u0432\u043e\u0439 Docker \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439. \u0411\u0435\u0437 \u044d\u0442\u043e\u0433\u043e \u0442\u043e\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u043d\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c docker push. <\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u0431\u0440\u0430\u0442\u044c Docker \u043e\u0431\u0440\u0430\u0437\u044b:<\/p>\n<p>  <\/p>\n<ul>\n<li>Go App <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/docker\/app-api-build.sh\" rel=\"nofollow noopener noreferrer\">\/deploy\/docker\/app-api-build.sh<\/a><\/li>\n<li>Liquibase <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/docker\/app-liquibase-build.sh\" rel=\"nofollow noopener noreferrer\">\/deploy\/docker\/app-liquibase-build.sh<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c docker push \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u0441\u043b\u0435 \u0441\u0431\u043e\u0440\u043a\u0438 Docker \u043e\u0431\u0440\u0430\u0437\u044b \u043a\u0435\u0448\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435. <\/p>\n<p>  <\/p>\n<h3 id=\"razvertyvanie-artefaktov-kubernetes\">\u0420\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u043e\u0432 Kubernetes<\/h3>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/kubernates\/kube-build.sh\" rel=\"nofollow noopener noreferrer\">\/deploy\/kubernates\/kube-build.sh<\/a> \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0435\u043c\u0443 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0441\u0440\u0435\u0434\u0443 dev, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">.\/kube-build.sh dev<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043b\u043e\u0433\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/tree\/master\/deploy\/kubernates\/log\" rel=\"nofollow noopener noreferrer\">\/deploy\/kubernates\/log<\/a><\/p>\n<p>  <\/p>\n<ul>\n<li>\u043f\u0435\u0440\u0432\u044b\u043c \u0448\u0430\u0433\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f kubectl kustomize \u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 YAML \u0434\u043b\u044f \u0441\u0440\u0435\u0434\u044b DEV <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/kubernates\/log\/build-dev-kustomize.yaml\" rel=\"nofollow noopener noreferrer\">\/kubernates\/log\/build-dev-kustomize.yaml<\/a> \u2014 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b\u0430\u0441\u044c dev \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f<\/li>\n<li>\u0432\u0442\u043e\u0440\u044b\u043c \u0448\u0430\u0433\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f kubectl apply \u2014 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432.<\/li>\n<li>\u0441\u0442\u0430\u0440\u0442\u0443\u044e\u0442 \u0441\u0440\u0430\u0437\u0443 \u0432\u0441\u0435 Pod, \u043d\u043e dev-app-api \u0438 dev-app-liquibase \u0443\u0445\u043e\u0434\u0438\u0442 \u0432 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 initContainers \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0440\u0442\u0430 5432 postgres \u0432 Pod c \u0411\u0414<\/li>\n<li>\u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430 120 \u0441\u0435\u043a. \u0438 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u043b\u043e\u0433\u0438 \u0432\u0441\u0435\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432<\/li>\n<\/ul>\n<p>  <\/p>\n<h3 id=\"kratkiy-status-artefaktov-kubernetes\">\u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u0441\u0442\u0430\u0442\u0443\u0441 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u043e\u0432 Kubernetes<\/h3>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/kubernates\/kube-descibe.sh\" rel=\"nofollow noopener noreferrer\">\/master\/deploy\/kubernates\/kube-descibe.sh<\/a>, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u0440\u0430\u0442\u043a\u0438\u0439 \u0441\u0442\u0430\u0442\u0443\u0441 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u043e\u0432 Kubernetes.<\/p>\n<p>  <\/p>\n<ul>\n<li>Pod Liquibase \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0438 \u0442\u0435\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f. \u0415\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0438 \u043d\u0435 \u0447\u0435\u0440\u0435\u0437 Deployment, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443 \u043d\u0435\u0433\u043e &#171;\u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u043c\u044f&#187; <em>dev-app-liquibase<\/em>. <\/li>\n<li>\u0417\u0430\u043f\u0443\u0449\u0435\u043d\u044b \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0434\u0432\u0430 Pod Go Api, \u043e\u043d\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0438\u0441\u044c \u0447\u0435\u0440\u0435\u0437 Deployment, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u043c\u0435\u043d\u0430 \u0438\u043c\u0435\u044e\u0442 &#171;\u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0439&#187; \u043f\u0440\u0435\u0444\u0438\u043a\u0441 \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c.<\/li>\n<li>\u0417\u0430\u043f\u0443\u0449\u0435\u043d \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0434\u0432\u0430 Pod \u0411\u0414.<\/li>\n<li>\u0421\u0435\u0440\u0432\u0438\u0441 dev-app-api \u0438\u043c\u0435\u0435\u0442 \u0442\u0438\u043f LoadBalancer<br \/> \n<ul>\n<li>\u043e\u043d \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432\u043d\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u043d\u0430 3000 \u043f\u043e\u0440\u0442\u0443 \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c <a href=\"http:\/\/127.0.0.1:3000\/metrics\" rel=\"nofollow noopener noreferrer\">\/metrics<\/a>.<\/li>\n<li>\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 LoadBalancer \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0443 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/Round-robin_(%D0%B0%D0%BB%D0%B3%D0%BE%D1%80%D0%B8%D1%82%D0%BC)\" rel=\"nofollow noopener noreferrer\">round robin<\/a>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0435\u0437 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0435\u0441\u0441\u0438\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0435 Pod \u043f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0438.<\/li>\n<li>\u0435\u0441\u043b\u0438 \u043a\u043b\u0438\u0435\u043d\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442 HTTP keep-alive, \u0442\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0431\u0443\u0434\u0443\u0442 \u0438\u0434\u0442\u0438 \u043d\u0430 \u0442\u043e\u0442 \u0436\u0435 Pod (\u044d\u0442\u043e \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 Horizontal Autoscaler) <\/li>\n<\/ul>\n<\/li>\n<li>\u0421\u0435\u0440\u0432\u0438\u0441 dev-app-db \u0438\u043c\u0435\u0435\u0442 \u0442\u0438\u043f NodePort \u0438 \u0443\u043a\u0430\u0437\u0430\u043d \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0439 \u0435\u043c\u0443 \u043f\u043e\u0440\u0442 30906<br \/> \n<ul>\n<li>\u0447\u0442\u043e \u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0443\u0442 \u043a \u0411\u0414 \u0432\u043d\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u043d\u0443\u0436\u043d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u043a\u0430\u043a\u043e\u043c \u0443\u0437\u043b\u0435 (Node) \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u043f\u043e\u0434\u043d\u044f\u0442 \u044d\u0442\u043e\u0442 Pod \u0438 \u043f\u043e IP \u0430\u0434\u0440\u0435\u0441\u0443 \u0443\u0437\u043b\u0430 \u0438 \u043f\u043e\u0440\u0442\u0443 30906 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0411\u0414<\/li>\n<\/ul>\n<\/li>\n<li>\u041c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 Pod \u043c\u043e\u0433\u0443\u0442 \u043a\u043e\u043c\u043c\u0443\u043d\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043a\u0440\u0430\u0442\u043a\u043e\u0435 DNS \u0438\u043c\u044f service.<br \/> \n<ul>\n<li>Liquibase \u0438 Go Api \u043c\u043e\u0433\u0443\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0411\u0414 \u0447\u0435\u0440\u0435\u0437 host name = service: dev-app-db<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"plaintext\">$ .\/kube-get.sh dev go-app  Kube namespace: go-app Kube variant: dev  kubectl get pods NAME                           READY   STATUS      RESTARTS   AGE   IP           NODE             NOMINATED NODE   READINESS GATES dev-app-api-59b6ff97b4-2kmfm   1\/1     Running     0          13m   10.1.1.182   docker-desktop   &lt;none>           &lt;none> dev-app-api-59b6ff97b4-plmz6   1\/1     Running     0          13m   10.1.1.183   docker-desktop   &lt;none>           &lt;none> dev-app-db-58bbb867d8-c96bz    1\/1     Running     0          13m   10.1.1.184   docker-desktop   &lt;none>           &lt;none> dev-app-liquibase              0\/1     Completed   0          13m   10.1.1.185   docker-desktop   &lt;none>           &lt;none>  kubectl get deployment NAME          READY   UP-TO-DATE   AVAILABLE   AGE   CONTAINERS   IMAGES                       SELECTOR dev-app-api   2\/2     2            2           13m   app-api      romapres2010\/app-api:2.0.0   app=app,tier=app-api,variant=dev dev-app-db    1\/1     1            1           13m   app-db       postgres:14.5-alpine         app=app,tier=app-db,variant=dev  kubectl get service NAME          TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE   SELECTOR dev-app-api   LoadBalancer   10.106.114.183   localhost     3000:30894\/TCP   13m   app=app,tier=app-api,variant=dev dev-app-db    NodePort       10.111.201.17    &lt;none>        5432:30906\/TCP   13m   app=app,tier=app-db,variant=dev  kubectl get configmap NAME             DATA   AGE dev-app-config   9      13m  kubectl get secret NAME             TYPE     DATA   AGE dev-app-secret   Opaque   2      13m  kubectl get pvc NAME               STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE   VOLUMEMODE dev-app-db-claim   Bound    pvc-996244d5-c5fd-4496-abfd-b6d9301549af   100Mi      RWO            hostpath       13m   Filesystem  kubectl get hpa No resources found in go-app namespace.<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"razvernutyy-status-artefaktov-kubernetes\">\u0420\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044b\u0439 \u0441\u0442\u0430\u0442\u0443\u0441 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u043e\u0432 Kubernetes<\/h3>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044b\u0439 \u0441\u0442\u0430\u0442\u0443\u0441 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u043e\u0432 Kubernetes \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u0441\u043a\u0440\u0438\u043f\u0442 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/kubernates\/kube-descibe.sh\" rel=\"nofollow noopener noreferrer\">\/master\/deploy\/kubernates\/kube-descibe.sh<\/a>.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">$ .\/kube-descibe.sh dev go-app<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432 \u0444\u0430\u0439\u043b\u0435 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/kubernates\/log\/describe-dev-kube.log\" rel=\"nofollow noopener noreferrer\">\/deploy\/kubernates\/log\/describe-dev-kube.log<\/a>.<\/p>\n<p>  <\/p>\n<h3 id=\"proverka-logov-docker-konteynerov\">\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043b\u043e\u0433\u043e\u0432 Docker \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432<\/h3>\n<p>  <\/p>\n<p>\u041b\u043e\u0433\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 Kubernetes \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u0441\u043a\u0440\u0438\u043f\u0442 <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/kubernates\/kube-log.sh\" rel=\"nofollow noopener noreferrer\">\/deploy\/kubernates\/kube-log.sh<\/a>.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">$ .\/kube-log.sh dev go-app<\/code><\/pre>\n<p>  <\/p>\n<p>\u0423 \u043d\u0430\u0441 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043e 2 Pod Go Api \u2014 \u0432 \u044d\u0442\u043e\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u043d\u044b \u0438 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u043e\u0434\u0438\u043d \u0444\u0430\u0439\u043b. <\/p>\n<p>  <\/p>\n<h3 id=\"udalenie-artefaktov-kubernetes\">\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u043e\u0432 Kubernetes<\/h3>\n<p>  <\/p>\n<p>\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c <a href=\"https:\/\/github.com\/romapres2010\/goapp\/blob\/master\/deploy\/kubernates\/kube-delete.sh\" rel=\"nofollow noopener noreferrer\">\/deploy\/kubernates\/kube-delete.sh<\/a>.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">$ .\/kube-deelte.sh dev go-app<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \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:\/\/habr.com\/ru\/post\/716634\/\"> https:\/\/habr.com\/ru\/post\/716634\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h1 id=\"shablon-backend-servera-na-golang--chast-3-docker-docker-compose-kubernetes-kustomizehttpshabrcomrupost716634\"><a href=\"https:\/\/habr.com\/ru\/post\/716634\/\">\u0428\u0430\u0431\u043b\u043e\u043d backend \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430 Golang \u2014 \u0447\u0430\u0441\u0442\u044c 3 (Docker, Docker Compose, Kubernetes (kustomize)<\/a><\/h1>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/post_images\/110\/b29\/b5b\/110b29b5bc2d9df9e250549adb05268d.jpg\" alt=\"\u0421\u0445\u0435\u043c\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0432 Kubernetes\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/110\/b29\/b5b\/110b29b5bc2d9df9e250549adb05268d.jpg\" data-blurred=\"true\"\/><\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/492062\/\">\u041f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/a> \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 HTTP \u0441\u0435\u0440\u0432\u0435\u0440\u0443.<\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/500554\/\">\u0412\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/a> \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e REST API.<\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/716634\/\">\u0422\u0440\u0435\u0442\u044c\u044f \u0447\u0430\u0441\u0442\u044c<\/a> \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044e \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0432 Docker, Docker Compose, Kubernetes (kustomize).<\/p>\n<p>  <\/p>\n<p>\u0427\u0435\u0442\u0432\u0435\u0440\u0442\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044e \u0432 Kubernetes \u0441 Helm chart \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 Horizontal Autoscaler.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0432 Kubernetes, \u0432 \u0448\u0430\u0431\u043b\u043e\u043d \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0432\u043d\u0435\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f: <\/p>\n<p>  <\/p>\n<ul>\n<li>\u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u2014 YAML, ENV, <a href=\"https:\/\/kustomize.io\/\" rel=\"nofollow noopener noreferrer\">Kustomize<\/a><\/li>\n<li>\u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043a \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u2014 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u0430 <a href=\"https:\/\/github.com\/uber-go\/zap\" rel=\"nofollow noopener noreferrer\">zap<\/a><\/li>\n<li>\u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0441\u0445\u0435\u043c\u044b \u0411\u0414 \u2014 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u0430 <a href=\"https:\/\/www.liquibase.org\/\" rel=\"nofollow noopener noreferrer\">liquibase<\/a><\/li>\n<li>\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a <a href=\"https:\/\/prometheus.io\/\" rel=\"nofollow noopener noreferrer\">prometheus<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043d\u043e\u0432\u044b\u0439 <a href=\"https:\/\/github.com\/romapres2010\/goapp\" rel=\"nofollow noopener noreferrer\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0428\u0430\u0431\u043b\u043e\u043d goapp \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0433\u043e\u0442\u043e\u0432 \u043a \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044e \u0432 Docker, Docker Compose, Kubernetes (kustomize), Kubernetes (helm).<\/p>\n<p>  <\/p>\n<p><em>\u041d\u0430\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439<\/em> <\/p>\n<p>  <\/p>\n<h2 id=\"soderzhanie\">\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<ol>\n<li>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043a \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e<\/li>\n<li>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a <a href=\"https:\/\/prometheus.io\/\" rel=\"nofollow noopener noreferrer\">prometheus<\/a><\/li>\n<li>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043a \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e<\/li>\n<li>\u0420\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0411\u0414<\/li>\n<li>\u0421\u0431\u043e\u0440\u043a\u0430 Docker image<\/li>\n<li>\u0421\u0431\u043e\u0440\u043a\u0430 Docker-Compose <\/li>\n<li>\u0421\u0445\u0435\u043c\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0432 Kubernetes<\/li>\n<li>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 YAML \u0434\u043b\u044f Kubernetes<\/li>\n<li>Kustomization YAML \u0434\u043b\u044f Kubernetes<\/li>\n<li>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 Kubernetes \u0441 kustomize<\/li>\n<\/ol>\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-345526","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/345526","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=345526"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/345526\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=345526"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=345526"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=345526"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}