简体   繁体   English

我可以在没有Docker映像的情况下将带有gitlab ci的php项目部署到远程主机吗?

[英]Can i deploy my php project with gitlab ci to remote host WITHOUT Docker images?

We have PHP project on gitlab. 我们在gitlab上有PHP项目。 I can deploy it using Jenkins + Phping to remote host, but Jenkins run slow often. 我可以使用Jenkins + Phping将其部署到远程主机,但是Jenkins经常运行缓慢。 I see many examples with Gitlab-ci and Docker images, but I don't want to use Docker images. 我看到了许多有关Gitlab-ciDocker映像的示例,但我不想使用Docker映像。 I just want to git clone this project to remote host after some jobs triggers and to make some jobs after this on remote host. 我只想在某些作业触发后将项目克隆到远程主机,然后在远程主机上进行一些作业。 I saw gitlab-ci runners ssh and shell , maybe it makes using one of this runners? 我看到gitlab-ci赛跑者sshshell ,也许它使使用了其中一个赛跑者?

Can i deploy my PHP project with gitlab ci to remote host without Docker images? 我可以将带有gitlab ci的PHP项目部署到没有 Docker映像的远程主机吗? Will be it correct? 正确吗?

I have done it few weeks ago. 几周前我已经完成了。 In that case I was using gitlab-ci with the shell runner, it worked fine for me. 在那种情况下,我将gitlab-cishell运行程序一起使用,对我来说效果很好。 I had some problems with ssh keys, but I fixed it reading a little: 我在使用ssh密钥时遇到了一些问题,但是我将其修复为:

http://www.linuxproblem.org/art_9.html http://www.linuxproblem.org/art_9.html

and

https://apple.stackexchange.com/questions/48502/how-can-i-permanently-add-my-ssh-private-key-to-keychain-so-it-is-automatically https://apple.stackexchange.com/questions/48502/how-can-i-permanently-add-my-ssh-private-key-to-keychain-so-it-is-automatically

So, yes you can deploy it this way and it's fine to do it. 因此,是的,您可以通过这种方式部署它,这样做很好。

I'm adding a .gitlab-ci.yml that I used to deploy a jar application. 我添加了用于部署jar应用程序的.gitlab-ci.yml

image: JAVA:latest 

before_script:
  - /home/leandro/netbeans-8.2/java/maven/bin/mvn clean install

after_script:  

stages:
  - build_deploy_dev
  - build_deploy_production   

build_&_deploy_dev:
  stage: build_deploy_dev
  except:
   - master
  script:
   - cd target
   - scp EnviaEmail-1.0-SNAPSHOT-jar-with-dependencies.jar root@192.168.0.147:/home/leandro/Desktop
   - ssh root@192.168.0.147 "kill $(ps -ef | grep EnviaEmail | grep -v grep | awk '{print $2}') < /dev/null > /home/leandro/Desktop/KillEnviaEmail.log 2>&1 &"
   - ssh root@192.168.0.147 "java -jar /home/leandro/Desktop/EnviaEmail-1.0-SNAPSHOT-jar-with-dependencies.jar -Xmx256m < /dev/null > /home/leandro/Desktop/EnviaEmail.log 2>&1 &"   

Hope it helps 希望能帮助到你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM