Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use gitlab ci to deploy the project to i686 and x86_64 machine at the same time?

I am a Newbie using gitlab-CI and my english is not very good.

I want to use gitlab ci to deploy one project to i686, x86_64 linux machine respectively. So I can generate an update package on different types linux centos.

Now I use gitlab-server(192.168.1.240), gitlab runner (192.168.1.184) production server1(192.168.1.162) production server2(192.168.1.163);

        gitlab-server(240)     -->     runner(184)
                                       ^          ^
                               product_s1(162)    product_s2(163)

/etc/gitlab-runner/config.toml:

concurrent = 1

[[runners]]
  url = "http://192.168.1.240/ci"
  token = "fb8b064e53e31159e268853af6f8ea"
  name = "production162"
  executor = "ssh"
  [runners.ssh]
    user = "root"
    host = "192.168.1.162"
    port = "22"
    identity_file = "/home/user/.ssh/id_rsa"

[[runners]]
  url = "http://192.168.1.240/ci"
  token = "18795ba96cfe74478ee63ff7decedd"
  name = "production163"
  executor = "ssh"
  [runners.ssh]
    user = "root"
    host = "192.168.1.250"
    port = "22"
    identity_file = "/home/user/.ssh/id_rsa"

.gitlab-ci.yml:

job:
script:
    - "make install"
    - "./ci.sh"

Then I add .gitlab-ci.yml to gitlab and execute git push;

Why the project was installed only on production162; I want it to be installed into production162 and production163 respectively.

So I searched and read the gitlab-ci-multi-runner document, it said

If you'd like to deploy to multiple servers using GitLab CI, you can create a single script that deploys to multiple servers or you can create many scripts. It depends on what you'd like to do.

what is the scripts above? .gitlab-ctl.yml?
Can I use one GitLab CI deploy to multiple servers?

like image 934
michael Avatar asked Dec 10 '25 22:12

michael


1 Answers

I solve the problem;
.gitlab-ci.yml:

  162deploy: # 162
    stage: deploy
    tags:
        - deploy162
    script:
        - "make && make install"
    only:
         - master

163deploy: # 163
    stage: deploy
    tags:
        - deploy163
    script:
        - "make && make install"
    only:
         - master
         - tags

set the production162 runner's tag is deploy162, production163 runner's tag is deploy163

like image 65
michael Avatar answered Dec 13 '25 23:12

michael



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!