正如在他们的网站上宣称的那样,在一些代码被推入存储库后,Gitlab可以用于自动部署项目,但我无法弄清楚如何实现。有很多红宝石教程,但没有流星或节点。
基本上,在代码被推入我的主分支之后,我只需要在我的服务器上重新构建一个Docker容器。有人知道如何实现这一目标吗?我对..gitlab ci.yml的东西非常陌生,非常感谢你的帮助。
发布于 2016-05-12 13:34:58
简介:我运行一个Meteor1.3.2应用程序,托管在数字海洋(Ubuntu14.04)上,从4个月开始。我正在使用Gitlab诉8.3.4,运行在与Meteor应用程序相同的数字海洋水滴上。这是一个2GB/2 CPU液滴(每月20美元)。使用内置的Gitlab CI进行CI/CD。到目前为止,此设置已成功运行。(我们目前不使用Docker,但这不重要。)
我们的CI/CD策略:

我们使用Windows上的git工具连接到我们的Gitlab服务器。(用于拉、推等类似的常规git活动)

下图显示了所有以前的构建日志:

请遵循以下步骤:

样本文件:
#upstart service file at /etc/init/meteor-service.conf
description "Meteor.js (NodeJS) application for eaxmple.com:3000"
author "rohanray@gmail.com"
# When to start the service
start on runlevel [2345]
# When to stop the service
stop on shutdown
# Automatically restart process if crashed
respawn
respawn limit 10 5
script
export PORT=3000
# this allows Meteor to figure out correct IP address of visitors
export HTTP_FORWARDED_COUNT=1
export MONGO_URL=mongodb://xxxxxx:xxxxxx@example123123.mongolab.com:59672/meteor-db
export ROOT_URL=http://<droplet_ip>:3000
exec /home/gitlab-runner/.meteor/packages/meteor-tool/1.1.10/mt-os.linux.x86_64/dev_bundle/bin/node /home/gitlab-runner/erecaho-build/server-alpha-running/bundle/main.js >> /home/gitlab-runner/erecaho-build/server-alpha-running/meteor.log
end script备注:在首次签入..gitlab ci.yml后,应用程序将不可用,因为重新启动meteor服务将导致服务找不到。手动运行sudo启动流星服务一次做SSH控制台。将此新签入发布到gitlab主版将触发自动CI/CD,新版本的应用程序将在构建成功完成后在example.com:3000上提供。
P.S.:可以在http://doc.gitlab.com/ee/ci/yaml/README.html找到gitlab文档,以便您进行定制,并了解上面的示例yaml文件。如需码头专用跑步者,请参阅https://gitlab.com/gitlab-org/gitlab-ci-multi-runner
https://stackoverflow.com/questions/36312494
复制相似问题