如何使用Jhipster,Docker,Gitlab和Heroku进行构建,测试和部署 [英] How to build, test and deploy using Jhipster, Docker, Gitlab and Heroku

查看:137
本文介绍了如何使用Jhipster,Docker,Gitlab和Heroku进行构建,测试和部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 Jhipster 和Docker还是很陌生,希望对理解如何构建基础知识有所帮助并在Heroku实例上部署我的应用程序。当我和朋友一起工作时,我们可能需要某种集成平台,例如Gitlab,它也可以用作我们的代码版本控制和存储库。

I am very new to Jhipster and Docker and I would like some help understanding the basics of how to build and deploy my application on my Heroku instance. As I am working with a friend, we will probably need some sort of integration platform such as Gitlab that will also work as our code versioning and repository.

到目前为止已完成:


  1. 生成了一个整体应用程序并在本地对其进行了测试(工作正常,感谢Jhipster使其变得如此简单)。

  2. 将其推送到gitlab存储库中。

  3. 在应用程序的根目录下创建一个Docker文件夹并启动 docker compose 内部。

  1. Generated a monolithic application and tested it locally (works fine, thanks Jhipster for making it so easy).
  2. Pushed it on our gitlab repository.
  3. Created a Docker folder at the root of our application and launched docker compose inside.

我们认为下一步应该做什么:

What we think we should be doing next:

但我仍然有一些疑问:


  • 我们应该放弃构建任务吗g将docker镜像复制到gitlab吗?

  • 我听到了很多关于Docker Hub和Docker Cloud的信息,但我仍然不明白我的意思,对吗?

  • 我不确定如何充分利用heroku。这方面有什么建议吗?

因此,总而言之,我想从我的应用程序创建一个Docker映像,进行构建并将其发送到我的服务器。我考虑过使用Docker,Gitlab和Heroku,但是我很热衷于任何其他建议,这些建议可以帮助我们有一个快速,健壮和高效的开发周期。

So to summarize, I would like to create a Docker image from my application, build it and send it to my server. I think about using Docker, Gitlab and Heroku but I am keen to any other proposition that would help us having a fast, robust and efficient development cycle.

谢谢,

推荐答案

这里有不同的解决方法...至少重要的是,发布管道是由CI触发的,而不是手动触发的。

Here are different ways to go...at least it matters that your release pipeline is triggered by CI, and not manually.

首先,是的,GitLab应该负责构建图像。它们可以存储在 GitLab容器注册表(最新版本中GitLab版本)或 heroku容器注册。两者都是私人docker注册表!无论您选择哪一个,都将获得如何登录该注册表以进行推送的指南。

At first, yes, GitLab should be responsible for building images. These can be either stored inside the GitLab Container registry (which is avaible in the latest GitLab versions) or the heroku container registy. Both are private docker registries! No matter which one you choose, you will get a guide how to login to that registry to push to that.

我在工作中使用的是GitLab注册表。我将GitLab CI Runner配置为使用映像 xetys / java-8-docker运行。请注意,运行程序必须运行才能在其中运行docker。使用此命令启动跑步者

I am using the GitLab registry at my work. I configure GitLab CI Runner to run using image "xetys/java-8-docker". Note, that the runner must run in order to be able to run docker inside. Start the runner using this command

docker run -d --name gitlab-runner --restart always \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /srv/gitlab-runner/config:/etc/gitlab-runner \
  gitlab/gitlab-runner:latest

然后您可以在 before_script中将heroku安装在gitlab CI中部分,以定义 heroku deploy任务和 docker push任务。

Then you can install heroku inside gitlab CI in before_script section in order to define a "heroku deploy" task, and a "docker push" task.

最后,您可以在以下情况下使用 on_success以使您的部署阶段与最近阶段的成功无关,以便根据您的映像触发部署。

Finally, you can use "when: on_success" to make your deploy stage dependent from success of recent stages in order to trigger a deploy based on your images.

还有一种方法可以使您的CI挂接到heroku,以建立可视部署管道,由heroku维护。我从没做过,所以我无法对此提供任何有意义的建议。

There is also a way of making your CI hooking to heroku, to make a visiual deploy pipeline, maintained by heroku. I never did that, so I can't give any meaningful advice on this.

希望我能以某种方式提供帮助。

Hope I could help in some way.

这篇关于如何使用Jhipster,Docker,Gitlab和Heroku进行构建,测试和部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆