{"id":302603,"date":"2020-04-27T15:00:54","date_gmt":"2020-04-27T15:00:54","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=302603"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=302603","title":{"rendered":"\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 CI gitlab.com \u0438 VPS \u0441\u0435\u0440\u0432\u0435\u0440"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/499232\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/aa\/uu\/zl\/aauuzlafmtgtjmfugdc_jteybqc.png\" alt=\"image\"><br \/>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u044f \u0440\u0435\u0448\u0438\u043b \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043e\u043f\u044b\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 <a href=\"https:\/\/gitlab.com\/\" rel=\"nofollow\">gitlab<\/a> CI \u0438 \u0430\u0440\u0435\u043d\u0434\u0443\u0435\u043c\u043e\u0433\u043e VPS.<\/p>\n<h3>\u041f\u0440\u0435\u0434\u043f\u043e\u0441\u044b\u043b\u043a\u0438<\/h3>\n<p>  \u041d\u0430 \u0440\u0430\u0431\u043e\u0442\u0435, \u0443\u0432. DevOps&#8217;\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u043c\u043d\u0435 \u0434\u0435\u043f\u043b\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0432 <b>kubernetes<\/b> (<s>\u0440\u0430\u0431\u043e\u0442\u0430\u044e \u044f Go-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c<\/s>). \u0423 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0439 \u043f\u0435\u0442-\u043f\u0440\u043e\u0435\u043a\u0442 \u2014 \u0438 \u043c\u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438, \u043d\u043e \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0442\u044c \u0443 \u0441\u0435\u0431\u044f gitlab \u0436\u0435\u043b\u0430\u043d\u0438\u044f \u043e\u0441\u043e\u0431\u043e\u0433\u043e \u043d\u0435 \u0431\u044b\u043b\u043e (VPS \u043d\u0435 \u0440\u0435\u0437\u0438\u043d\u043e\u0432\u044b\u0439 \u0432\u0441\u0435 \u0442\u0430\u043a\u0438).<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h3>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h3>\n<p>  <\/p>\n<ul>\n<li>\u0410\u043a\u043a\u0430\u0443\u043d\u0442 <a href=\"https:\/\/gitlab.com\/\" rel=\"nofollow\">https:\/\/gitlab.com\/<\/a><\/li>\n<li>VPS \u0441\u0435\u0440\u0432\u0435\u0440 \u0441 Ubuntu 18.04<\/li>\n<\/ul>\n<p>  <\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f<\/h3>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u043e\u0442\u0438\u043c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>  \u042f \u0440\u0435\u0448\u0438\u043b \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432, \u043f\u043e\u0434\u043d\u044f\u0442\u044c docker \u0441 nginx \u0438 \u043f\u0440\u043e\u0431\u0440\u043e\u0441\u043e\u043c \u043d\u0430 html \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443.<\/p>\n<p>  \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f:<\/p>\n<ul>\n<li>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">Dockerfile<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"bash\">FROM nginx:latest COPY html \/var\/www\/html COPY nginx.conf \/etc\/nginx\/nginx.conf<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/li>\n<li>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">nginx.conf<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"nginx\">events {} http { server {     listen 80;     location \/ {             root \/var\/www\/html;     } } }<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/li>\n<li>html\n<ul>\n<li>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">index.html<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"xml\">&lt;html&gt; &lt;h1&gt;Hello, Runner!&lt;\/h1&gt; &lt;\/html&gt;<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<\/li>\n<\/ul>\n<p>  <\/li>\n<li>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">.gitlab-ci.yml<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"bash\"> image: docker:19.03.8  before_script:   - docker info  build:   stage: build   script:     - docker build -t hellorunner .  deploy:   stage: deploy   script:     - docker ps --filter name=hellorunner --quiet |  xargs --no-run-if-empty docker stop | xargs --no-run-if-empty  docker rm     - docker run -d --restart=always --name hellorunner -p 8090:80 hellorunner            after_script:     - docker system prune -f <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<\/li>\n<\/ul>\n<p>  <\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f<\/h3>\n<p>  \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c settings -&gt; CI<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/_i\/ej\/hi\/_iejhidikhbhm3w_l0e4xsemnis.png\" alt=\"image\"><\/p>\n<p>  \u0417\u0430\u0442\u0435\u043c \u0443 \u043f\u0443\u043d\u043a\u0442\u0430 Runners \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c expand<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/fv\/kw\/w3\/fvkww3iajiidazkrkbx9ttuepmi.png\" alt=\"image\"><\/p>\n<p>  \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 runners \u2014 <b>Disable shared runners<\/b><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/es\/nv\/v0\/esnvv0ll1b8lnn_wifdu3ft1dxe.png\" alt=\"image\"><\/p>\n<p>  \u0417\u0430\u0442\u0435\u043c, \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u2014 \u00abSet up a specific Runner manually\u00bb<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ow\/ih\/nk\/owihnkg9wo42ypjy5ogq1xuucao.png\" alt=\"image\"><\/p>\n<p>  \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0442\u043e\u043a\u0435\u043d, \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u043e\u043d \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f.<\/p>\n<h3>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 VPS<\/h3>\n<p>  \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c <a href=\"https:\/\/docs.docker.com\/engine\/install\/ubuntu\/\" rel=\"nofollow\">docker<\/a>.<\/p>\n<p>  \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c <a href=\"https:\/\/docs.gitlab.com\/runner\/install\/\" rel=\"nofollow\">gitlab-runner<\/a>.<\/p>\n<p>  \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u043d\u043e\u0432\u044b\u0439 runner.<\/p>\n<p>  <b>! \u0412 \u043f\u043e\u043b\u0435 executor \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c docker \u0432\u0435\u0440\u0441\u0438\u0438, \u043a\u0430\u043a \u0438 \u0432 Dockerfile!<br \/>  \u0412 \u043f\u043e\u043b\u0435 token \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0442\u043e\u043a\u0435\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u043b\u0438 \u0438\u0437 gitlab<br \/>  <\/b><\/p>\n<pre><code class=\"bash\">gitlab-runner register<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/rp\/w6\/s9\/rpw6s99n9ch00_cqnozvzq-pz6k.png\" alt=\"image\"><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043d\u0443\u0436\u043d\u043e \u0432\u043d\u0435\u0441\u0442\u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043f\u0440\u0430\u0432\u043a\u0438 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433 runner&#8217;\u0430.<\/p>\n<pre><code class=\"bash\">nano \/etc\/gitlab-runner\/config.toml<\/code><\/pre>\n<p>  \u043f\u043e\u043b\u0435<\/p>\n<pre><code class=\"bash\">volumes = [&quot;\/cache&quot;] <\/code><\/pre>\n<p>  \u043c\u0435\u043d\u044f\u0435\u043c \u043d\u0430 <\/p>\n<pre><code class=\"bash\">volumes = [&quot;\/var\/run\/docker.sock:\/var\/run\/docker.sock&quot;, &quot;\/cache&quot;] <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/rm\/3_\/i7\/rm3_i7l5m6dwjg_v6xqru-y-inu.png\" alt=\"image\"><\/p>\n<p>  \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0440\u0435\u0441\u0442\u0430\u0440\u0442 \u0434\u0435\u043c\u043e\u043d\u0430<\/p>\n<pre><code class=\"bash\">gitlab-runner restart<\/code><\/pre>\n<p>  \u0421\u043d\u043e\u0432\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a gitlab\/settings\/CI\/Runners.<\/p>\n<p>  \u0414\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 runner<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/6g\/i8\/ww\/6gi8wwr_sdbtcq_edygq5hw5f9a.png\" alt=\"image\"><\/p>\n<p>  \u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c runner, \u043d\u0430\u0436\u0430\u0442\u0438\u0435\u043c<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kj\/kr\/du\/kjkrdufo0g6mm1gk1fwcktwtxze.png\" alt=\"image\"><\/p>\n<p>  \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438 \u0431\u0435\u0437 \u0442\u044d\u0433\u043e\u0432<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/rq\/68\/m1\/rq68m1eftkxyx06vjdsn0ccepxg.png\" alt=\"image\"><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c push \u043a\u043e\u043c\u043c\u0438\u0442\u0430 \u0438 \u0441\u043b\u0435\u0434\u0438\u043c \u0437\u0430 job&#8217;\u0430\u043c\u0438<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xq\/8k\/bg\/xq8kbgsqhy4cm9jdyzealk_e4xc.png\" alt=\"image\"><\/p>\n<p>  \u0418 \u043d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0431\u0440\u0430\u0443\u0437\u0435\u0440<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/lr\/rr\/it\/lrrritvtbqwunyntcunti9cd-ag.png\" alt=\"image\"><\/p>\n<p>  <a href=\"https:\/\/gitlab.com\/Danile71\/hellorunner\" rel=\"nofollow\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439<\/a><\/p>\n<p>  P.S.: \u042f \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u2014 \u0443 \u043c\u0435\u043d\u044f \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0437 \u0438\u0437\u043d\u0443\u0442\u0440\u0438 \u043d\u0435 \u0438\u043c\u0435\u043b \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0441\u0435\u0442\u0438, \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u2014 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b<b>\/etc\/docker\/daemon.json<\/b>:<\/p>\n<pre><code class=\"plaintext\">{     &quot;dns&quot;: [&quot;8.8.4.4&quot;, &quot;8.8.8.8&quot;] } <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"bash\"> service docker restart <\/code><\/pre>\n<\/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\/499232\/\"> https:\/\/habr.com\/ru\/post\/499232\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/499232\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/aa\/uu\/zl\/aauuzlafmtgtjmfugdc_jteybqc.png\" alt=\"image\"><br \/>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u044f \u0440\u0435\u0448\u0438\u043b \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043e\u043f\u044b\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 <a href=\"https:\/\/gitlab.com\/\" rel=\"nofollow\">gitlab<\/a> CI \u0438 \u0430\u0440\u0435\u043d\u0434\u0443\u0435\u043c\u043e\u0433\u043e VPS.<\/p>\n<h3>\u041f\u0440\u0435\u0434\u043f\u043e\u0441\u044b\u043b\u043a\u0438<\/h3>\n<p>  \u041d\u0430 \u0440\u0430\u0431\u043e\u0442\u0435, \u0443\u0432. DevOps&#8217;\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u043c\u043d\u0435 \u0434\u0435\u043f\u043b\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0432 <b>kubernetes<\/b> (<s>\u0440\u0430\u0431\u043e\u0442\u0430\u044e \u044f Go-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c<\/s>). \u0423 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0439 \u043f\u0435\u0442-\u043f\u0440\u043e\u0435\u043a\u0442 \u2014 \u0438 \u043c\u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438, \u043d\u043e \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0442\u044c \u0443 \u0441\u0435\u0431\u044f gitlab \u0436\u0435\u043b\u0430\u043d\u0438\u044f \u043e\u0441\u043e\u0431\u043e\u0433\u043e \u043d\u0435 \u0431\u044b\u043b\u043e (VPS \u043d\u0435 \u0440\u0435\u0437\u0438\u043d\u043e\u0432\u044b\u0439 \u0432\u0441\u0435 \u0442\u0430\u043a\u0438).  <\/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-302603","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/302603","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=302603"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/302603\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=302603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=302603"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=302603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}