{"id":452,"date":"2022-02-21T21:13:59","date_gmt":"2022-02-21T21:13:59","guid":{"rendered":"https:\/\/www.kindsonthegenius.com\/spring-boot\/?p=452"},"modified":"2022-02-22T10:11:29","modified_gmt":"2022-02-22T10:11:29","slug":"fleetms-part-8-deploy-springboot-with-postgresql-database-to-heroku","status":"publish","type":"post","link":"https:\/\/kindsonthegenius.com\/spring-boot\/fleetms-part-8-deploy-springboot-with-postgresql-database-to-heroku\/","title":{"rendered":"FleetMS \u2013 Part 8 (Deploy SpringBoot With PostgreSQL Database to Heroku)"},"content":{"rendered":"<p>In this tutorial, you will learn how to deploy Spring Boot application together with it&#8217;s MySQL database to Heroku. Follow the steps provided.<\/p>\n<p>&nbsp;<\/p>\n<h4><strong>Create an App in Heroku<\/strong><\/h4>\n<p><strong>Step 1<\/strong> &#8211; Login in to Heroku (<a href=\"https:\/\/dashboard.heroku.com\/\" target=\"_blank\" rel=\"noopener\">heroku.com<\/a>) and create a new app.<\/p>\n<p><strong>Step 2<\/strong> &#8211; Under the Deployment Method, choose GitHub as shown below:<\/p>\n<figure id=\"attachment_454\" aria-describedby=\"caption-attachment-454\" style=\"width: 906px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-21-at-19.39.56.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-454 size-full\" src=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-21-at-19.39.56.png\" alt=\"Github deployment method in Heroku\" width=\"906\" height=\"246\" srcset=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-21-at-19.39.56.png 906w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-21-at-19.39.56-300x81.png 300w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-21-at-19.39.56-768x209.png 768w\" sizes=\"auto, (max-width: 906px) 100vw, 906px\" \/><\/a><figcaption id=\"caption-attachment-454\" class=\"wp-caption-text\">Github deployment method in Heroku<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p><strong>Step 3<\/strong> &#8211; Under the Resources section, find Heroku Postgres in the Add-ons section<\/p>\n<figure id=\"attachment_455\" aria-describedby=\"caption-attachment-455\" style=\"width: 906px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-21-at-19.43.46.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-455 size-full\" src=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-21-at-19.43.46.png\" alt=\"Heroku Postgres in the Resources tab\" width=\"906\" height=\"412\" srcset=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-21-at-19.43.46.png 906w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-21-at-19.43.46-300x136.png 300w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-21-at-19.43.46-768x349.png 768w\" sizes=\"auto, (max-width: 906px) 100vw, 906px\" \/><\/a><figcaption id=\"caption-attachment-455\" class=\"wp-caption-text\">Heroku Postgres in the Resources tab<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p><strong>Step 4<\/strong> &#8211; The order form is displayed as shown below, and you have to submit it.<\/p>\n<figure id=\"attachment_456\" aria-describedby=\"caption-attachment-456\" style=\"width: 570px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-21-at-19.46.48.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-456 size-full\" src=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-21-at-19.46.48.png\" alt=\"PostgreSQL Order form in Heroku\" width=\"570\" height=\"562\" srcset=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-21-at-19.46.48.png 570w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-21-at-19.46.48-300x296.png 300w\" sizes=\"auto, (max-width: 570px) 100vw, 570px\" \/><\/a><figcaption id=\"caption-attachment-456\" class=\"wp-caption-text\">PostgreSQL Order form in Heroku<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p><strong>Step 5<\/strong> &#8211; In the next page, select the dropdown next to Free and choose Create Dataclip<\/p>\n<div class=\"mceTemp\"><\/div>\n<p><strong>Step 6<\/strong> &#8211; Click on Heroku Postgres. Then click on the Settings tab. Then click on View Credentials to display the PosgreSQL credentials as shown below:<\/p>\n<figure id=\"attachment_460\" aria-describedby=\"caption-attachment-460\" style=\"width: 1024px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-21-at-20.10.07.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-460 size-large\" src=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-21-at-20.10.07-1024x493.png\" alt=\"PostgreSQL Credentials\" width=\"1024\" height=\"493\" srcset=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-21-at-20.10.07-1024x493.png 1024w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-21-at-20.10.07-300x144.png 300w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-21-at-20.10.07-768x370.png 768w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-21-at-20.10.07.png 1221w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption id=\"caption-attachment-460\" class=\"wp-caption-text\">PostgreSQL Credentials<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p><strong>Step 7<\/strong> &#8211; You can now use these details to update your application.properties file<\/p>\n<p><strong>Step 8<\/strong> &#8211; Open your User model (User.java) and add this @Table annotation to the class.<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<pre style=\"margin: 0; line-height: 125%\"><span style=\"color: #555555; font-weight: bold\">@Table<\/span><span style=\"color: #333333\">(<\/span>name <span style=\"color: #333333\">=<\/span> <span style=\"background-color: #fff0f0\">&quot;\\&quot;User\\&quot;&quot;<\/span><span style=\"color: #333333\">)<\/span>\r\n<\/pre>\n<p><strong>Step 9<\/strong> &#8211; Push your changes to Github repository<\/p>\n<p><strong>Step 10<\/strong> &#8211; Finally, go back to Heroku and follow the instruction to connect and deploy to Heroku<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you will learn how to deploy Spring Boot application together with it&#8217;s MySQL database to Heroku. Follow the steps provided. &nbsp; Create &hellip; <!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[2],"tags":[59,17],"class_list":["post-452","post","type-post","status-publish","format-standard","hentry","category-spring-boot-tutorials","tag-heroku","tag-mysql"],"_links":{"self":[{"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/posts\/452","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/comments?post=452"}],"version-history":[{"count":5,"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/posts\/452\/revisions"}],"predecessor-version":[{"id":464,"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/posts\/452\/revisions\/464"}],"wp:attachment":[{"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/media?parent=452"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/categories?post=452"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/tags?post=452"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}