{"id":297792,"date":"2020-01-28T09:00:21","date_gmt":"2020-01-28T09:00:21","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=297792"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=297792","title":{"rendered":"\u0412\u044b\u043a\u043b\u0430\u0434\u043a\u0430 go pet \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 VPS"},"content":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/485240\/\">\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u042f \u0432\u0435\u0440\u044e, \u0447\u0442\u043e Golang \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u0435\u043d, \u043d\u043e \u0432 \u043c\u0438\u0440\u0435 \u0435\u0449\u0435 \u043c\u043d\u043e\u0433\u043e php \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u043d\u0430 VPS,VDS. \u041c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0442\u0443\u0434\u0430 \u0434\u043e\u043a\u0435\u0440, \u043d\u043e \u044d\u0442\u043e (\u043f\u043e \u043c\u043d\u0435\u043d\u0438\u044e \u0430\u0432\u0442\u043e\u0440\u0430) \u043f\u0435\u0440\u0435\u0443\u0441\u043b\u043e\u0436\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438. \u041c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u0438\u043a \u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u043f\u043e FTP \u2014 \u043d\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e \u0438 \u043d\u0435 \u043f\u043e \u0444\u0435\u043d\u0448\u0443\u044e, SFTP \u2014 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0435\u0435, \u043d\u043e \u0441\u043d\u043e\u0432\u0430 \u043d\u0435 \u0444\u0435\u043d\u0448\u0443\u0439. \u0422\u043e\u0433\u0434\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/circleci.com\/\" rel=\"nofollow\">CircleCI<\/a>. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e \u0448\u0430\u0433\u0430\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f CI, \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u043e\u0431\u0435\u0440\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c deploy.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/cv\/2s\/yw\/cv2sywq6jxqrpflgccoicqbrahc.jpeg\"><\/p>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h3>\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/h3>\n<p>  <\/p>\n<ol>\n<li>\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 <\/li>\n<li>Deploy \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d<\/li>\n<li>\u0412\u0445\u043e\u0434\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u0434\u043b\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 deploy \u2014 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0435\u0433\u0430 \u0434\u043b\u044f dev \u0441\u0431\u043e\u0440\u043a\u0438 \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0440\u0443\u0447\u043d\u043e\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0434\u043b\u044f prod <\/li>\n<li>\u0421\u0431\u043e\u0440\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u0440\u043e\u0439\u0442\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 <\/li>\n<li>\u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0440\u0443\u0447\u043d\u043e\u0439 \u043e\u0442\u043a\u0430\u0442\u043a\u0438 \u0432\u0435\u0440\u0441\u0438\u0438<\/li>\n<\/ol>\n<p>  <\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u0421ircleCI?<\/h3>\n<p>  \u041d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 bitbucket. (\u0421\u0435\u0439\u0447\u0430\u0441 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432 \u0433\u0438\u0442\u0445\u0430\u0431\u0435.) \u041d\u0435 \u0443\u0445\u043e\u0434\u044f \u0438\u0437 \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u044b Atlasian \u0440\u0435\u0448\u0438\u043b\u0438 \u0432\u0437\u044f\u0442\u044c CircleCI (\u0434\u0430\u043b\u0435\u0435 CI). \u041f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e:  <\/p>\n<ul>\n<li>\u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 <\/li>\n<li>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c debug \u043f\u043e ssh<\/li>\n<li>\u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f, \u043d\u043e \u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u043c\u0438<br \/> \n<ul>\n<li> 2500 \u043a\u0440\u0435\u0434\u0438\u0442\u043e\u0432\/\u0432 \u043d\u0435\u0434\u0435\u043b\u044e (\u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 250 \u043c\u0438\u043d\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f) #go \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0438 \u0434\u0435\u043f\u043b\u043e\u0438\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u043e, \u043d\u0430\u043c \u0445\u0432\u0430\u0442\u0438\u0442<\/li>\n<li>\u043e\u0434\u043d\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 #\u0443 \u043d\u0430\u0441 \u043d\u0435 \u0442\u0430\u043a \u043c\u043d\u043e\u0433\u043e pet project<\/li>\n<li>\u0442\u043e\u043b\u044c\u043a\u043e lunix \u0438 windows #\u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d linux<\/li>\n<\/ul>\n<p>  <\/li>\n<\/ul>\n<p>  <\/p>\n<h3>\u0427\u0430\u0441\u0442\u044c \u043f\u0435\u0440\u0432\u0430\u044f, workflow<\/h3>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0430\u043f\u043a\u0443 .circle \u0438 \u0432 \u043d\u0435\u0439 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b config.yml \u0438 \u043e\u043f\u0438\u0448\u0435\u043c \u0442\u0430\u043c \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0439 workflow ( \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447)<\/p>\n<pre><code class=\"plaintext\">    workflows:       version: 2       tagged-build:         jobs:           - test           - dev_deploy:               requires:                 - test           - approve_master_deploy:               type: approval               requires:                 - test                 - dev_deploy           - prod_deploy:               requires:                 - dev_deploy                 - approve_master_deploy <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/sj\/c0\/9r\/sjc09rejzva6l9t5pyho4nxyw3c.jpeg\" alt=\"image\"><\/p>\n<p>  \u041c\u044b \u043e\u043f\u0438\u0441\u0430\u043b\u0438 \u043f\u0430\u0442\u0442\u0435\u0440\u043d, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u043e\u043c\u0438\u0442 \u0431\u0443\u0434\u0435\u0442 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c\u0441\u044f \u0442\u0435\u0441\u0442\u0430\u043c\u0438, \u0434\u0430\u043b\u0435\u0435 \u0432\u044b\u043a\u0430\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 dev, \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u0438 \u0440\u0443\u0447\u043d\u043e\u043c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043d\u0430 \u0431\u043e\u0435\u0432\u043e\u0439 \u0441\u0435\u0440\u0432\u0435\u0440. \u0414\u043b\u044f \u043d\u0430\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043b\u043e\u0441\u043a\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0444\u0438\u043b\u044c\u0442\u0440, \u0447\u0442\u043e \u0431\u044b \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u0442\u0435\u0433\u0443.<\/p>\n<pre><code class=\"plaintext\">- dev_deploy:     requires:       - test     filters:       branches:         ignore: \/.*\/       tags:         only: \/.*\/<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0412\u0442\u043e\u0440\u043e\u0439 \u0448\u0430\u0433, \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439.<\/h3>\n<p>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0442\u0435\u0441\u0442\u043e\u0432, \u0442\u0443\u0442 \u0431\u0443\u0434\u0435\u0442 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043a\u043e\u0434\u0430.<\/p>\n<pre><code class=\"plaintext\">jobs:   test:     docker:       - image: circleci\/golang:1.12     working_directory: ~\/go-example\/     steps:       - checkout       # \u0442\u0443\u0442 \u0431\u0443\u0434\u0443\u0442 linter'\u044b \u0438 \u0442\u0434       - run: go test -cover -v .\/...<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u043d\u0430\u0448 \u043a\u043e\u0434 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0438 \u043f\u0440\u043e\u0448\u0435\u043b code style \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c deploy \u043d\u0430 dev. \u042f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 go \u0441\u0435\u0440\u0432\u0438\u0441\u0430 supervisor (ver3.1.4 \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438), \u043b\u043e\u0433\u0438 \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0438\u043c \u0436\u0435.<br \/>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043f\u0430\u043f\u043a\u0443 .circleci \u0444\u0430\u0439\u043b\u0438\u043a supervisor_ph.conf, \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 CI PH_NAME \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u043d\u0430 \u0438\u043c\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0418 \u0432 \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0444\u0430\u0439\u043b \u0431\u0443\u0434\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u043b\u043e\u0433\u043e\u0432.<\/p>\n<pre><code class=\"plaintext\">[program:PH_NAME] stopasgroup=true user=deploy-user autostart=true autorestart=true stdout_logfile=\/var\/log\/supervisor\/PH_NAME.log stderr_logfile=\/var\/log\/supervisor\/PH_NAME.log redirect_stderr=true<\/code><\/pre>\n<p>  \u0412\u0441\u0451, \u0447\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442 \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 \u043e\u0442 \u0434\u0440\u0443\u0433\u0438\u0445:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/l7\/2f\/mj\/l72fmjecgyvovcovx6xamliiy3o.jpeg\"><\/p>\n<h3>\u0412\u0440\u0435\u043c\u044f Deploy<\/h3>\n<p>  \u0414\u043b\u044f dev \u0438 prod \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438 \u043a \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0443\u0444\u0444\u0438\u043a\u0441. \u041a\u043e\u043d\u0444\u0438\u0433 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f. (<a href=\"https:\/\/12factor.net\/ru\/config\" rel=\"nofollow\">12 \u0444\u0430\u043a\u0442\u043e\u0440\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/a>) \u042d\u0442\u0443 \u0447\u0430\u0441\u0442\u044c \u043c\u044b \u0432\u044b\u043d\u0435\u0441\u0435\u043c \u0432 environment, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u043e\u0434\u0443\u0431\u043b\u0438\u0440\u0443\u0435\u043c. <\/p>\n<pre><code class=\"plaintext\">prod_deploy:   environment:     TARGET_IP: 0.0.0.0     TARGET_DIR: \/var\/www\/deploy-user\/go-example     REMOTE_USER: deploy-user     SERVICE_NAME: go_example_prod   docker:     - image: circleci\/golang:1.12   working_directory: ~\/go-example\/   steps:     - checkout     - add_ssh_keys #\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 ci \u043a\u043b\u044e\u0447\u0438, \u043e \u043d\u0438\u0445 \u043f\u043e\u0437\u0436\u0435     - run: go build -ldflags &quot;-X main.version=$CIRCLE_TAG&quot; -o .\/main .\/src\/main     - run: ssh -o &quot;StrictHostKeyChecking=no&quot; $REMOTE_USER@$TARGET_IP &quot;mkdir $TARGET_DIR\/v$CIRCLE_TAG&quot; #\u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0443 \u043f\u043e \u043d\u043e\u043c\u0435\u0440\u0443 \u0442\u0435\u0433\u0430, \u0433\u0434\u0435 \u0431\u0443\u0434\u0443\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0435 \u0438 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b     - run: scp main $REMOTE_USER@$TARGET_IP:$TARGET_DIR\/v$CIRCLE_TAG\/ #\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u0444\u0430\u0439\u043b \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u043f\u043e \u0442\u0435\u0433\u0443     - run: sed &quot;s\/PH_NAME\/$SERVICE_NAME\/g&quot; .circleci\/supervisor_ph.conf &gt; .circleci\/$SERVICE_NAME.conf     - run: echo command=$TARGET_DIR\/v$CIRCLE_TAG\/main &gt;&gt; .circleci\/$SERVICE_NAME.conf     - run: scp .circleci\/$SERVICE_NAME.conf $REMOTE_USER@$TARGET_IP:$TARGET_DIR\/v$CIRCLE_TAG\/     - run: ssh $REMOTE_USER@$TARGET_IP &quot;ln -sf $TARGET_DIR\/v$CIRCLE_TAG\/$SERVICE_NAME.conf \/etc\/supervisord.d&quot;     - run: ssh $REMOTE_USER@$TARGET_IP &quot;supervisorctl  -c \/etc\/supervisord.conf reread &amp;&amp; supervisorctl -c \/etc\/supervisord.conf update&quot;     - run: curl &quot;$TELEGRAM_SERVICE?msg=$SERVICE_NAME%20v$CIRCLE_TAG%20deployed&amp;channel=go_deploy&quot;<\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 curl. \u041a\u043e\u043c\u0430\u043d\u0434\u0430 `when: on_fail` \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0435\u0441\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a, \u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043e\u0442\u043a\u0430\u0442\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439. \u0425\u043e\u0442\u044f \u0443 \u043d\u0430\u0441 \u044d\u0442\u043e \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u043c \u0431\u043e\u0442, \u043d\u043e \u0432 \u0446\u0435\u043b\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 \u043d\u0435\u0433\u043e \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438: Slack,IRC. \u041f\u043b\u044e\u0441 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u0443\u0445\u043e\u0434\u044f\u0442 \u043d\u0430 email. <br \/>  \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e `$TELEGRAM_SERVICE` \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0447\u0435\u0440\u0435\u0437 \u0440\u0430\u0437\u0434\u0435\u043b BUILD SETTINGS\u2192Environment Variables.<\/p>\n<pre><code class=\"plaintext\">- run:     command: curl &quot;$TELEGRAM_SERVICE?msg=$SERVICE_NAME%20v$CIRCLE_TAG%20failed&amp;channel=go_deploy&quot;     when: on_fail<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0424\u0438\u043d\u0438\u0448\u043d\u0430\u044f \u043f\u0440\u044f\u043c\u0430\u044f<\/h3>\n<p>  \u0414\u0435\u043b\u0430\u0435\u043c push \u0432 github \u0438\u043b\u0438 \u0432 bitbucket. \u041f\u043e\u0441\u043b\u0435 \u0438\u0434\u0435\u043c \u0432 CircleCI \u0432 \u043f\u0443\u043d\u043a\u0442 Add project<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/1n\/z5\/jh\/1nz5jhheeilqigbrbgpc0pasfw0.jpeg\"><\/p>\n<p>  \u0417\u0430\u0442\u0435\u043c \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c Start building. \u0424\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u043c \u0448\u0430\u0433\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f ssh \u043a\u043b\u044e\u0447\u0430 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u043f\u043e\u0434 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/af\/pv\/ds\/afpvdsmm0zsbu1gg6vba8ytxury.png\"><\/p>\n<p>  \u0412\u0441\u0451 \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c deploy, \u0441\u0442\u0430\u0432\u0438\u043c tag \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0440\u0430\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0436\u0438\u0437\u043d\u0438. \u0424\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 .\/.circleci\/config.yml \u2014 <a href=\"https:\/\/gist.github.com\/JackShadow\/352202bfb08e7dd9317434dde5c5d552\" rel=\"nofollow\">\u0442\u0443\u0442<\/a><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/485240\/\"> https:\/\/habr.com\/ru\/post\/485240\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/485240\/\">\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u042f \u0432\u0435\u0440\u044e, \u0447\u0442\u043e Golang \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u0435\u043d, \u043d\u043e \u0432 \u043c\u0438\u0440\u0435 \u0435\u0449\u0435 \u043c\u043d\u043e\u0433\u043e php \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u043d\u0430 VPS,VDS. \u041c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0442\u0443\u0434\u0430 \u0434\u043e\u043a\u0435\u0440, \u043d\u043e \u044d\u0442\u043e (\u043f\u043e \u043c\u043d\u0435\u043d\u0438\u044e \u0430\u0432\u0442\u043e\u0440\u0430) \u043f\u0435\u0440\u0435\u0443\u0441\u043b\u043e\u0436\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438. \u041c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u0438\u043a \u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u043f\u043e FTP \u2014 \u043d\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e \u0438 \u043d\u0435 \u043f\u043e \u0444\u0435\u043d\u0448\u0443\u044e, SFTP \u2014 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0435\u0435, \u043d\u043e \u0441\u043d\u043e\u0432\u0430 \u043d\u0435 \u0444\u0435\u043d\u0448\u0443\u0439. \u0422\u043e\u0433\u0434\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/circleci.com\/\" rel=\"nofollow\">CircleCI<\/a>. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e \u0448\u0430\u0433\u0430\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f CI, \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u043e\u0431\u0435\u0440\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c deploy.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/cv\/2s\/yw\/cv2sywq6jxqrpflgccoicqbrahc.jpeg\"><\/p>\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-297792","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/297792","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=297792"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/297792\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=297792"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=297792"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=297792"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}