简体   繁体   English

在 Heroku 上部署 Gitlab Spring Boot 项目

[英]Deploy Gitlab Spring Boot project on Heroku

I have Spring Boot project.我有 Spring Boot 项目。 After I created Heroku acc and new app.在我创建 Heroku acc 和新应用程序之后。 I changed my Postresql properties in application.properties, but the problem is deploying.我在 application.properties 中更改了我的 Postresql 属性,但问题在于部署。 If I am not mistaken, I cannot link gitlab with heroku, but can link with github.如果我没记错的话,我不能将gitlab与heroku链接,但可以与github链接。 So, I'd like to know if I need to move my project on github or there are some ways to solve it.所以,我想知道我是否需要将我的项目移动到 github 上,或者有一些方法可以解决它。 Thanks!谢谢!

No, you don't need to move your code to GitHub.不,您不需要将代码移动到 GitHub。 There are several ways to deploy to Heroku , only one of which is dependent on GitHub.几种方法可以部署到 Heroku ,其中只有一种依赖于 GitHub。

One common method would be to simply push your code to Heroku .一种常见的方法是简单地将您的代码推送到 Heroku Assuming you already have the Heroku CLI installed:假设您已经安装了 Heroku CLI:

  1. Add a new remote called heroku that points to Heroku's Git repository for your app . 添加一个名为heroku的新远程,它指向您的应用程序的 Heroku 的 Git 存储库 The easiest way to do that is to run最简单的方法是运行

    heroku git:remote -a example-app

    from your project directory.从您的项目目录中。 If you inspect your remotes you should see a new one called heroku .如果您检查您的遥控器,您应该会看到一个名为heroku的新遥控器。

  2. Then git push to the new heroku remote . 然后git push到新的heroku remote In the common scenario where you want to deploy your local main or master branch, it's as simple as running在您想要部署本地main分支或master分支的常见场景中,它就像运行一样简单

    git push heroku main # or "master"

    If you are deploying from another branch you'll still have to push to main or master on Heroku .如果您从另一个分支进行部署, 您仍然需要推送到 Heroku 上的mainmaster Only those two branch names trigger a build.只有这两个分支名称会触发构建。

I engourage you to read through all of the links I have provided above.我鼓励您阅读我在上面提供的所有链接。 Heroku's documentation for this stuff is quite good. Heroku 的这些东西的文档非常好。

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

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