<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Paul 🦌 Think Build Sleep 🔁</title>
    <description>The latest articles on DEV Community by Paul 🦌 Think Build Sleep 🔁 (@paulgreywood).</description>
    <link>https://dev.to/paulgreywood</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F936138%2Fb892267a-49ce-4af3-a323-2d5e91ba2271.jpg</url>
      <title>DEV Community: Paul 🦌 Think Build Sleep 🔁</title>
      <link>https://dev.to/paulgreywood</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/paulgreywood"/>
    <language>en</language>
    <item>
      <title>Life after Heroku's free plans</title>
      <dc:creator>Paul 🦌 Think Build Sleep 🔁</dc:creator>
      <pubDate>Sun, 02 Oct 2022 18:39:37 +0000</pubDate>
      <link>https://dev.to/paulgreywood/life-after-herokus-free-plans-oga</link>
      <guid>https://dev.to/paulgreywood/life-after-herokus-free-plans-oga</guid>
      <description>&lt;p&gt;How to continue shipping small Spring Boot REST API and other POC without going into the big AWS, GCP or Azur things ?&lt;/p&gt;

&lt;p&gt;Before that Saturday morning, I never heard about &lt;a href="https://render.com"&gt;Render&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Searching for a replacement to Heroku after the free plans policy update, I found out on Twitter than Railway App was promising a very easy way to deploy.&lt;/p&gt;

&lt;p&gt;I wanted to give it a try. &lt;br&gt;
No Spring Boot template proposed.&lt;br&gt;
No quickstart, in other words.&lt;br&gt;
Docker.&lt;/p&gt;

&lt;p&gt;I'll think about it.&lt;/p&gt;

&lt;p&gt;I came across another thread talking about Render.&lt;br&gt;
Same kind of promise.&lt;br&gt;
No Spring Boot either.&lt;br&gt;
Docker again.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qjZN184v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bbffuszjocphfng9aj2s.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qjZN184v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bbffuszjocphfng9aj2s.jpeg" alt="Image description" width="880" height="477"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ok, so let's go for Docker !&lt;/p&gt;

&lt;p&gt;Easy, boy.&lt;/p&gt;

&lt;p&gt;You don't even have Docker installed on that machine.&lt;/p&gt;

&lt;p&gt;Ok, so first step, go to &lt;a href="https://docs.docker.com/desktop/install/mac-install/"&gt;https://docs.docker.com/desktop/install/mac-install/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 Download, double click, wait a bit…&lt;br&gt;
You're all setup for Docker.&lt;/p&gt;

&lt;p&gt;Then, create a Dockerfile. Hum… Ok.&lt;br&gt;
Remembering the Twitter thread talking about Docker for Render, with the community forum thread.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#
# Build stage
#
FROM maven:3.6.2-jdk-11-slim AS build
COPY src /home/app/src
COPY pom.xml /home/app
RUN mvn -f /home/app/pom.xml clean -DskipTests package

#
# Package stage
#
FROM openjdk:11-jre-slim
COPY --from=build /home/app/target/vod-0.0.1.jar /usr/local/lib/vod.jar
EXPOSE 8080
ENTRYPOINT ["java","-Dspring.profiles.active=staging", "-jar","/usr/local/lib/vod.jar"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I updated it to match my need, and saved it as Dockerfile.&lt;/p&gt;

&lt;p&gt;Then, the docker-compose file.&lt;br&gt;
It looks like this for me, currently:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;version: "3.8"

services:
  app:
    build: ./
    restart: on-failure
    env_file: ./.env
    ports:
      - 6868:8080
    volumes:
      - .m2:/root/.m2
    stdin_open: true
    tty: true

volumes:
  db:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pretty straightforward, but it will be tweaked later to add all DB stuff dynamically.&lt;/p&gt;

&lt;p&gt;Tested it out locally, using the command&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker-compose up&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;in the CLI, and it launched Docker, created containers etc and made the API accessible on &lt;a href="http://localhost:6868"&gt;http://localhost:6868&lt;/a&gt; as expected.&lt;/p&gt;

&lt;p&gt;For the sake of the deployment test, I used a simplified application.yml file, without using secrets variables.&lt;/p&gt;

&lt;p&gt;A commit and push later, going back to Render website, and follow these easy steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a new Webservice, right top of the screen.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hgF8VoaE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mh0o8hoy59awaqiy90v1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hgF8VoaE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mh0o8hoy59awaqiy90v1.png" alt="Image description" width="880" height="625"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Fill in the form to connect to the Github repository you want to deploy.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Chose a name for your project, choose a plan, select Docker as environment in the list, choose the branch to deploy&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on advanced, and fill a few fields:&lt;br&gt;
the root directory, for me it was . (dot)&lt;br&gt;
the Dockerfile path input with the correct value, for me it's Dockerfile&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Optionally, I added a health check endpoint value using my endpoint&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;/api/v1/status&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;I also switched off the auto deploy on push, to keep control over the deployments in the begining.&lt;/p&gt;

&lt;p&gt;And voilà ! Click on create webservice button and you're done.&lt;/p&gt;

&lt;p&gt;You're being redirected to the project dashboard and the deployment should be running, as below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iHLnnwVz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nso4zpn8ysah9csolt1c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iHLnnwVz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nso4zpn8ysah9csolt1c.png" alt="Image description" width="880" height="446"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Quick note, so you just don't despair with failing attempts:&lt;br&gt;
It took a small amount of time before the logs were displayed on that console, for me.&lt;br&gt;
As long as the logs weren't showing, the deployment kept failing.&lt;br&gt;
But as soon as it was being routed to the console properly, it's ok.&lt;br&gt;
You can then ping your brand new hosted API and enjoy :)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Thanks to KOO, Audrey and MakLut for their help :)&lt;/p&gt;

&lt;p&gt;Cheers ! ✌️&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
