<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>1fdba Archives | Clever Cloud</title>
	<atom:link href="https://www.clever.cloud/blog/tag/1fdba/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.clever.cloud/blog/tag/1fdba/</link>
	<description>From Code to Product</description>
	<lastBuildDate>Fri, 24 Oct 2025 12:50:38 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://cdn.clever-cloud.com/uploads/2023/03/cropped-cropped-favicon-32x32.png</url>
	<title>1fdba Archives | Clever Cloud</title>
	<link>https://www.clever.cloud/blog/tag/1fdba/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>One Framework a Day keeps the Boredom Away: Docker</title>
		<link>https://www.clever.cloud/blog/features/2017/11/10/1fdba-docker/</link>
		
		<dc:creator><![CDATA[Laurent Doguin]]></dc:creator>
		<pubDate>Fri, 10 Nov 2017 17:15:00 +0000</pubDate>
				<category><![CDATA[Features]]></category>
		<category><![CDATA[1fdba]]></category>
		<category><![CDATA[docker]]></category>
		<category><![CDATA[keycloak]]></category>
		<category><![CDATA[postgres]]></category>
		<guid isPermaLink="false">https://www2.cleverapps.io/wp/blog/technology/2017/11/10/1fdba-docker/</guid>

					<description><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-docker-1.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="1fdba docker 1" decoding="async" fetchpriority="high" srcset="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-docker-1.jpg 1400w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-docker-1-300x116.jpg 300w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-docker-1-1024x395.jpg 1024w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-docker-1-768x296.jpg 768w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-docker-1-1368x528.jpg 1368w" sizes="(max-width: 1400px) 100vw, 1400px" /></p><p>Welcome to this new edition of <a href="/blog/features/2017/10/09/1fdba-step0/">One Framework a Day keeps the Boredom Away</a>. In this series I will show you how to deploy a particular framework on Clever Cloud every day until I want to go back to boredom. Today it&#39;s about <a href="https://docker.com/">Docker</a>.</p>
<span id="more-2917"></span>

<p>If you want to tag along, make sure you have git, a Clever Cloud account and that you have installed our CLI <a href="https://github.com/CleverCloud/clever-tools">Clever-Tools</a>.</p>
<h2 id="what-is-docker">What is Docker?</h2>
<blockquote>
Docker is a software technology providing containers, promoted by the company Docker, Inc.
</blockquote>

<p>I am assuming everone know what it is so I won&#39;t go in further explanations. That being said, if you are familiar with Clever Cloud, you may know we have a reputation of not being big fans of Docker. Yet you can deploy Docker containers on Clever Cloud and we were actually one of the first cloud to offer it.</p>
<p>We do like Docker but as a public cloud we have to isolate each containers in a VM for proper isolation. We have to have an absolute position when it comes to security. Anyway, please let us know in the comments if you want us to talk more about our position on Docker and containers. We plan to do a lot more on that side, we just need a bit more time to release it to the public :)</p>
<p>So why talking about Docker today? Well it turns out some of our users asked us if it was possible to deploy <a href="http://keycloak.org/">Keycloak</a> on Clever Cloud. So I looked into it. There are various way to deploy it. The first way I wanted to use was to deploy it as a Wildfly overlay using their <code>.war</code>.</p>
<p>But sadly it&#39;s not recommended in production. You have to use their full wildfly distribution. So I could either download the whole thing each time I start the application, or deploy the Docker container they offer and support in Production. Which is what I have chosen.</p>
<h2 id="setup">Setup</h2>
<p>Keycloak Docker images are all available on Github. And has you need to provide a Dockerfile in your source code for us to build, I copied the official one for the HA/PosgreSQL configuration. I would have gladly forked the repo but it contains all their images. Not very 12 factors compliant sadly :( Anyway my git repository looks like this:</p>
<pre><code class="language-bash">[ldoguin@caolila keycloakClever]$ ls
Dockerfile
</code></pre>
<p>and the Dockerfile like this:</p>
<pre><code class="language-dockerfile">FROM jboss/keycloak-postgres:3.4.0.Final

CMD [&quot;-b&quot;, &quot;0.0.0.0&quot;, &quot;--server-config&quot;, &quot;standalone-ha.xml&quot;]
</code></pre>
<p>We don&#39;t have anything specific to add to this Dockerfile. It&#39;s very well configured and easy to use. We now need to create the Clever Cloud application and its associated database then setup the right environmment variables:</p>
<ul>
<li>Create our application: <code>clever create --type docker --plan M Keycloak</code></li>
<li>Create our Postgres add-on: <code>clever addon create postgresql-addon --plan dev --region eu KeycloakPG</code></li>
<li>Link this website to our FS Bucket addon: <code>clever service link-addon KeycloakPG</code></li>
<li>Setup the following environment variables:</li>
</ul>
<pre><code class="language-bash">clever env set ENABLE_METRICS true
clever env set PROXY_ADDRESS_FORWARDING true
clever env set KEYCLOAK_PASSWORD admin
clever env set KEYCLOAK_USER admin
clever env set JAVA_OPTS &quot;-Djgroups.bind_addr=127.0.0.1&quot;
clever env set POSTGRES_DATABASE `clever env | awk  -F = &#39;/POSTGRESQL_ADDON_DB/ { print $2}&#39;
clever env set POSTGRES_PASSWORD `clever env | awk  -F = &#39;/POSTGRESQL_ADDON_PASSWORD/ { print $2}&#39;
clever env set POSTGRES_PORT_5432_TCP_ADDR `clever env | awk  -F = &#39;/POSTGRESQL_ADDON_HOST/ { print $2}&#39;
clever env set POSTGRES_PORT_5432_TCP_PORT `clever env | awk  -F = &#39;/POSTGRESQL_ADDON_PORT/ { print $2}&#39;
clever env set POSTGRES_USER `clever env | awk  -F = &#39;/POSTGRESQL_ADDON_USER/ { print $2}&#39;
</code></pre>
<p>Before starting the build, we need to configure two options in the Console. Tick the <em>Enable dedicated build instance</em> box because the Keycloak build needs more memory. Also tick the <em>Sticky sessions</em> box because it is necessary if you need to scale horizontally. To do that you have to go on the WebConsole, in your application, in the Information tab and tick the previously mentioned checkboxs.</p>
<img src="https://www2.cleverapps.io/app/uploads/2021/08/DockerConfiguration.png">

<p>You should now be ready to deploy :)</p>
<h2 id="deploy">Deploy</h2>
<p>Deploying with Clever Cloud is the easiest part. Simply run <code>clever deploy</code> and see the logs unfold before your eyes. Go ahead and test it by running <code>clever open</code>. Make sure you are using <em>https</em> while browsing the site. The default login and password are the one you set in the environment variable.</p>
<p>Now everything should work smoothly. What if you need to scale out your application? Let&#39;s say you want to have 2 keycloak instances. This can be configured like this:<code>clever scale --instances 2</code></p>
<p>If you are unsure of the traffic you will get, you can configure a minimum and a maximum of instaces like this: <code>clever scale --min-instances 2 --max-instances 5</code></p>
]]></description>
										<content:encoded><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-docker-1.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="1fdba docker 1" decoding="async" srcset="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-docker-1.jpg 1400w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-docker-1-300x116.jpg 300w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-docker-1-1024x395.jpg 1024w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-docker-1-768x296.jpg 768w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-docker-1-1368x528.jpg 1368w" sizes="(max-width: 1400px) 100vw, 1400px" /></p><p>Welcome to this new edition of <a href="/blog/features/2017/10/09/1fdba-step0/">One Framework a Day keeps the Boredom Away</a>. In this series I will show you how to deploy a particular framework on Clever Cloud every day until I want to go back to boredom. Today it&#39;s about <a href="https://docker.com/">Docker</a>.</p>
<span id="more-2917"></span>

<p>If you want to tag along, make sure you have git, a Clever Cloud account and that you have installed our CLI <a href="https://github.com/CleverCloud/clever-tools">Clever-Tools</a>.</p>
<h2 id="what-is-docker">What is Docker?</h2>
<blockquote>
Docker is a software technology providing containers, promoted by the company Docker, Inc.
</blockquote>

<p>I am assuming everone know what it is so I won&#39;t go in further explanations. That being said, if you are familiar with Clever Cloud, you may know we have a reputation of not being big fans of Docker. Yet you can deploy Docker containers on Clever Cloud and we were actually one of the first cloud to offer it.</p>
<p>We do like Docker but as a public cloud we have to isolate each containers in a VM for proper isolation. We have to have an absolute position when it comes to security. Anyway, please let us know in the comments if you want us to talk more about our position on Docker and containers. We plan to do a lot more on that side, we just need a bit more time to release it to the public :)</p>
<p>So why talking about Docker today? Well it turns out some of our users asked us if it was possible to deploy <a href="http://keycloak.org/">Keycloak</a> on Clever Cloud. So I looked into it. There are various way to deploy it. The first way I wanted to use was to deploy it as a Wildfly overlay using their <code>.war</code>.</p>
<p>But sadly it&#39;s not recommended in production. You have to use their full wildfly distribution. So I could either download the whole thing each time I start the application, or deploy the Docker container they offer and support in Production. Which is what I have chosen.</p>
<h2 id="setup">Setup</h2>
<p>Keycloak Docker images are all available on Github. And has you need to provide a Dockerfile in your source code for us to build, I copied the official one for the HA/PosgreSQL configuration. I would have gladly forked the repo but it contains all their images. Not very 12 factors compliant sadly :( Anyway my git repository looks like this:</p>
<pre><code class="language-bash">[ldoguin@caolila keycloakClever]$ ls
Dockerfile
</code></pre>
<p>and the Dockerfile like this:</p>
<pre><code class="language-dockerfile">FROM jboss/keycloak-postgres:3.4.0.Final

CMD [&quot;-b&quot;, &quot;0.0.0.0&quot;, &quot;--server-config&quot;, &quot;standalone-ha.xml&quot;]
</code></pre>
<p>We don&#39;t have anything specific to add to this Dockerfile. It&#39;s very well configured and easy to use. We now need to create the Clever Cloud application and its associated database then setup the right environmment variables:</p>
<ul>
<li>Create our application: <code>clever create --type docker --plan M Keycloak</code></li>
<li>Create our Postgres add-on: <code>clever addon create postgresql-addon --plan dev --region eu KeycloakPG</code></li>
<li>Link this website to our FS Bucket addon: <code>clever service link-addon KeycloakPG</code></li>
<li>Setup the following environment variables:</li>
</ul>
<pre><code class="language-bash">clever env set ENABLE_METRICS true
clever env set PROXY_ADDRESS_FORWARDING true
clever env set KEYCLOAK_PASSWORD admin
clever env set KEYCLOAK_USER admin
clever env set JAVA_OPTS &quot;-Djgroups.bind_addr=127.0.0.1&quot;
clever env set POSTGRES_DATABASE `clever env | awk  -F = &#39;/POSTGRESQL_ADDON_DB/ { print $2}&#39;
clever env set POSTGRES_PASSWORD `clever env | awk  -F = &#39;/POSTGRESQL_ADDON_PASSWORD/ { print $2}&#39;
clever env set POSTGRES_PORT_5432_TCP_ADDR `clever env | awk  -F = &#39;/POSTGRESQL_ADDON_HOST/ { print $2}&#39;
clever env set POSTGRES_PORT_5432_TCP_PORT `clever env | awk  -F = &#39;/POSTGRESQL_ADDON_PORT/ { print $2}&#39;
clever env set POSTGRES_USER `clever env | awk  -F = &#39;/POSTGRESQL_ADDON_USER/ { print $2}&#39;
</code></pre>
<p>Before starting the build, we need to configure two options in the Console. Tick the <em>Enable dedicated build instance</em> box because the Keycloak build needs more memory. Also tick the <em>Sticky sessions</em> box because it is necessary if you need to scale horizontally. To do that you have to go on the WebConsole, in your application, in the Information tab and tick the previously mentioned checkboxs.</p>
<img src="https://www2.cleverapps.io/app/uploads/2021/08/DockerConfiguration.png">

<p>You should now be ready to deploy :)</p>
<h2 id="deploy">Deploy</h2>
<p>Deploying with Clever Cloud is the easiest part. Simply run <code>clever deploy</code> and see the logs unfold before your eyes. Go ahead and test it by running <code>clever open</code>. Make sure you are using <em>https</em> while browsing the site. The default login and password are the one you set in the environment variable.</p>
<p>Now everything should work smoothly. What if you need to scale out your application? Let&#39;s say you want to have 2 keycloak instances. This can be configured like this:<code>clever scale --instances 2</code></p>
<p>If you are unsure of the traffic you will get, you can configure a minimum and a maximum of instaces like this: <code>clever scale --min-instances 2 --max-instances 5</code></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>One Framework a Day keeps the Boredom Away: Kotlin/Spring5/ReactiveMongoDB</title>
		<link>https://www.clever.cloud/blog/features/2017/11/08/1fdba-kotlin/</link>
		
		<dc:creator><![CDATA[Laurent Doguin]]></dc:creator>
		<pubDate>Wed, 08 Nov 2017 17:15:00 +0000</pubDate>
				<category><![CDATA[Features]]></category>
		<category><![CDATA[1fdba]]></category>
		<category><![CDATA[kotlin]]></category>
		<category><![CDATA[mongo]]></category>
		<category><![CDATA[spring]]></category>
		<guid isPermaLink="false">https://www2.cleverapps.io/wp/blog/technology/2017/11/08/1fdba-kotlin/</guid>

					<description><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-kotlin-1.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="1fdba kotlin 1" decoding="async" srcset="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-kotlin-1.jpg 1400w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-kotlin-1-300x116.jpg 300w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-kotlin-1-1024x395.jpg 1024w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-kotlin-1-768x296.jpg 768w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-kotlin-1-1368x528.jpg 1368w" sizes="(max-width: 1400px) 100vw, 1400px" /></p><p>Welcome to this new edition of <a href="/blog/features/2017/10/09/1fdba-step0/">One Framework a Day keeps the Boredom Away</a>. In this series I will show you how to deploy a particular framework on Clever Cloud every day until I want to go back to boredom. Today it&#39;s about a bunch of interesting technologies: Kotlin, Spring 5 and MongoDB.</p>
<span id="more-2916"></span>

<p>If you want to tag along, make sure you have git, a Clever Cloud account and that you have installed our CLI <a href="https://github.com/CleverCloud/clever-tools">Clever-Tools</a>.</p>
<h2 id="what-is-kotlin-spring-5-and-reactive-mongodb">What is Kotlin, Spring 5 and Reactive MongoDB?</h2>
<p>This time we get to talk about all these things in one post because of a code sample I found. Someone on twitter asked us if Kotlin code could be deployed on Clever Cloud. The answer is yes. You can deploy anything that can be packaged as a Jar or War. So that means Kotlin, but also Ceylon, Clojure, Groovy, Scala and many more. So what is <a href="http://kotlinlang.org/">Kotlin</a>?</p>
<blockquote>
Kotlin is a statically-typed programming language that runs on the Java virtual machine and also can be compiled to JavaScript source code or use the LLVM compiler infrastructure.
</blockquote>

<p>It&#39;s also worth noting that it can target native environment beyond the JVM. So it can be used to write iOS app for instance. <a href="https://blog.kotlin-academy.com/multiplatform-native-development-in-kotlin-now-with-ios-a8546f436eec">This post</a> on multiplatform native developement with Kotlin will give you a better idea of the many things you can do.</p>
<p>Anway I looked for a Kotlin sample online and I found the traditional <a href="https://github.com/ssouris/petclinic-spring5-reactive">Pet Clinic sample</a> written in Kotlin with Spring 5 and Reactive MongoDB. Which is nice because Spring 5 is all about being reactive. And Kotlin is a great fit for that because of its Lambdas support. But we are not going to look at the code, we are going to look at how to deploy this Kotlin/MongoDB project on Clever Cloud.</p>
<h2 id="setup">Setup</h2>
<p>Here are the steps you need to go through to deploy this application:</p>
<ul>
<li>Clone the project: <code>git clone https://github.com/ssouris/petclinic-spring5-reactive</code></li>
<li>Get in the project: <code>cd petclinic-spring5-reactive</code></li>
<li>Create our PostgreMongoDB add-on: <code>clever addon create mongodb-addon --plan peanut petClinicMongo</code></li>
<li>Create our application: <code>clever create --type gradle petClinic</code></li>
<li>Link our MongoDb add-on: <code>clever service link-addon petClinicMongo</code></li>
</ul>
<p>Setup the necessary environment variables for configuration:</p>
<pre><code class="language-bash">clever env set GRADLE_DEPLOY_GOAL bootRun
clever env set SPRING_DATA_MONGODB_URI `clever env | awk  -F = &#39;/MONGODB_ADDON_URI/ { print $2}&#39;`
</code></pre>
<p>Here we start by specifying which Gradle goal to run. This goal compiles and runs the application. Then we configured the MongoDB connection. </p>
<h2 id="deploy">Deploy</h2>
<p>To deploy your application, run <code>clever deploy</code> then <code>clever open</code>. You should see the logs of your application being ran successfuly then have the website open in your default web browser. And as you can see your Kotlin project is up and running and talking to a MongoDB database the reactive way.</p>
]]></description>
										<content:encoded><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-kotlin-1.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="1fdba kotlin 1" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-kotlin-1.jpg 1400w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-kotlin-1-300x116.jpg 300w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-kotlin-1-1024x395.jpg 1024w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-kotlin-1-768x296.jpg 768w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-kotlin-1-1368x528.jpg 1368w" sizes="auto, (max-width: 1400px) 100vw, 1400px" /></p><p>Welcome to this new edition of <a href="/blog/features/2017/10/09/1fdba-step0/">One Framework a Day keeps the Boredom Away</a>. In this series I will show you how to deploy a particular framework on Clever Cloud every day until I want to go back to boredom. Today it&#39;s about a bunch of interesting technologies: Kotlin, Spring 5 and MongoDB.</p>
<span id="more-2916"></span>

<p>If you want to tag along, make sure you have git, a Clever Cloud account and that you have installed our CLI <a href="https://github.com/CleverCloud/clever-tools">Clever-Tools</a>.</p>
<h2 id="what-is-kotlin-spring-5-and-reactive-mongodb">What is Kotlin, Spring 5 and Reactive MongoDB?</h2>
<p>This time we get to talk about all these things in one post because of a code sample I found. Someone on twitter asked us if Kotlin code could be deployed on Clever Cloud. The answer is yes. You can deploy anything that can be packaged as a Jar or War. So that means Kotlin, but also Ceylon, Clojure, Groovy, Scala and many more. So what is <a href="http://kotlinlang.org/">Kotlin</a>?</p>
<blockquote>
Kotlin is a statically-typed programming language that runs on the Java virtual machine and also can be compiled to JavaScript source code or use the LLVM compiler infrastructure.
</blockquote>

<p>It&#39;s also worth noting that it can target native environment beyond the JVM. So it can be used to write iOS app for instance. <a href="https://blog.kotlin-academy.com/multiplatform-native-development-in-kotlin-now-with-ios-a8546f436eec">This post</a> on multiplatform native developement with Kotlin will give you a better idea of the many things you can do.</p>
<p>Anway I looked for a Kotlin sample online and I found the traditional <a href="https://github.com/ssouris/petclinic-spring5-reactive">Pet Clinic sample</a> written in Kotlin with Spring 5 and Reactive MongoDB. Which is nice because Spring 5 is all about being reactive. And Kotlin is a great fit for that because of its Lambdas support. But we are not going to look at the code, we are going to look at how to deploy this Kotlin/MongoDB project on Clever Cloud.</p>
<h2 id="setup">Setup</h2>
<p>Here are the steps you need to go through to deploy this application:</p>
<ul>
<li>Clone the project: <code>git clone https://github.com/ssouris/petclinic-spring5-reactive</code></li>
<li>Get in the project: <code>cd petclinic-spring5-reactive</code></li>
<li>Create our PostgreMongoDB add-on: <code>clever addon create mongodb-addon --plan peanut petClinicMongo</code></li>
<li>Create our application: <code>clever create --type gradle petClinic</code></li>
<li>Link our MongoDb add-on: <code>clever service link-addon petClinicMongo</code></li>
</ul>
<p>Setup the necessary environment variables for configuration:</p>
<pre><code class="language-bash">clever env set GRADLE_DEPLOY_GOAL bootRun
clever env set SPRING_DATA_MONGODB_URI `clever env | awk  -F = &#39;/MONGODB_ADDON_URI/ { print $2}&#39;`
</code></pre>
<p>Here we start by specifying which Gradle goal to run. This goal compiles and runs the application. Then we configured the MongoDB connection. </p>
<h2 id="deploy">Deploy</h2>
<p>To deploy your application, run <code>clever deploy</code> then <code>clever open</code>. You should see the logs of your application being ran successfuly then have the website open in your default web browser. And as you can see your Kotlin project is up and running and talking to a MongoDB database the reactive way.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>One Framework a Day keeps the Boredom Away: Meteor</title>
		<link>https://www.clever.cloud/blog/features/2017/10/20/1fdba-meteor/</link>
		
		<dc:creator><![CDATA[Laurent Doguin]]></dc:creator>
		<pubDate>Fri, 20 Oct 2017 17:15:00 +0000</pubDate>
				<category><![CDATA[Features]]></category>
		<category><![CDATA[1fdba]]></category>
		<category><![CDATA[go]]></category>
		<category><![CDATA[qor]]></category>
		<guid isPermaLink="false">https://www2.cleverapps.io/wp/blog/technology/2017/10/20/1fdba-meteor/</guid>

					<description><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-meteor-1.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="1fdba meteor 1" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-meteor-1.png 1400w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-meteor-1-300x116.png 300w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-meteor-1-1024x395.png 1024w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-meteor-1-768x296.png 768w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-meteor-1-1368x528.png 1368w" sizes="auto, (max-width: 1400px) 100vw, 1400px" /></p><p>Welcome to this new edition of <a href="/blog/features/2017/10/09/1fdba-step0/">One Framework a Day keeps the Boredom Away</a>. In this series I will show you how to deploy a particular framework on Clever Cloud every day until I want to go back to boredom. Today it&#39;s about Meteor.</p>
<span id="more-2914"></span>

<p>In each post of this series we&#39;ll see how to deploy a particular framework on Clever Cloud. Today we are taking a look at <a href="https://www.meteor.com/">Meteor</a>.</p>
<p>If you want to tag along, make sure you have git, a Clever Cloud account and that you have installed our CLI <a href="https://github.com/CleverCloud/clever-tools">Clever-Tools</a>.</p>
<h2 id="what-is-meteor">What is Meteor?</h2>
<blockquote>Meteor is an open source platform for web, mobile, and desktop.</blockquote>

<p>It&#39;s also a JavaScript based, cross device stack that uses MongoDB for persistence. They have a great ecosystem with many modules. Search for Meteor on Github and you will get lots and lots of results. I sorted them out by date and it&#39;s impressive how active that ecosystem is. One of the most stared project is a Trello clone called <a href="https://wekan.github.io/">Wekan</a>. This is what we are going to deploy today.</p>
<h2 id="setup">Setup</h2>
<p>Here are the steps to create and deploy a Wekan application to Clever Cloud:</p>
<ul>
<li>Clone the project: <code>git clone https://github.com/wekan/wekan</code></li>
<li>Get in the project: <code>cd wekan</code></li>
<li>Create the Meteor application: <code>clever create --type meteor wekan</code></li>
<li>Create the MongoDB addon: <code>clever addon create mongodb-addon --plan peanut wekanDB</code></li>
<li>Link the database to the application: <code>clever service link-addon wekanDB</code></li>
<li>Add your domain: <code>clever domain add wekan.cleverapps.io</code></li>
<li>Configure the MongoDB connection: <code>clever env set MONGODB_URI `clever env | awk  -F = &#39;/MONGODB_ADDON_URI/ { print $2}&#39;` </code></li>
<li>Set the root URL of your website: <code>clever env set ROOT_URL https://wekan.cleverapps.io</code></li>
</ul>
<p>By default Clever Cloud uses node 8 to build your project but this won&#39;t work with Wekan, I am using node 6. To do that you need to edit <code>package.json</code> and add the following content:</p>
<pre><code class="language-json">&quot;engines&quot;: {
    &quot;node&quot;: &quot;^6&quot;
}
</code></pre>
<p>With that you are ready for a baisc Wekan configuration. You can also setup an email SMTP server if you have one:</p>
<pre><code class="language-bash">clever env set MAIL_URL smtp://user:pass@mailserver.example.com:25/
clever env set MAIL_FROM wekan-admin@example.com
</code></pre>
<h2 id="deploy">Deploy</h2>
<p>To deploy the application first go on Clever Cloud&#39;s WebConsole, select your application, select the information tab and tick the <em>Enable dedicated build instance</em> checkbox.</p>
<img src="https://www2.cleverapps.io/app/uploads/2021/08/jhipsterconfig.png">

<p>Now run <code>clever deploy</code> and your build should start. Meteor builds can be long, be patient. In 10 minutes you will have your Wekan instance in production :)</p>
<img src="https://www2.cleverapps.io/app/uploads/2021/08/Wekan.png">

<p>If you like Meteor, <a href="https://github.com/VulcanJS/Vulcan">VulcanJS</a> is an interesting project and can be deployed with the exact same process. I invite you to test other Meteor applications and let us know how it worked!</p>
]]></description>
										<content:encoded><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-meteor-1.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="1fdba meteor 1" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-meteor-1.png 1400w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-meteor-1-300x116.png 300w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-meteor-1-1024x395.png 1024w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-meteor-1-768x296.png 768w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-meteor-1-1368x528.png 1368w" sizes="auto, (max-width: 1400px) 100vw, 1400px" /></p><p>Welcome to this new edition of <a href="/blog/features/2017/10/09/1fdba-step0/">One Framework a Day keeps the Boredom Away</a>. In this series I will show you how to deploy a particular framework on Clever Cloud every day until I want to go back to boredom. Today it&#39;s about Meteor.</p>
<span id="more-2914"></span>

<p>In each post of this series we&#39;ll see how to deploy a particular framework on Clever Cloud. Today we are taking a look at <a href="https://www.meteor.com/">Meteor</a>.</p>
<p>If you want to tag along, make sure you have git, a Clever Cloud account and that you have installed our CLI <a href="https://github.com/CleverCloud/clever-tools">Clever-Tools</a>.</p>
<h2 id="what-is-meteor">What is Meteor?</h2>
<blockquote>Meteor is an open source platform for web, mobile, and desktop.</blockquote>

<p>It&#39;s also a JavaScript based, cross device stack that uses MongoDB for persistence. They have a great ecosystem with many modules. Search for Meteor on Github and you will get lots and lots of results. I sorted them out by date and it&#39;s impressive how active that ecosystem is. One of the most stared project is a Trello clone called <a href="https://wekan.github.io/">Wekan</a>. This is what we are going to deploy today.</p>
<h2 id="setup">Setup</h2>
<p>Here are the steps to create and deploy a Wekan application to Clever Cloud:</p>
<ul>
<li>Clone the project: <code>git clone https://github.com/wekan/wekan</code></li>
<li>Get in the project: <code>cd wekan</code></li>
<li>Create the Meteor application: <code>clever create --type meteor wekan</code></li>
<li>Create the MongoDB addon: <code>clever addon create mongodb-addon --plan peanut wekanDB</code></li>
<li>Link the database to the application: <code>clever service link-addon wekanDB</code></li>
<li>Add your domain: <code>clever domain add wekan.cleverapps.io</code></li>
<li>Configure the MongoDB connection: <code>clever env set MONGODB_URI `clever env | awk  -F = &#39;/MONGODB_ADDON_URI/ { print $2}&#39;` </code></li>
<li>Set the root URL of your website: <code>clever env set ROOT_URL https://wekan.cleverapps.io</code></li>
</ul>
<p>By default Clever Cloud uses node 8 to build your project but this won&#39;t work with Wekan, I am using node 6. To do that you need to edit <code>package.json</code> and add the following content:</p>
<pre><code class="language-json">&quot;engines&quot;: {
    &quot;node&quot;: &quot;^6&quot;
}
</code></pre>
<p>With that you are ready for a baisc Wekan configuration. You can also setup an email SMTP server if you have one:</p>
<pre><code class="language-bash">clever env set MAIL_URL smtp://user:pass@mailserver.example.com:25/
clever env set MAIL_FROM wekan-admin@example.com
</code></pre>
<h2 id="deploy">Deploy</h2>
<p>To deploy the application first go on Clever Cloud&#39;s WebConsole, select your application, select the information tab and tick the <em>Enable dedicated build instance</em> checkbox.</p>
<img src="https://www2.cleverapps.io/app/uploads/2021/08/jhipsterconfig.png">

<p>Now run <code>clever deploy</code> and your build should start. Meteor builds can be long, be patient. In 10 minutes you will have your Wekan instance in production :)</p>
<img src="https://www2.cleverapps.io/app/uploads/2021/08/Wekan.png">

<p>If you like Meteor, <a href="https://github.com/VulcanJS/Vulcan">VulcanJS</a> is an interesting project and can be deployed with the exact same process. I invite you to test other Meteor applications and let us know how it worked!</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>One Framework a Day keeps the Boredom Away: JHipster</title>
		<link>https://www.clever.cloud/blog/features/2017/10/19/1fdba-jhipster/</link>
		
		<dc:creator><![CDATA[Laurent Doguin]]></dc:creator>
		<pubDate>Thu, 19 Oct 2017 17:15:00 +0000</pubDate>
				<category><![CDATA[Features]]></category>
		<category><![CDATA[1fdba]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[jhipster]]></category>
		<category><![CDATA[mysql]]></category>
		<guid isPermaLink="false">https://www2.cleverapps.io/wp/blog/technology/2017/10/19/1fdba-jhipster/</guid>

					<description><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-jhipster-1.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="1fdba jhipster 1" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-jhipster-1.png 1400w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-jhipster-1-300x116.png 300w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-jhipster-1-1024x395.png 1024w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-jhipster-1-768x296.png 768w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-jhipster-1-1368x528.png 1368w" sizes="auto, (max-width: 1400px) 100vw, 1400px" /></p><p>Welcome to this new edition of <a href="/blog/features/2017/10/09/1fdba-step0/">One Framework a Day keeps the Boredom Away</a>. In this series I will show you how to deploy a particular framework on Clever Cloud every day until I want to go back to boredom. Today it&#39;s about JHipster.</p>
<span id="more-2913"></span>

<p>In each post of this series we&#39;ll see how to deploy a particular framework on Clever Cloud. Today we are taking a look at <a href="http://www.jhipster.tech/">JHipster</a>.</p>
<p>If you want to tag along, make sure you have git, a Clever Cloud account and that you have installed our CLI <a href="https://github.com/CleverCloud/clever-tools">Clever-Tools</a>.</p>
<h2 id="what-is-jhipster">What is JHipster?</h2>
<blockquote>
JHipster is a development platform to generate, develop and deploy Spring Boot + Angular Web applications and Spring microservices.
</blockquote>

<p>JHipster, not your grandma&#39;s Yeoman generator, has been around for quite some time now and seems to be one of the default solution to scafold a modern SpringBoot+Angular stack. It supports many different options for both frontend and backend. Some of these supported by Clever Cloud.</p>
<p>So today we are going to deploy a JHipster stack based on MySQL. We are doing this mostly because our good friends <a href="https://twitter.com/Stephan007">Stephan Janssen</a> and <a href="https://twitter.com/agoncal">Antonio Goncalves</a> told us they would love to see a JHipster/Clever Cloud integration. Before any convenient integration, I need to know how it works :)</p>
<h2 id="setup">Setup</h2>
<p>Here are the steps to create and deploy a JHipster/MySQL application to Clever Cloud:</p>
<ul>
<li>First make sure you have installed JHipster: <code>yarn global add generator-jhipster</code></li>
<li>Create a folder for your future application: <code>mkdir clever-jhipster &amp;&amp; cd clever-jhipster</code></li>
<li>Run JHipster and follow instructions on screen <code>jhipster</code></li>
<li>Make sure you select MySQL and Maven in the wizard</li>
<li>Create the MySQL database: <code>clever addon create mysql-addon --plan dev --region eu jhipstersql</code></li>
<li>Create the Clever Cloud application: <code>clever create --type maven cleverJHipster</code></li>
<li>Link your database to your application: <code>clever service link-addon jhipstersql</code></li>
<li>Create a clevercloud folder at the root of your project: <code>mkdir clevercloud</code></li>
<li>Create a <em>maven.json</em> file with the following content: <code>vim clevercloud/maven.json</code></li>
</ul>
<pre><code class="language-json">{
  &quot;build&quot;: {
    &quot;type&quot;: &quot;maven&quot;,
    &quot;goal&quot;: &quot;-Pprod package -DskipTests&quot;
  },
  &quot;deploy&quot;: {
    &quot;jarName&quot;: &quot;./target/jhipster-0.0.1-SNAPSHOT.war&quot;
  }
}
</code></pre>
<p>This file tells Clever Cloud to run <code>mvn -Pprod package -DskipTests</code> and then <code>java -jar ./target/my-app-0.0.1-SNAPSHOT.war</code>. Don&#39;t forget to change the jarName according to the name of your project.</p>
<p>Now to configure the application we will create a<code>clevercloud/application-clever.yml</code> file containing all the specific configuration to run on Clever Cloud.</p>
<pre><code class="language-yaml">spring:
    datasource:
        url: jdbc:mysql://${MYSQL_ADDON_HOST}:${MYSQL_ADDON_PORT}/${MYSQL_ADDON_DB}?useUnicode=true&amp;characterEncoding=utf8&amp;useSSL=false
        username: ${MYSQL_ADDON_USER}
        password: ${MYSQL_ADDON_PASSWORD}
        maxActive: 5
</code></pre>
<p>Here I am using variable already predefined by CleverCloud with the <em>${}</em> synthax. To make sure this file is found while running the application, we need to copy it right before running with a hook: <code>clever env set CC_PRE_RUN_HOOK &quot;cp ./clevercloud/application-clever.yml ./application-prod.yml&quot;</code></p>
<h2 id="deploy">Deploy</h2>
<p>Select the build dedicated instance because the JHipster build is memory greedy. To do that you have to go on the WebConsole, in your application, in the Information tab and tick the <em>Enable dedicated build instance</em> checkbox.</p>
<img src="https://www2.cleverapps.io/app/uploads/2021/08/jhipsterconfig.png">

<p>Now commit your changes and run <code>clever deploy</code>, this will push your code to our remote git branch and deploy it. At the end you can type <code>clever open</code> and it should open your website in your default web browser.</p>
<p>We plan to have a better integration to JHipster through a module. What kind of features would you like to have?</p>
]]></description>
										<content:encoded><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-jhipster-1.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="1fdba jhipster 1" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-jhipster-1.png 1400w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-jhipster-1-300x116.png 300w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-jhipster-1-1024x395.png 1024w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-jhipster-1-768x296.png 768w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-jhipster-1-1368x528.png 1368w" sizes="auto, (max-width: 1400px) 100vw, 1400px" /></p><p>Welcome to this new edition of <a href="/blog/features/2017/10/09/1fdba-step0/">One Framework a Day keeps the Boredom Away</a>. In this series I will show you how to deploy a particular framework on Clever Cloud every day until I want to go back to boredom. Today it&#39;s about JHipster.</p>
<span id="more-2913"></span>

<p>In each post of this series we&#39;ll see how to deploy a particular framework on Clever Cloud. Today we are taking a look at <a href="http://www.jhipster.tech/">JHipster</a>.</p>
<p>If you want to tag along, make sure you have git, a Clever Cloud account and that you have installed our CLI <a href="https://github.com/CleverCloud/clever-tools">Clever-Tools</a>.</p>
<h2 id="what-is-jhipster">What is JHipster?</h2>
<blockquote>
JHipster is a development platform to generate, develop and deploy Spring Boot + Angular Web applications and Spring microservices.
</blockquote>

<p>JHipster, not your grandma&#39;s Yeoman generator, has been around for quite some time now and seems to be one of the default solution to scafold a modern SpringBoot+Angular stack. It supports many different options for both frontend and backend. Some of these supported by Clever Cloud.</p>
<p>So today we are going to deploy a JHipster stack based on MySQL. We are doing this mostly because our good friends <a href="https://twitter.com/Stephan007">Stephan Janssen</a> and <a href="https://twitter.com/agoncal">Antonio Goncalves</a> told us they would love to see a JHipster/Clever Cloud integration. Before any convenient integration, I need to know how it works :)</p>
<h2 id="setup">Setup</h2>
<p>Here are the steps to create and deploy a JHipster/MySQL application to Clever Cloud:</p>
<ul>
<li>First make sure you have installed JHipster: <code>yarn global add generator-jhipster</code></li>
<li>Create a folder for your future application: <code>mkdir clever-jhipster &amp;&amp; cd clever-jhipster</code></li>
<li>Run JHipster and follow instructions on screen <code>jhipster</code></li>
<li>Make sure you select MySQL and Maven in the wizard</li>
<li>Create the MySQL database: <code>clever addon create mysql-addon --plan dev --region eu jhipstersql</code></li>
<li>Create the Clever Cloud application: <code>clever create --type maven cleverJHipster</code></li>
<li>Link your database to your application: <code>clever service link-addon jhipstersql</code></li>
<li>Create a clevercloud folder at the root of your project: <code>mkdir clevercloud</code></li>
<li>Create a <em>maven.json</em> file with the following content: <code>vim clevercloud/maven.json</code></li>
</ul>
<pre><code class="language-json">{
  &quot;build&quot;: {
    &quot;type&quot;: &quot;maven&quot;,
    &quot;goal&quot;: &quot;-Pprod package -DskipTests&quot;
  },
  &quot;deploy&quot;: {
    &quot;jarName&quot;: &quot;./target/jhipster-0.0.1-SNAPSHOT.war&quot;
  }
}
</code></pre>
<p>This file tells Clever Cloud to run <code>mvn -Pprod package -DskipTests</code> and then <code>java -jar ./target/my-app-0.0.1-SNAPSHOT.war</code>. Don&#39;t forget to change the jarName according to the name of your project.</p>
<p>Now to configure the application we will create a<code>clevercloud/application-clever.yml</code> file containing all the specific configuration to run on Clever Cloud.</p>
<pre><code class="language-yaml">spring:
    datasource:
        url: jdbc:mysql://${MYSQL_ADDON_HOST}:${MYSQL_ADDON_PORT}/${MYSQL_ADDON_DB}?useUnicode=true&amp;characterEncoding=utf8&amp;useSSL=false
        username: ${MYSQL_ADDON_USER}
        password: ${MYSQL_ADDON_PASSWORD}
        maxActive: 5
</code></pre>
<p>Here I am using variable already predefined by CleverCloud with the <em>${}</em> synthax. To make sure this file is found while running the application, we need to copy it right before running with a hook: <code>clever env set CC_PRE_RUN_HOOK &quot;cp ./clevercloud/application-clever.yml ./application-prod.yml&quot;</code></p>
<h2 id="deploy">Deploy</h2>
<p>Select the build dedicated instance because the JHipster build is memory greedy. To do that you have to go on the WebConsole, in your application, in the Information tab and tick the <em>Enable dedicated build instance</em> checkbox.</p>
<img src="https://www2.cleverapps.io/app/uploads/2021/08/jhipsterconfig.png">

<p>Now commit your changes and run <code>clever deploy</code>, this will push your code to our remote git branch and deploy it. At the end you can type <code>clever open</code> and it should open your website in your default web browser.</p>
<p>We plan to have a better integration to JHipster through a module. What kind of features would you like to have?</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>One Framework a Day keeps the Boredom Away: Laravel</title>
		<link>https://www.clever.cloud/blog/features/2017/10/18/1fdba-laravel-polr/</link>
		
		<dc:creator><![CDATA[Laurent Doguin]]></dc:creator>
		<pubDate>Wed, 18 Oct 2017 17:15:00 +0000</pubDate>
				<category><![CDATA[Features]]></category>
		<category><![CDATA[1fdba]]></category>
		<category><![CDATA[laravel]]></category>
		<category><![CDATA[PHP]]></category>
		<guid isPermaLink="false">https://www2.cleverapps.io/wp/blog/technology/2017/10/18/1fdba-laravel-polr/</guid>

					<description><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-laravel-1.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="1fdba laravel 1" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-laravel-1.png 1400w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-laravel-1-300x116.png 300w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-laravel-1-1024x395.png 1024w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-laravel-1-768x296.png 768w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-laravel-1-1368x528.png 1368w" sizes="auto, (max-width: 1400px) 100vw, 1400px" /></p><p>Welcome to this new edition of <a href="/blog/features/2017/10/09/1fdba-step0/">One Framework a Day keeps the Boredom Away</a>. In this series I will show you how to deploy a particular framework on Clever Cloud every day until I want to go back to boredom. Today it&#39;s about Laravel.</p>
<span id="more-2912"></span>

<p>In each post of this series we&#39;ll see how to deploy a particular framework on Clever Cloud. Today we are taking a look at <a href="https://laravel.com/">Laravel</a>.</p>
<p>If you want to tag along, make sure you have git, a Clever Cloud account and that you have installed our CLI <a href="https://github.com/CleverCloud/clever-tools">Clever-Tools</a>.</p>
<h2 id="what-is-laravel">What is Laravel?</h2>
<blockquote>
Laravel is a free, open-source PHP web framework, created by Taylor Otwell and intended for the development of web applications following the model–view–controller (MVC) architectural pattern.
</blockquote>

<p>To go a bit further the basics, I have deployed this URL shortener application called <a href="https://github.com/cydrobolt/polr">Polr</a>. It&#39;s actualy written with <a href="https://lumen.laravel.com/">Lumen</a>, a Laravel micro-framework.</p>
<h2 id="setup">Setup</h2>
<p>Here are the necessary steps to configure your Polr application:</p>
<ul>
<li>Clone the backend: <code>git clone https://github.com/cydrobolt/polr</code></li>
<li>Get in the project: <code>cd polr</code></li>
<li>Create the PHP application: <code>clever create --type php polr</code></li>
<li>Create the MySQL addon: <code>clever addon create mysql-addon --plan dev polr-mysql</code></li>
<li>Link the database to the application: <code>clever service link-addon polr-mysql</code></li>
<li>Add your domain: <code>clever domain add mypolr.cleverapps.io</code></li>
<li>Copy the default configuration: <code>cp .env.setup .env</code></li>
</ul>
<p>Then you need to setup the default webroot. We don&#39;t support environment variable for this yet, so you will have to create a <code>php.json</code> file under a <code>clevercloud</code> directory:</p>
<p><code>mkdir clevercloud</code> <code>vim clevercloud/php.json</code></p>
<pre><code class="language-json">{
  &quot;deploy&quot;: {
    &quot;webroot&quot;: &quot;/public&quot;
  }
}
</code></pre>
<p>Now commit all your changes, run <code>clever deploy</code> than <code>clever open</code>. You will be taken straight to the setup wizard of Polr. Go through all the steps, yes even the database configuration, because the setup will write ot the DB at the end. It will also overwrite <code>.env</code>. Problem is we use immutable infrastructure so all the changes written on that file will be lost at reboot. And reboot can happen for many reasons. Best way to manage this is to use <code>clever ssh</code> to log on the machine and copy the content of the now changed <code>.env</code> file to your own version of the file.</p>
<p>All the fields in this file can be remove and replaced by environment variables. You can also use pre-existing variables. In my case I have configured the database part like this:</p>
<pre><code class="language-bash">DB_HOST=$MYSQL_ADDON_HOST
DB_PORT=$MYSQL_ADDON_PORT
DB_DATABASE=$MYSQL_ADDON_DB
DB_USERNAME=$MYSQL_ADDON_USER
DB_PASSWORD=$MYSQL_ADDON_PASSWORD
</code></pre>
<p>Feel free to remove any fields you want to setup as an environment variable as they will be picked up automatically too.</p>
<p>The other option you have would have been to know exactly all the configuration variables needed, set them all, than ssh on the machine and use the <code>artisan</code> CLI to seed the database. Which is to me more cumbersome.</p>
<img src="https://www2.cleverapps.io/app/uploads/2021/08/MyPolr.png">

<p>Whatever solution you choose, take a look at their <a href="https://docs.polrproject.org/en/latest/user-guide/installation/">installation guide</a>. This will give you a good idea of all the things that are managed automatically by Clever Cloud :)</p>
]]></description>
										<content:encoded><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-laravel-1.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="1fdba laravel 1" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-laravel-1.png 1400w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-laravel-1-300x116.png 300w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-laravel-1-1024x395.png 1024w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-laravel-1-768x296.png 768w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-laravel-1-1368x528.png 1368w" sizes="auto, (max-width: 1400px) 100vw, 1400px" /></p><p>Welcome to this new edition of <a href="/blog/features/2017/10/09/1fdba-step0/">One Framework a Day keeps the Boredom Away</a>. In this series I will show you how to deploy a particular framework on Clever Cloud every day until I want to go back to boredom. Today it&#39;s about Laravel.</p>
<span id="more-2912"></span>

<p>In each post of this series we&#39;ll see how to deploy a particular framework on Clever Cloud. Today we are taking a look at <a href="https://laravel.com/">Laravel</a>.</p>
<p>If you want to tag along, make sure you have git, a Clever Cloud account and that you have installed our CLI <a href="https://github.com/CleverCloud/clever-tools">Clever-Tools</a>.</p>
<h2 id="what-is-laravel">What is Laravel?</h2>
<blockquote>
Laravel is a free, open-source PHP web framework, created by Taylor Otwell and intended for the development of web applications following the model–view–controller (MVC) architectural pattern.
</blockquote>

<p>To go a bit further the basics, I have deployed this URL shortener application called <a href="https://github.com/cydrobolt/polr">Polr</a>. It&#39;s actualy written with <a href="https://lumen.laravel.com/">Lumen</a>, a Laravel micro-framework.</p>
<h2 id="setup">Setup</h2>
<p>Here are the necessary steps to configure your Polr application:</p>
<ul>
<li>Clone the backend: <code>git clone https://github.com/cydrobolt/polr</code></li>
<li>Get in the project: <code>cd polr</code></li>
<li>Create the PHP application: <code>clever create --type php polr</code></li>
<li>Create the MySQL addon: <code>clever addon create mysql-addon --plan dev polr-mysql</code></li>
<li>Link the database to the application: <code>clever service link-addon polr-mysql</code></li>
<li>Add your domain: <code>clever domain add mypolr.cleverapps.io</code></li>
<li>Copy the default configuration: <code>cp .env.setup .env</code></li>
</ul>
<p>Then you need to setup the default webroot. We don&#39;t support environment variable for this yet, so you will have to create a <code>php.json</code> file under a <code>clevercloud</code> directory:</p>
<p><code>mkdir clevercloud</code> <code>vim clevercloud/php.json</code></p>
<pre><code class="language-json">{
  &quot;deploy&quot;: {
    &quot;webroot&quot;: &quot;/public&quot;
  }
}
</code></pre>
<p>Now commit all your changes, run <code>clever deploy</code> than <code>clever open</code>. You will be taken straight to the setup wizard of Polr. Go through all the steps, yes even the database configuration, because the setup will write ot the DB at the end. It will also overwrite <code>.env</code>. Problem is we use immutable infrastructure so all the changes written on that file will be lost at reboot. And reboot can happen for many reasons. Best way to manage this is to use <code>clever ssh</code> to log on the machine and copy the content of the now changed <code>.env</code> file to your own version of the file.</p>
<p>All the fields in this file can be remove and replaced by environment variables. You can also use pre-existing variables. In my case I have configured the database part like this:</p>
<pre><code class="language-bash">DB_HOST=$MYSQL_ADDON_HOST
DB_PORT=$MYSQL_ADDON_PORT
DB_DATABASE=$MYSQL_ADDON_DB
DB_USERNAME=$MYSQL_ADDON_USER
DB_PASSWORD=$MYSQL_ADDON_PASSWORD
</code></pre>
<p>Feel free to remove any fields you want to setup as an environment variable as they will be picked up automatically too.</p>
<p>The other option you have would have been to know exactly all the configuration variables needed, set them all, than ssh on the machine and use the <code>artisan</code> CLI to seed the database. Which is to me more cumbersome.</p>
<img src="https://www2.cleverapps.io/app/uploads/2021/08/MyPolr.png">

<p>Whatever solution you choose, take a look at their <a href="https://docs.polrproject.org/en/latest/user-guide/installation/">installation guide</a>. This will give you a good idea of all the things that are managed automatically by Clever Cloud :)</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>One Framework a Day keeps the Boredom Away: Vert-X Golo</title>
		<link>https://www.clever.cloud/blog/features/2017/10/17/1fdba-vertx-golo/</link>
		
		<dc:creator><![CDATA[Laurent Doguin]]></dc:creator>
		<pubDate>Tue, 17 Oct 2017 17:15:00 +0000</pubDate>
				<category><![CDATA[Features]]></category>
		<category><![CDATA[1fdba]]></category>
		<category><![CDATA[golo]]></category>
		<category><![CDATA[jvm]]></category>
		<category><![CDATA[vertx]]></category>
		<guid isPermaLink="false">https://www2.cleverapps.io/wp/blog/technology/2017/10/17/1fdba-vertx-golo/</guid>

					<description><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-golo-vertx-1.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="1fdba golo vertx 1" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-golo-vertx-1.png 1400w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-golo-vertx-1-300x116.png 300w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-golo-vertx-1-1024x395.png 1024w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-golo-vertx-1-768x296.png 768w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-golo-vertx-1-1368x528.png 1368w" sizes="auto, (max-width: 1400px) 100vw, 1400px" /></p><p>Welcome to this new edition of <a href="/blog/features/2017/10/09/1fdba-step0/">One Framework a Day keeps the Boredom Away</a>. In this series I will show you how to deploy a particular framework on Clever Cloud every day until I want to go back to boredom. Today it&#39;s about Vert-x and Golo.</p>
<span id="more-2911"></span>

<p>In each post of this series we&#39;ll see how to deploy a particular framework on Clever Cloud. Today we are taking a look at <a href="http://vertx.io/">Vert-x</a> and <a href="http://golo-lang.org/">Golo</a>.</p>
<p>If you want to tag along, make sure you have git, a Clever Cloud account and that you have installed our CLI <a href="https://github.com/CleverCloud/clever-tools">Clever-Tools</a>.</p>
<h2 id="what-is-vert-x">What is Vert-x?</h2>
<p>Eclipse Vert.x is a tool-kit for building reactive applications on the JVM.</p>
<p>And when they write JVM, they mean it. You can use any JVM language. Beyond the polyglot statement, you will find out that it&#39;s also <em>event driven</em> and <em>non blocking</em>. Which means it&#39;s ready to scale and will use your hardware as much as possible. It&#39;s reactive. I invite you to read the <a href="https://www.reactivemanifesto.org/">Reactive Manifesto</a> if you have no idea what it is. Vert-x is unopinionated and as such is a good fit for any kind of application or microservice. Here we will use it to build an API.  </p>
<h2 id="what-is-golo">What is Golo</h2>
<p>A lightweight dynamic language for the JVM.</p>
<p>You can install Golo with a standalone binary available on <a href="http://golo-lang.org/download/">their website</a>. It&#39;s important because today we will also look at how to create a Golo project from scrach instead of using an existing one. All of this is happening thanks to our CSO Philippe Charrière who previously blogged on this subject, check out <a href="https://medium.com/@k33g_org/">his blog</a>!</p>
<h2 id="create-a-golo-project">Create a Golo Project</h2>
<p>In a terminal, type these commands:</p>
<pre><code class="language-bash">golo new vertx.golo.demo --type maven
cd vertx.golo.demo
</code></pre>
<p>The Golo CLI has generated a Golo project:</p>
<pre><code class="language-bash">.
├── pom.xml
├── src
│   └── main
│       └── golo
│           └── main.golo
</code></pre>
<p>To make sure you can compile the project, you have to update the pom.xml file: Change the Golo version by replacing</p>
<pre><code class="language-xml">  &lt;properties&gt;
    &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
    &lt;golo.version&gt;3.2.0-SNAPSHOT&lt;/golo.version&gt;
  &lt;/properties&gt;
</code></pre>
<p>with:</p>
<pre><code class="language-xml">  &lt;properties&gt;
    &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
    &lt;golo.version&gt;3.2.0&lt;/golo.version&gt;
    &lt;vertx.version&gt;3.4.1&lt;/vertx.version&gt;
  &lt;/properties&gt;
</code></pre>
<p>Add some dependencies and the bintray repository:</p>
<pre><code class="language-xml">  &lt;dependencies&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.eclipse.golo&lt;/groupId&gt;
      &lt;artifactId&gt;golo&lt;/artifactId&gt;
      &lt;version&gt;${golo.version}&lt;/version&gt;
    &lt;/dependency&gt;

    &lt;dependency&gt;
      &lt;groupId&gt;com.googlecode.json-simple&lt;/groupId&gt;
      &lt;artifactId&gt;json-simple&lt;/artifactId&gt;
      &lt;version&gt;1.1.1&lt;/version&gt;
    &lt;/dependency&gt;

    &lt;dependency&gt;
      &lt;groupId&gt;io.vertx&lt;/groupId&gt;
      &lt;artifactId&gt;vertx-core&lt;/artifactId&gt;
      &lt;version&gt;${vertx.version}&lt;/version&gt;
    &lt;/dependency&gt;

    &lt;dependency&gt;
      &lt;groupId&gt;io.vertx&lt;/groupId&gt;
      &lt;artifactId&gt;vertx-web&lt;/artifactId&gt;
      &lt;version&gt;${vertx.version}&lt;/version&gt;
    &lt;/dependency&gt;

  &lt;/dependencies&gt;

  &lt;repositories&gt;
    &lt;repository&gt;
      &lt;id&gt;bintray&lt;/id&gt;
      &lt;name&gt;Bintray&lt;/name&gt;
      &lt;url&gt;https://jcenter.bintray.com&lt;/url&gt;
    &lt;/repository&gt;
  &lt;/repositories&gt;

  &lt;pluginRepositories&gt;
    &lt;pluginRepository&gt;
      &lt;id&gt;bintray&lt;/id&gt;
      &lt;name&gt;Bintray&lt;/name&gt;
      &lt;url&gt;https://jcenter.bintray.com&lt;/url&gt;
    &lt;/pluginRepository&gt;
  &lt;/pluginRepositories&gt;
</code></pre>
<p>We are going to write a very simple Vert-x web application with Golo. For that, replace the content of <code>/src/main/golo/main.golo</code> with this:</p>
<pre><code class="language-go">module vertx.golo.demo

import io.vertx.core.Vertx
import io.vertx.core.http.HttpServer
import io.vertx.ext.web.Router
import io.vertx.ext.web.handler

import gololang.JSON

let vertx = Vertx.vertx()

function main = |args| {

  let server = vertx: createHttpServer()
  let router = Router.router(vertx)
  router: route(): handler(BodyHandler.create())

  let port =  Integer.parseInt(System.getenv(): get(&quot;PORT&quot;) orIfNull &quot;8080&quot;)

  router: get(&quot;/&quot;): handler(|context| {
    context: response(): putHeader(&quot;content-type&quot;, &quot;text/html;charset=UTF-8&quot;)
    context: response(): end(&quot;&lt;h1&gt;Hello 🌍&lt;/h1&gt;&quot;, &quot;UTF-8&quot;)
  })

  router: get(&quot;/hi&quot;): handler(|context| {
    context: response(): putHeader(&quot;content-type&quot;, &quot;application/json;charset=UTF-8&quot;)
    context: response(): end(JSON.stringify(DynamicObject(): message(&quot;Hi 😛&quot;)), &quot;UTF-8&quot;)
  })

  server: requestHandler(|httpRequest| -&gt; router: accept(httpRequest)): listen(port)

  println(&quot;listening on &quot; + port)
}
</code></pre>
<p>To test the application:</p>
<ul>
<li>Built it with: <code>mvn package</code></li>
<li>Run it with: <code>mvn exec:java</code></li>
<li>Test your web application by opening <code>http://localhost:8080</code> and <code>http://localhost:8080/hi</code></li>
</ul>
<p>If it works locally then you are ready for the next step. Set it up for Clever Cloud.</p>
<h2 id="setup">Setup</h2>
<p>Clever Cloud can run any JVM code packaged as a <em>.war</em> or <em>.jar</em>. You can either checkout those files directly in your Github repository or have them built with Maven or Gradle. In this case it&#39;s a Maven build that generates a <em>.jar</em> file from some Golo code. So when we create the application we have to select maven as type: <code>clever create --type maven vertx-golo-sample</code></p>
<p>The only configurable thing is the port of the server. It defaults to 8080 in the code. It&#39;s also the case for each application running on Clever Cloud as it is required. So nothing to change here, we are ready to deploy.</p>
<h2 id="deploy">Deploy</h2>
<p>To make our Maven buikd work we need to state which build goal is needed and where is the <em>.jar</em> file to run. To do so create in your project directory a <code>clevercloud</code> directory with a <code>jar.json</code> file containing:</p>
<pre><code class="language-json">{
  &quot;build&quot;: {
    &quot;type&quot;: &quot;maven&quot;,
    &quot;goal&quot;: &quot;package&quot;
  },
  &quot;deploy&quot;: {
    &quot;jarName&quot;: &quot;target/vertx.golo.demo-0.0.1-SNAPSHOT-jar-with-dependencies.jar&quot;
  }
}
</code></pre>
<p>It configures your application to run <code>mvn package</code> then <code>java -jar target/vertx.golo.demo-0.0.1-SNAPSHOT-jar-with-dependencies.jar</code>.</p>
<p>The last step to deploy it is to initiate an empty git repository, add and commit your code, then deploy it:</p>
<pre><code class="language-bash">git init
git add src/ pom.xml clevercloud/
git commit -m &quot;first version&quot;
clever deploy
</code></pre>
<p>What <code>clever deploy</code> does is pushing your code to a remote git branch that was created when you created the application in the setup step. Right now you should start seeing build logs in the console. If everything worked well run <code>clever open</code>. It will take you straight to your web application and display Hello 🌍!</p>
]]></description>
										<content:encoded><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-golo-vertx-1.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="1fdba golo vertx 1" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-golo-vertx-1.png 1400w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-golo-vertx-1-300x116.png 300w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-golo-vertx-1-1024x395.png 1024w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-golo-vertx-1-768x296.png 768w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-golo-vertx-1-1368x528.png 1368w" sizes="auto, (max-width: 1400px) 100vw, 1400px" /></p><p>Welcome to this new edition of <a href="/blog/features/2017/10/09/1fdba-step0/">One Framework a Day keeps the Boredom Away</a>. In this series I will show you how to deploy a particular framework on Clever Cloud every day until I want to go back to boredom. Today it&#39;s about Vert-x and Golo.</p>
<span id="more-2911"></span>

<p>In each post of this series we&#39;ll see how to deploy a particular framework on Clever Cloud. Today we are taking a look at <a href="http://vertx.io/">Vert-x</a> and <a href="http://golo-lang.org/">Golo</a>.</p>
<p>If you want to tag along, make sure you have git, a Clever Cloud account and that you have installed our CLI <a href="https://github.com/CleverCloud/clever-tools">Clever-Tools</a>.</p>
<h2 id="what-is-vert-x">What is Vert-x?</h2>
<p>Eclipse Vert.x is a tool-kit for building reactive applications on the JVM.</p>
<p>And when they write JVM, they mean it. You can use any JVM language. Beyond the polyglot statement, you will find out that it&#39;s also <em>event driven</em> and <em>non blocking</em>. Which means it&#39;s ready to scale and will use your hardware as much as possible. It&#39;s reactive. I invite you to read the <a href="https://www.reactivemanifesto.org/">Reactive Manifesto</a> if you have no idea what it is. Vert-x is unopinionated and as such is a good fit for any kind of application or microservice. Here we will use it to build an API.  </p>
<h2 id="what-is-golo">What is Golo</h2>
<p>A lightweight dynamic language for the JVM.</p>
<p>You can install Golo with a standalone binary available on <a href="http://golo-lang.org/download/">their website</a>. It&#39;s important because today we will also look at how to create a Golo project from scrach instead of using an existing one. All of this is happening thanks to our CSO Philippe Charrière who previously blogged on this subject, check out <a href="https://medium.com/@k33g_org/">his blog</a>!</p>
<h2 id="create-a-golo-project">Create a Golo Project</h2>
<p>In a terminal, type these commands:</p>
<pre><code class="language-bash">golo new vertx.golo.demo --type maven
cd vertx.golo.demo
</code></pre>
<p>The Golo CLI has generated a Golo project:</p>
<pre><code class="language-bash">.
├── pom.xml
├── src
│   └── main
│       └── golo
│           └── main.golo
</code></pre>
<p>To make sure you can compile the project, you have to update the pom.xml file: Change the Golo version by replacing</p>
<pre><code class="language-xml">  &lt;properties&gt;
    &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
    &lt;golo.version&gt;3.2.0-SNAPSHOT&lt;/golo.version&gt;
  &lt;/properties&gt;
</code></pre>
<p>with:</p>
<pre><code class="language-xml">  &lt;properties&gt;
    &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
    &lt;golo.version&gt;3.2.0&lt;/golo.version&gt;
    &lt;vertx.version&gt;3.4.1&lt;/vertx.version&gt;
  &lt;/properties&gt;
</code></pre>
<p>Add some dependencies and the bintray repository:</p>
<pre><code class="language-xml">  &lt;dependencies&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.eclipse.golo&lt;/groupId&gt;
      &lt;artifactId&gt;golo&lt;/artifactId&gt;
      &lt;version&gt;${golo.version}&lt;/version&gt;
    &lt;/dependency&gt;

    &lt;dependency&gt;
      &lt;groupId&gt;com.googlecode.json-simple&lt;/groupId&gt;
      &lt;artifactId&gt;json-simple&lt;/artifactId&gt;
      &lt;version&gt;1.1.1&lt;/version&gt;
    &lt;/dependency&gt;

    &lt;dependency&gt;
      &lt;groupId&gt;io.vertx&lt;/groupId&gt;
      &lt;artifactId&gt;vertx-core&lt;/artifactId&gt;
      &lt;version&gt;${vertx.version}&lt;/version&gt;
    &lt;/dependency&gt;

    &lt;dependency&gt;
      &lt;groupId&gt;io.vertx&lt;/groupId&gt;
      &lt;artifactId&gt;vertx-web&lt;/artifactId&gt;
      &lt;version&gt;${vertx.version}&lt;/version&gt;
    &lt;/dependency&gt;

  &lt;/dependencies&gt;

  &lt;repositories&gt;
    &lt;repository&gt;
      &lt;id&gt;bintray&lt;/id&gt;
      &lt;name&gt;Bintray&lt;/name&gt;
      &lt;url&gt;https://jcenter.bintray.com&lt;/url&gt;
    &lt;/repository&gt;
  &lt;/repositories&gt;

  &lt;pluginRepositories&gt;
    &lt;pluginRepository&gt;
      &lt;id&gt;bintray&lt;/id&gt;
      &lt;name&gt;Bintray&lt;/name&gt;
      &lt;url&gt;https://jcenter.bintray.com&lt;/url&gt;
    &lt;/pluginRepository&gt;
  &lt;/pluginRepositories&gt;
</code></pre>
<p>We are going to write a very simple Vert-x web application with Golo. For that, replace the content of <code>/src/main/golo/main.golo</code> with this:</p>
<pre><code class="language-go">module vertx.golo.demo

import io.vertx.core.Vertx
import io.vertx.core.http.HttpServer
import io.vertx.ext.web.Router
import io.vertx.ext.web.handler

import gololang.JSON

let vertx = Vertx.vertx()

function main = |args| {

  let server = vertx: createHttpServer()
  let router = Router.router(vertx)
  router: route(): handler(BodyHandler.create())

  let port =  Integer.parseInt(System.getenv(): get(&quot;PORT&quot;) orIfNull &quot;8080&quot;)

  router: get(&quot;/&quot;): handler(|context| {
    context: response(): putHeader(&quot;content-type&quot;, &quot;text/html;charset=UTF-8&quot;)
    context: response(): end(&quot;&lt;h1&gt;Hello 🌍&lt;/h1&gt;&quot;, &quot;UTF-8&quot;)
  })

  router: get(&quot;/hi&quot;): handler(|context| {
    context: response(): putHeader(&quot;content-type&quot;, &quot;application/json;charset=UTF-8&quot;)
    context: response(): end(JSON.stringify(DynamicObject(): message(&quot;Hi 😛&quot;)), &quot;UTF-8&quot;)
  })

  server: requestHandler(|httpRequest| -&gt; router: accept(httpRequest)): listen(port)

  println(&quot;listening on &quot; + port)
}
</code></pre>
<p>To test the application:</p>
<ul>
<li>Built it with: <code>mvn package</code></li>
<li>Run it with: <code>mvn exec:java</code></li>
<li>Test your web application by opening <code>http://localhost:8080</code> and <code>http://localhost:8080/hi</code></li>
</ul>
<p>If it works locally then you are ready for the next step. Set it up for Clever Cloud.</p>
<h2 id="setup">Setup</h2>
<p>Clever Cloud can run any JVM code packaged as a <em>.war</em> or <em>.jar</em>. You can either checkout those files directly in your Github repository or have them built with Maven or Gradle. In this case it&#39;s a Maven build that generates a <em>.jar</em> file from some Golo code. So when we create the application we have to select maven as type: <code>clever create --type maven vertx-golo-sample</code></p>
<p>The only configurable thing is the port of the server. It defaults to 8080 in the code. It&#39;s also the case for each application running on Clever Cloud as it is required. So nothing to change here, we are ready to deploy.</p>
<h2 id="deploy">Deploy</h2>
<p>To make our Maven buikd work we need to state which build goal is needed and where is the <em>.jar</em> file to run. To do so create in your project directory a <code>clevercloud</code> directory with a <code>jar.json</code> file containing:</p>
<pre><code class="language-json">{
  &quot;build&quot;: {
    &quot;type&quot;: &quot;maven&quot;,
    &quot;goal&quot;: &quot;package&quot;
  },
  &quot;deploy&quot;: {
    &quot;jarName&quot;: &quot;target/vertx.golo.demo-0.0.1-SNAPSHOT-jar-with-dependencies.jar&quot;
  }
}
</code></pre>
<p>It configures your application to run <code>mvn package</code> then <code>java -jar target/vertx.golo.demo-0.0.1-SNAPSHOT-jar-with-dependencies.jar</code>.</p>
<p>The last step to deploy it is to initiate an empty git repository, add and commit your code, then deploy it:</p>
<pre><code class="language-bash">git init
git add src/ pom.xml clevercloud/
git commit -m &quot;first version&quot;
clever deploy
</code></pre>
<p>What <code>clever deploy</code> does is pushing your code to a remote git branch that was created when you created the application in the setup step. Right now you should start seeing build logs in the console. If everything worked well run <code>clever open</code>. It will take you straight to your web application and display Hello 🌍!</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>One Framework a Day keeps the Boredom Away: Sinatra</title>
		<link>https://www.clever.cloud/blog/features/2017/10/16/1fdba-sinatra/</link>
		
		<dc:creator><![CDATA[Marc-Antoine Perennou]]></dc:creator>
		<pubDate>Mon, 16 Oct 2017 17:15:00 +0000</pubDate>
				<category><![CDATA[Features]]></category>
		<category><![CDATA[1fdba]]></category>
		<category><![CDATA[activerecord]]></category>
		<category><![CDATA[puma]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[sinatra]]></category>
		<guid isPermaLink="false">https://www2.cleverapps.io/wp/blog/technology/2017/10/16/1fdba-sinatra/</guid>

					<description><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-sinatra-1.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="1fdba sinatra 1" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-sinatra-1.png 1400w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-sinatra-1-300x116.png 300w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-sinatra-1-1024x395.png 1024w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-sinatra-1-768x296.png 768w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-sinatra-1-1368x528.png 1368w" sizes="auto, (max-width: 1400px) 100vw, 1400px" /></p><p>Welcome to this new edition of <a href="/blog/features/2017/10/09/1fdba-step0/">One Framework a Day keeps the Boredom Away</a>. In this series I will show you how to deploy a particular framework on Clever Cloud every day until I want to go back to boredom. Today it&#39;s about Sinatra.</p>
<span id="more-2910"></span>

<p>In each post of this series we&#39;ll see how to deploy a particular framework on Clever Cloud. Today we are taking a look at <a href="http://www.sinatrarb.com/">Sinatra</a>.</p>
<p>If you want to tag along, make sure you have git, a Clever Cloud account and that you have installed our CLI <a href="https://github.com/CleverCloud/clever-tools">Clever-Tools</a>.</p>
<h2 id="what-is-sinatra">What is Sinatra?</h2>
<blockquote>
Sinatra is a DSL for quickly creating web applications in Ruby with minimal effort
</blockquote>

<p>It&#39;s been around for 10 years now and has already inspired several other framework since then. Ratpack which was <a href="/blog/features/2017/10/12/ratpack/">showcased last week</a> has been heavily inspired by sinatra for instance.  Our own <a href="https://twitter.com/Keruspe/">Keruspe</a> wanted to play with a couple of Ruby technologies like Puma and Sinatra. And so he built a <a href="https://github.com/CleverCloud/demo-sinatra-puma-activerecord">sample project</a> for it. That&#39;s what we are going to deploy today.</p>
<h2 id="setup">Setup</h2>
<ul>
<li>Start by cloning the sources: <code>git clone https://github.com/CleverCloud/demo-sinatra-puma-activerecord</code></li>
<li>Create the database you want to use, in my case Postgres: <code>clever addon create postgresql-addon --plan dev --region eu sinatraPG</code></li>
<li>Create the Ruby application on Clever Cloud: <code>clever create --type ruby sinatraSample --region par</code></li>
<li>Link the Postgres add-on to the application: <code>clever service link-addon sinatraPG</code></li>
<li>Tell Clever Cloud to deploy the API using puma (the default is uwsgi as of now): <code>clever env set CC_RACKUP_SERVER puma</code></li>
<li>Tell Clever Cloud to run database migrations before launching the API:<code>clever env set CC_PRE_RUN_HOOK &#39;bundle exec rake db:migrate&#39;</code></li>
<li>Add a domain name: <code>clever domain add mySinatraSample.cleverapps.io</code></li>
</ul>
<p>Specify the maximum number of PG connections your application will use (depending on the selected plan) by adding an environment variable like <code>DB_POOL=5</code> if you want to use 5 connections. For production, you should also set:</p>
<pre><code class="language-bash">clever env set RACK_ENV production
clever env set RAILS_ENV production
</code></pre>
<h2 id="deploy">Deploy</h2>
<ul>
<li>Deploy the application with <code>clever deploy</code></li>
</ul>
<p>And you are up and running. This application provides an API to store users. They only have a name field. Users can be created with a POST request and retrieve with a GET request like so:  </p>
<ul>
<li>Create an object with <code>curl --data &quot;regis&quot;  https://mySinatraSample.cleverapps.io</code></li>
<li>Retrieve that object with <code>curl https://mySinatraSample.cleverapps.io/regis</code></li>
</ul>
<p>Everything works out of the box because this application has been written for Clever Cloud. If you take a look at the condfiguration file under <code>./config/database.yml</code> you should see some environment variables being used. They are the one provided by our Postgres add-on. You can get the full list of variables with <code>clever env</code>.</p>
<p>Let us know your thoughts on this in the comments below. We will be back tomorrow for another post :)</p>
]]></description>
										<content:encoded><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-sinatra-1.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="1fdba sinatra 1" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-sinatra-1.png 1400w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-sinatra-1-300x116.png 300w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-sinatra-1-1024x395.png 1024w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-sinatra-1-768x296.png 768w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-sinatra-1-1368x528.png 1368w" sizes="auto, (max-width: 1400px) 100vw, 1400px" /></p><p>Welcome to this new edition of <a href="/blog/features/2017/10/09/1fdba-step0/">One Framework a Day keeps the Boredom Away</a>. In this series I will show you how to deploy a particular framework on Clever Cloud every day until I want to go back to boredom. Today it&#39;s about Sinatra.</p>
<span id="more-2910"></span>

<p>In each post of this series we&#39;ll see how to deploy a particular framework on Clever Cloud. Today we are taking a look at <a href="http://www.sinatrarb.com/">Sinatra</a>.</p>
<p>If you want to tag along, make sure you have git, a Clever Cloud account and that you have installed our CLI <a href="https://github.com/CleverCloud/clever-tools">Clever-Tools</a>.</p>
<h2 id="what-is-sinatra">What is Sinatra?</h2>
<blockquote>
Sinatra is a DSL for quickly creating web applications in Ruby with minimal effort
</blockquote>

<p>It&#39;s been around for 10 years now and has already inspired several other framework since then. Ratpack which was <a href="/blog/features/2017/10/12/ratpack/">showcased last week</a> has been heavily inspired by sinatra for instance.  Our own <a href="https://twitter.com/Keruspe/">Keruspe</a> wanted to play with a couple of Ruby technologies like Puma and Sinatra. And so he built a <a href="https://github.com/CleverCloud/demo-sinatra-puma-activerecord">sample project</a> for it. That&#39;s what we are going to deploy today.</p>
<h2 id="setup">Setup</h2>
<ul>
<li>Start by cloning the sources: <code>git clone https://github.com/CleverCloud/demo-sinatra-puma-activerecord</code></li>
<li>Create the database you want to use, in my case Postgres: <code>clever addon create postgresql-addon --plan dev --region eu sinatraPG</code></li>
<li>Create the Ruby application on Clever Cloud: <code>clever create --type ruby sinatraSample --region par</code></li>
<li>Link the Postgres add-on to the application: <code>clever service link-addon sinatraPG</code></li>
<li>Tell Clever Cloud to deploy the API using puma (the default is uwsgi as of now): <code>clever env set CC_RACKUP_SERVER puma</code></li>
<li>Tell Clever Cloud to run database migrations before launching the API:<code>clever env set CC_PRE_RUN_HOOK &#39;bundle exec rake db:migrate&#39;</code></li>
<li>Add a domain name: <code>clever domain add mySinatraSample.cleverapps.io</code></li>
</ul>
<p>Specify the maximum number of PG connections your application will use (depending on the selected plan) by adding an environment variable like <code>DB_POOL=5</code> if you want to use 5 connections. For production, you should also set:</p>
<pre><code class="language-bash">clever env set RACK_ENV production
clever env set RAILS_ENV production
</code></pre>
<h2 id="deploy">Deploy</h2>
<ul>
<li>Deploy the application with <code>clever deploy</code></li>
</ul>
<p>And you are up and running. This application provides an API to store users. They only have a name field. Users can be created with a POST request and retrieve with a GET request like so:  </p>
<ul>
<li>Create an object with <code>curl --data &quot;regis&quot;  https://mySinatraSample.cleverapps.io</code></li>
<li>Retrieve that object with <code>curl https://mySinatraSample.cleverapps.io/regis</code></li>
</ul>
<p>Everything works out of the box because this application has been written for Clever Cloud. If you take a look at the condfiguration file under <code>./config/database.yml</code> you should see some environment variables being used. They are the one provided by our Postgres add-on. You can get the full list of variables with <code>clever env</code>.</p>
<p>Let us know your thoughts on this in the comments below. We will be back tomorrow for another post :)</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>One Framework a Day keeps the Boredom Away: Express</title>
		<link>https://www.clever.cloud/blog/features/2017/10/13/1fdba-express/</link>
		
		<dc:creator><![CDATA[Laurent Doguin]]></dc:creator>
		<pubDate>Fri, 13 Oct 2017 17:15:00 +0000</pubDate>
				<category><![CDATA[Features]]></category>
		<category><![CDATA[1fdba]]></category>
		<category><![CDATA[express]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[Nodejs]]></category>
		<category><![CDATA[react]]></category>
		<guid isPermaLink="false">https://www2.cleverapps.io/wp/blog/technology/2017/10/13/1fdba-express/</guid>

					<description><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-express-1.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="1fdba express 1" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-express-1.png 1400w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-express-1-300x116.png 300w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-express-1-1024x395.png 1024w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-express-1-768x296.png 768w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-express-1-1368x528.png 1368w" sizes="auto, (max-width: 1400px) 100vw, 1400px" /></p><p>Welcome to this new edition of <a href="/blog/features/2017/10/09/1fdba-step0/">One Framework a Day keeps the Boredom Away</a>. In this series I will show you how to deploy a particular framework on Clever Cloud every day until I want to go back to boredom. Today it&#39;s about Express.</p>
<span id="more-2909"></span>

<p>In each post of this series we&#39;ll see how to deploy a particular framework on Clever Cloud. Today we are taking a look at <a href="https://expressjs.com/">Express</a>.</p>
<p>If you want to tag along, make sure you have git, a Clever Cloud account and that you have installed our CLI <a href="https://github.com/CleverCloud/clever-tools">Clever-Tools</a>.</p>
<h2 id="what-is-express">What is Express?</h2>
<blockquote>Fast, unopinionated, minimalist web framework for Node.js</blockquote>

<p>It&#39;s pretty much the default JavaScript framework for backend stuff. It&#39;s ridiculously simple to use and benefits from a great ecosystem. If you are thinking about a particular module, there&#39;s a good chance someone already wrote it. I found a project called <a href="https://realworld.io/">RealWorld</a>. They use a Medium clone as example application and have implemented it with a variety of backend and frontend frameworks. Today I will use it as an example with their <a href="https://github.com/gothinkster/node-express-realworld-example-app">Express, MondoDB backend</a> and their <a href="https://github.com/gothinkster/react-redux-realworld-example-app">React,Redux frontend</a>.</p>
<h2 id="setup">Setup</h2>
<p>Let&#39;s start by the backend. It&#39;s a Node.js application using MongoDB so I will need a Node.js application and a MongoDB add-on.</p>
<ul>
<li>Clone the backend: <code>git clone https://github.com/gothinkster/node-express-realworld-example-app</code></li>
<li>Get in the project: <code>cd node-express-realworld-example-app</code></li>
<li>Create the Node.js application: <code>clever create --type node realworld-express</code></li>
<li>Create the MongoDB addon: <code>clever addon create mongodb-addon --plan peanut realworld-mongodb</code></li>
<li>Link the database to the application: <code>clever service link-addon realworld-mongodb</code></li>
</ul>
<p>Great thing about this application is that it&#39;s already configurable with environment variable so we just have to set them up:</p>
<ul>
<li>Configure the MongoDB connection: <code>clever env set MONGODB_URI `clever env | awk  -F = &#39;/MONGODB_ADDON_URI/ { print $2}&#39;` </code></li>
<li>Set the production flag: <code>clever env set NODE_ENV production</code></li>
<li>Set the secret used by the app: <code>clever env set SECRET myVerySecretiveSecret</code></li>
<li>Add a domain name: <code>clever domain add realworldMongoExpress.cleverapps.io</code></li>
</ul>
<p>Which make your backend ready to be deployed :)</p>
<p>Moving on to the frontend.</p>
<ul>
<li>Clone the frontend: <code>git clone https://github.com/gothinkster/react-redux-realworld-example-app</code></li>
<li>Get in the project: <code>cd react-redux-realworld-example-app</code></li>
<li>Create the Node.js application: <code>clever create --type node realworld-frontend</code></li>
<li>Set the production flag: <code>clever env set NODE_ENV production</code></li>
</ul>
<p>Sadly this one requires a little tweaking to use environment variable for configuration. I have edited the file <code>src/agent.js</code> like so:</p>
<pre><code class="language-diff">- const API_ROOT = &#39;https://conduit.productionready.io/api&#39;;
+ const API_ROOT =  process.env.API_ROOT || &#39;https://conduit.productionready.io/api&#39;;
</code></pre>
<ul>
<li>Now I can configure the backend with <code>clever env set API_ROOT https://realworldMongoExpress.cleverapps.io/api</code></li>
</ul>
<p>Don&#39;t forget to commit your changes. And now you are ready to deploy :)</p>
<h2 id="deploy">Deploy</h2>
<p>Since it&#39;s a NodeJS application, the rule for deployment is simple. There has to be a <code>main</code> or <code>scripts.start</code> field in <code>package.json</code>. For the backend is ready so all you have to do is run <code>clever deploy</code>. That&#39;s it.</p>
<p>For the frontend we have a <code>scripts.start</code> but the <em>PORT</em> variable is hardcoded. So I simply removed it and commited my change:</p>
<pre><code class="language-diff">- &quot;start&quot;: &quot;cross-env PORT=4100 react-scripts start&quot;,
+ &quot;start&quot;: &quot;cross-env react-scripts start&quot;,
</code></pre>
<p>Now it&#39;s ready for deployment. Again running <code>clever deploy</code> is all you need. Run <code>clever open</code> and your Medium clone will open in your default browser.</p>
<p>Is that it? Yes if you are not expecting too much traffic. But maybe you are indeed expecting traffic. Or maybe you don&#39;t know. Both situation are fine because Clever Cloud provides automatic scaling. Let&#39;s say you want to have 2 VM for the backend. This can be configured like this:<code>clever scale --instances 2</code></p>
<p>If you are not sure about the frontend, you can setup a minimum of 2 and a maximum of 5 like this: <code>clever scale --min-instances 2 --max-instances 5</code></p>
<p>That&#39;s it. You have deployed a MongoDB/Express backend and a React/Redux frontend in production. And you are ready for high level of traffic :)</p>
]]></description>
										<content:encoded><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-express-1.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="1fdba express 1" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-express-1.png 1400w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-express-1-300x116.png 300w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-express-1-1024x395.png 1024w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-express-1-768x296.png 768w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-express-1-1368x528.png 1368w" sizes="auto, (max-width: 1400px) 100vw, 1400px" /></p><p>Welcome to this new edition of <a href="/blog/features/2017/10/09/1fdba-step0/">One Framework a Day keeps the Boredom Away</a>. In this series I will show you how to deploy a particular framework on Clever Cloud every day until I want to go back to boredom. Today it&#39;s about Express.</p>
<span id="more-2909"></span>

<p>In each post of this series we&#39;ll see how to deploy a particular framework on Clever Cloud. Today we are taking a look at <a href="https://expressjs.com/">Express</a>.</p>
<p>If you want to tag along, make sure you have git, a Clever Cloud account and that you have installed our CLI <a href="https://github.com/CleverCloud/clever-tools">Clever-Tools</a>.</p>
<h2 id="what-is-express">What is Express?</h2>
<blockquote>Fast, unopinionated, minimalist web framework for Node.js</blockquote>

<p>It&#39;s pretty much the default JavaScript framework for backend stuff. It&#39;s ridiculously simple to use and benefits from a great ecosystem. If you are thinking about a particular module, there&#39;s a good chance someone already wrote it. I found a project called <a href="https://realworld.io/">RealWorld</a>. They use a Medium clone as example application and have implemented it with a variety of backend and frontend frameworks. Today I will use it as an example with their <a href="https://github.com/gothinkster/node-express-realworld-example-app">Express, MondoDB backend</a> and their <a href="https://github.com/gothinkster/react-redux-realworld-example-app">React,Redux frontend</a>.</p>
<h2 id="setup">Setup</h2>
<p>Let&#39;s start by the backend. It&#39;s a Node.js application using MongoDB so I will need a Node.js application and a MongoDB add-on.</p>
<ul>
<li>Clone the backend: <code>git clone https://github.com/gothinkster/node-express-realworld-example-app</code></li>
<li>Get in the project: <code>cd node-express-realworld-example-app</code></li>
<li>Create the Node.js application: <code>clever create --type node realworld-express</code></li>
<li>Create the MongoDB addon: <code>clever addon create mongodb-addon --plan peanut realworld-mongodb</code></li>
<li>Link the database to the application: <code>clever service link-addon realworld-mongodb</code></li>
</ul>
<p>Great thing about this application is that it&#39;s already configurable with environment variable so we just have to set them up:</p>
<ul>
<li>Configure the MongoDB connection: <code>clever env set MONGODB_URI `clever env | awk  -F = &#39;/MONGODB_ADDON_URI/ { print $2}&#39;` </code></li>
<li>Set the production flag: <code>clever env set NODE_ENV production</code></li>
<li>Set the secret used by the app: <code>clever env set SECRET myVerySecretiveSecret</code></li>
<li>Add a domain name: <code>clever domain add realworldMongoExpress.cleverapps.io</code></li>
</ul>
<p>Which make your backend ready to be deployed :)</p>
<p>Moving on to the frontend.</p>
<ul>
<li>Clone the frontend: <code>git clone https://github.com/gothinkster/react-redux-realworld-example-app</code></li>
<li>Get in the project: <code>cd react-redux-realworld-example-app</code></li>
<li>Create the Node.js application: <code>clever create --type node realworld-frontend</code></li>
<li>Set the production flag: <code>clever env set NODE_ENV production</code></li>
</ul>
<p>Sadly this one requires a little tweaking to use environment variable for configuration. I have edited the file <code>src/agent.js</code> like so:</p>
<pre><code class="language-diff">- const API_ROOT = &#39;https://conduit.productionready.io/api&#39;;
+ const API_ROOT =  process.env.API_ROOT || &#39;https://conduit.productionready.io/api&#39;;
</code></pre>
<ul>
<li>Now I can configure the backend with <code>clever env set API_ROOT https://realworldMongoExpress.cleverapps.io/api</code></li>
</ul>
<p>Don&#39;t forget to commit your changes. And now you are ready to deploy :)</p>
<h2 id="deploy">Deploy</h2>
<p>Since it&#39;s a NodeJS application, the rule for deployment is simple. There has to be a <code>main</code> or <code>scripts.start</code> field in <code>package.json</code>. For the backend is ready so all you have to do is run <code>clever deploy</code>. That&#39;s it.</p>
<p>For the frontend we have a <code>scripts.start</code> but the <em>PORT</em> variable is hardcoded. So I simply removed it and commited my change:</p>
<pre><code class="language-diff">- &quot;start&quot;: &quot;cross-env PORT=4100 react-scripts start&quot;,
+ &quot;start&quot;: &quot;cross-env react-scripts start&quot;,
</code></pre>
<p>Now it&#39;s ready for deployment. Again running <code>clever deploy</code> is all you need. Run <code>clever open</code> and your Medium clone will open in your default browser.</p>
<p>Is that it? Yes if you are not expecting too much traffic. But maybe you are indeed expecting traffic. Or maybe you don&#39;t know. Both situation are fine because Clever Cloud provides automatic scaling. Let&#39;s say you want to have 2 VM for the backend. This can be configured like this:<code>clever scale --instances 2</code></p>
<p>If you are not sure about the frontend, you can setup a minimum of 2 and a maximum of 5 like this: <code>clever scale --min-instances 2 --max-instances 5</code></p>
<p>That&#39;s it. You have deployed a MongoDB/Express backend and a React/Redux frontend in production. And you are ready for high level of traffic :)</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>One Framework a Day keeps the Boredom Away: Ratpack</title>
		<link>https://www.clever.cloud/blog/features/2017/10/12/ratpack/</link>
		
		<dc:creator><![CDATA[Laurent Doguin]]></dc:creator>
		<pubDate>Thu, 12 Oct 2017 17:15:00 +0000</pubDate>
				<category><![CDATA[Features]]></category>
		<category><![CDATA[1fdba]]></category>
		<category><![CDATA[jvm]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[ratpack]]></category>
		<guid isPermaLink="false">https://www2.cleverapps.io/wp/blog/technology/2017/10/12/ratpack/</guid>

					<description><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-ratpack-1.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="1fdba ratpack 1" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-ratpack-1.png 1400w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-ratpack-1-300x116.png 300w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-ratpack-1-1024x395.png 1024w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-ratpack-1-768x296.png 768w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-ratpack-1-1368x528.png 1368w" sizes="auto, (max-width: 1400px) 100vw, 1400px" /></p>Welcome to this new edition of <a href="/blog/features/2017/10/09/1fdba-step0/">One Framework a Day keeps the Boredom Away</a>. In this series I will show you how to deploy a particular framework on Clever Cloud every day until I want to go back to boredom. Today it's about Ratpack.

<span id="more-2908"></span>

In each post of this series we'll see how to deploy a particular framework on Clever Cloud. Today we are taking a look at <a href="http://ratpack.io/">Ratpack</a>.

If you want to tag along, make sure you have git, a Clever Cloud account and that you have installed our CLI <a href="https://github.com/CleverCloud/clever-tools">Clever-Tools</a>.
<h2 id="what-is-ratpack">What is Ratpack?</h2>
<blockquote>
<ul>
 	<li>Ratpack is a set of Java libraries for building modern HTTP applications.</li>
 	<li>It provides just enough for writing practical, high performance, apps.</li>
 	<li>It is built on Java 8, Netty and reactive principles.</li>
</ul>
</blockquote>
I am personally a big Ratpack fan for its simplicity. If you want to try it there are many projects already on Github. I have chosen to test one from <a href="https://github.com/danveloper">Dan Woods</a>. He wrote the book <a href="https://www.oreilly.com/library/view/learning-ratpack/9781491921654/">Learning Ratpack</a>. I encourage you to read it if you like what you see here.

He started a performance test project: <a href="https://github.com/danveloper/s1p-high-perf-microservices/">s1p-high-perf-microservices</a>. It's a microservice that includes a connection to Postgres. So let's look at how to deploy it.
<h2 id="setup">Setup</h2>
Fist step is to clone the project:<code>git clone https://github.com/danveloper/s1p-high-perf-microservices/</code>

Open it with your favorite editor. You will see it's a gradle based project, which is one of the build tool supported by Clever Cloud. Open the DBConfig class. You will see it declares the configuraiton prefix 'db'. Let's assume it's to configure PostgreSQL. Now open <code>application.yml</code>. This is where the configuration is stored in this project. So this is where we configure the DB connection. Let's create our database. You can either log to the console, use the API or use the CLI like this: <code>clever addon create postgresql-addon --plan dev --region eu ratpackPG</code>

Here I have created a Postgre instance with the dev plan in the eu region called ratpackPG. If you run <code>clever addon</code> you will see it on the list. You can also see it in the console. A database is an add-on and as such can be linked to an application. Here linking <code>ratpackPG</code> means that the configuration environment variables provided by the add-on will be injected in the linked application. We have two things left to do.
<ul>
 	<li>Create the application: <code>clever create --type gradle ratpackTest --region par</code></li>
 	<li>Link the add-on: <code>clever service link-addon ratpackPG</code></li>
</ul>
If you are following closely you'll notice that region names are different for add-ons and applications. This has to do with our will to keep our Add-ons API compatible with Heroku.

Anyway now you have an application. And if you take a look at its environment variable with <code>clever env</code>, you should see relevant variables like <code>POSTGRESQL_ADDON_DB</code>, <code>POSTGRESQL_ADDON_HOST</code>, etc… There are different ways to use them in our project.

We can edit <code>application.yml</code> so it looks like this:
<pre><code class="language-yaml">db:
  username: ${POSTGRESQL_ADDON_USER}
  password: ${POSTGRESQL_ADDON_PASSWORD}
  database: ${POSTGRESQL_ADDON_DB}
  poolSize: 4
  hostname: ${POSTGRESQL_ADDON_HOST}
  port: ${POSTGRESQL_ADDON_PORT}
</code></pre>
Using the <code>${}</code> allows us to use existing environment variables and assigned them directly to our properties. That's because this Ratpack project includes Spring and uses it to manage part of its configuration. If you do this you can easily reuse that same code base for different applications for staging, preprod, etc…

We can also directly setup new environment variables that will be picked up by Ratpack. Take a look at their <a href="https://ratpack.io/manual/current/config.html#environment_variables">documentation</a> on the matter. To setup variables with the CLI it works like this:
<pre><code class="language-bash">clever env set RATPACK_PORT 8080
clever env set db_database \${POSTGRESQL_ADDON_DB}
clever env set db_hostname \${POSTGRESQL_ADDON_HOST}
clever env set db_password \${POSTGRESQL_ADDON_PASSWORD}
clever env set db_port \${POSTGRESQL_ADDON_PORT}
clever env set db_username \${POSTGRESQL_ADDON_USER}
clever env set db_poolSize 4
</code></pre>
Since the application is doing the following SQL query:
<pre><code class="language-java">public Observable&lt;Product&gt; getProducts() {
  return pool.queryRows("select * from product").map(row -&gt; {
    Long id = row.getLong("product_id");
    String name = row.getString("name");
    String description = row.getString("description");
    Boolean available = row.getBoolean("is_available");
    BigDecimal price = row.getBigDecimal("price");
    return new Product(id, name, description, available, price);
  }).doOnError(Throwable::printStackTrace);
}
</code></pre>
We need to load data in there. Let's create a <code>data.sql</code> file with this content:
<pre><code class="language-sql">CREATE TABLE public.product (
   product_id   bigint,
   name   text,
   description   text,
   is_available   boolean,
   price   double precision
);
INSERT INTO product(product_id, name, description, is_available, price)
       VALUES (1, 'product name','product description', true, 20.00);
</code></pre>
Or run:
<pre><code class="language-bash">touch data.sql
echo "CREATE TABLE public.product (product_id   bigint,   name   text,   description   text,   is_available   boolean,   price   double precision); INSERT INTO product(product_id, name, description, is_available, price) VALUES (1, 'product name','product description', true, 20.00);" &gt; data.sql
</code></pre>
To insert it in the DB, you can do something like <code>psql -h baug3gcfk7kx1ui-postgresql.services.clever-cloud.com -p 5432 -U ukh3kcp2me9oc1rqtw7i -d baug3gcfk7kx1ui &lt; data.sql</code>. You will be prompted for the password. This command is available in the 'add-on information' page of your Postgres instance in the console.

You can also retrieve all the variables from the CLI by typing <code>clever env</code>. If you are an awk fan here's a one liner: <code>psql `clever env | awk  -F = '/POSTGRESQL_ADDON_URI/ { print $2}'` &lt; data.sql</code>
<h2 id="deploy">Deploy</h2>
You have a configured application and add-on. Time to figure out how to run it. If you run <code>gradle tasks</code> you will get the list of gradle goals you can run. One of them is <code>run</code>, which is exactly what we want to do. To configure this, you need to create a <code>clevercloud</code> folder at the root of your project and inside it create a <code>gradle.json</code> file with the following content:
<pre><code class="language-json">{
  "deploy": {
    "goal": "run"
  }
}
</code></pre>
What is left to do is to commit your pending change:
<pre><code class="language-bash">git add clevercloud/gradle.json src/main/resources/application.yml
git commit -m"add clever cloud specifics"
</code></pre>
And then deploy your project: <code>clever deploy</code>

Once the deployment is done type <code>clever open</code> to open the application in your default browser.

If you are satisfied there's a couple of other things you can do like adding a custom domain name with <code>clever domain yourcustomdomain.com</code>. scale up <code>clever scale --flavor &lt;flavor&gt;</code> or out <code>clever scale --min-instances &lt;min-instances&gt; --max-instances &lt;max-instances&gt;</code>, even setup automatic scale out <code>clever scale --min-instances &lt;min-instances&gt; --max-instances &lt;max-instances&gt;</code>. How cool is that?]]></description>
										<content:encoded><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-ratpack-1.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="1fdba ratpack 1" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-ratpack-1.png 1400w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-ratpack-1-300x116.png 300w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-ratpack-1-1024x395.png 1024w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-ratpack-1-768x296.png 768w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-ratpack-1-1368x528.png 1368w" sizes="auto, (max-width: 1400px) 100vw, 1400px" /></p>Welcome to this new edition of <a href="/blog/features/2017/10/09/1fdba-step0/">One Framework a Day keeps the Boredom Away</a>. In this series I will show you how to deploy a particular framework on Clever Cloud every day until I want to go back to boredom. Today it's about Ratpack.

<span id="more-2908"></span>

In each post of this series we'll see how to deploy a particular framework on Clever Cloud. Today we are taking a look at <a href="http://ratpack.io/">Ratpack</a>.

If you want to tag along, make sure you have git, a Clever Cloud account and that you have installed our CLI <a href="https://github.com/CleverCloud/clever-tools">Clever-Tools</a>.
<h2 id="what-is-ratpack">What is Ratpack?</h2>
<blockquote>
<ul>
 	<li>Ratpack is a set of Java libraries for building modern HTTP applications.</li>
 	<li>It provides just enough for writing practical, high performance, apps.</li>
 	<li>It is built on Java 8, Netty and reactive principles.</li>
</ul>
</blockquote>
I am personally a big Ratpack fan for its simplicity. If you want to try it there are many projects already on Github. I have chosen to test one from <a href="https://github.com/danveloper">Dan Woods</a>. He wrote the book <a href="https://www.oreilly.com/library/view/learning-ratpack/9781491921654/">Learning Ratpack</a>. I encourage you to read it if you like what you see here.

He started a performance test project: <a href="https://github.com/danveloper/s1p-high-perf-microservices/">s1p-high-perf-microservices</a>. It's a microservice that includes a connection to Postgres. So let's look at how to deploy it.
<h2 id="setup">Setup</h2>
Fist step is to clone the project:<code>git clone https://github.com/danveloper/s1p-high-perf-microservices/</code>

Open it with your favorite editor. You will see it's a gradle based project, which is one of the build tool supported by Clever Cloud. Open the DBConfig class. You will see it declares the configuraiton prefix 'db'. Let's assume it's to configure PostgreSQL. Now open <code>application.yml</code>. This is where the configuration is stored in this project. So this is where we configure the DB connection. Let's create our database. You can either log to the console, use the API or use the CLI like this: <code>clever addon create postgresql-addon --plan dev --region eu ratpackPG</code>

Here I have created a Postgre instance with the dev plan in the eu region called ratpackPG. If you run <code>clever addon</code> you will see it on the list. You can also see it in the console. A database is an add-on and as such can be linked to an application. Here linking <code>ratpackPG</code> means that the configuration environment variables provided by the add-on will be injected in the linked application. We have two things left to do.
<ul>
 	<li>Create the application: <code>clever create --type gradle ratpackTest --region par</code></li>
 	<li>Link the add-on: <code>clever service link-addon ratpackPG</code></li>
</ul>
If you are following closely you'll notice that region names are different for add-ons and applications. This has to do with our will to keep our Add-ons API compatible with Heroku.

Anyway now you have an application. And if you take a look at its environment variable with <code>clever env</code>, you should see relevant variables like <code>POSTGRESQL_ADDON_DB</code>, <code>POSTGRESQL_ADDON_HOST</code>, etc… There are different ways to use them in our project.

We can edit <code>application.yml</code> so it looks like this:
<pre><code class="language-yaml">db:
  username: ${POSTGRESQL_ADDON_USER}
  password: ${POSTGRESQL_ADDON_PASSWORD}
  database: ${POSTGRESQL_ADDON_DB}
  poolSize: 4
  hostname: ${POSTGRESQL_ADDON_HOST}
  port: ${POSTGRESQL_ADDON_PORT}
</code></pre>
Using the <code>${}</code> allows us to use existing environment variables and assigned them directly to our properties. That's because this Ratpack project includes Spring and uses it to manage part of its configuration. If you do this you can easily reuse that same code base for different applications for staging, preprod, etc…

We can also directly setup new environment variables that will be picked up by Ratpack. Take a look at their <a href="https://ratpack.io/manual/current/config.html#environment_variables">documentation</a> on the matter. To setup variables with the CLI it works like this:
<pre><code class="language-bash">clever env set RATPACK_PORT 8080
clever env set db_database \${POSTGRESQL_ADDON_DB}
clever env set db_hostname \${POSTGRESQL_ADDON_HOST}
clever env set db_password \${POSTGRESQL_ADDON_PASSWORD}
clever env set db_port \${POSTGRESQL_ADDON_PORT}
clever env set db_username \${POSTGRESQL_ADDON_USER}
clever env set db_poolSize 4
</code></pre>
Since the application is doing the following SQL query:
<pre><code class="language-java">public Observable&lt;Product&gt; getProducts() {
  return pool.queryRows("select * from product").map(row -&gt; {
    Long id = row.getLong("product_id");
    String name = row.getString("name");
    String description = row.getString("description");
    Boolean available = row.getBoolean("is_available");
    BigDecimal price = row.getBigDecimal("price");
    return new Product(id, name, description, available, price);
  }).doOnError(Throwable::printStackTrace);
}
</code></pre>
We need to load data in there. Let's create a <code>data.sql</code> file with this content:
<pre><code class="language-sql">CREATE TABLE public.product (
   product_id   bigint,
   name   text,
   description   text,
   is_available   boolean,
   price   double precision
);
INSERT INTO product(product_id, name, description, is_available, price)
       VALUES (1, 'product name','product description', true, 20.00);
</code></pre>
Or run:
<pre><code class="language-bash">touch data.sql
echo "CREATE TABLE public.product (product_id   bigint,   name   text,   description   text,   is_available   boolean,   price   double precision); INSERT INTO product(product_id, name, description, is_available, price) VALUES (1, 'product name','product description', true, 20.00);" &gt; data.sql
</code></pre>
To insert it in the DB, you can do something like <code>psql -h baug3gcfk7kx1ui-postgresql.services.clever-cloud.com -p 5432 -U ukh3kcp2me9oc1rqtw7i -d baug3gcfk7kx1ui &lt; data.sql</code>. You will be prompted for the password. This command is available in the 'add-on information' page of your Postgres instance in the console.

You can also retrieve all the variables from the CLI by typing <code>clever env</code>. If you are an awk fan here's a one liner: <code>psql `clever env | awk  -F = '/POSTGRESQL_ADDON_URI/ { print $2}'` &lt; data.sql</code>
<h2 id="deploy">Deploy</h2>
You have a configured application and add-on. Time to figure out how to run it. If you run <code>gradle tasks</code> you will get the list of gradle goals you can run. One of them is <code>run</code>, which is exactly what we want to do. To configure this, you need to create a <code>clevercloud</code> folder at the root of your project and inside it create a <code>gradle.json</code> file with the following content:
<pre><code class="language-json">{
  "deploy": {
    "goal": "run"
  }
}
</code></pre>
What is left to do is to commit your pending change:
<pre><code class="language-bash">git add clevercloud/gradle.json src/main/resources/application.yml
git commit -m"add clever cloud specifics"
</code></pre>
And then deploy your project: <code>clever deploy</code>

Once the deployment is done type <code>clever open</code> to open the application in your default browser.

If you are satisfied there's a couple of other things you can do like adding a custom domain name with <code>clever domain yourcustomdomain.com</code>. scale up <code>clever scale --flavor &lt;flavor&gt;</code> or out <code>clever scale --min-instances &lt;min-instances&gt; --max-instances &lt;max-instances&gt;</code>, even setup automatic scale out <code>clever scale --min-instances &lt;min-instances&gt; --max-instances &lt;max-instances&gt;</code>. How cool is that?]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>One Framework a Day keeps the Boredom Away: Ruby on Rails with Redmine</title>
		<link>https://www.clever.cloud/blog/features/2017/10/11/1fdba-rails-redmine/</link>
		
		<dc:creator><![CDATA[Laurent Doguin]]></dc:creator>
		<pubDate>Wed, 11 Oct 2017 19:15:00 +0000</pubDate>
				<category><![CDATA[Features]]></category>
		<category><![CDATA[1fdba]]></category>
		<category><![CDATA[fsbucket]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<guid isPermaLink="false">https://www2.cleverapps.io/wp/blog/technology/2017/10/11/1fdba-rails-redmine/</guid>

					<description><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-ror-1.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="1fdba ror 1" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-ror-1.png 1400w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-ror-1-300x116.png 300w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-ror-1-1024x395.png 1024w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-ror-1-768x296.png 768w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-ror-1-1368x528.png 1368w" sizes="auto, (max-width: 1400px) 100vw, 1400px" /></p>Welcome to this new edition of <a href="/blog/features/2017/10/09/1fdba-step0/">One Framework a Day keeps the Boredom Away</a>. In this series I will show you how to deploy a particular framework on Clever Cloud every day until I want to go back to boredom. Today it's about Ruby on Rails.

<span id="more-2907"></span>

In each post of this series we'll see how to deploy a particular framework on Clever Cloud. Today we are taking a look at <a href="https://rubyonrails.org/">Ruby on Rails</a>.

If you want to tag along, make sure you have git, a Clever Cloud account and that you have installed our CLI <a href="https://github.com/CleverCloud/clever-tools">Clever-Tools</a>.
<h2 id="what-is-ruby-on-rails">What is Ruby on Rails?</h2>
<blockquote>Ruby on Rails, or simply Rails, is a server-side web application framework written in Ruby under the MIT License. Rails is a model–view–controller framework, providing default structures for a database, a web service, and web pages.</blockquote>
There are lots of applications built on top of Ruby on Rails. Today I decided to look at <a href="https://github.com/edavis10/redmine">Redmine</a>. It's a project management web application. You can read our documentation on <a href="https://www.clever.cloud/developers/doc/applications/ruby/">Rails</a> first and then folow this tutorial.
<h2 id="setup">Setup</h2>
<ul>
 	<li>Start by cloning the sources, here I am checking out the latest stable branch: <code>git clone https://github.com/edavis10/redmine/ --branch 3.4-stable</code></li>
 	<li>Create the database you want to use, in my case Postgres: <code>clever addon create postgresql-addon --plan dev --region eu redminePG</code></li>
 	<li>Create a <a href="https://www.clever.cloud/developers/addons/fs_buckets/">FS Bucket</a>: <code>clever addon create fs-bucket --plan s --region eu redmineFS</code></li>
 	<li>Create the Ruby application on Clever Cloud: <code>clever create --type ruby redmine --region par</code></li>
 	<li>Link the Postgres add-on to the application: <code>clever service link-addon redminePG</code></li>
 	<li>Link the FS Bucket add-on to the application: <code>clever service link-addon redmineFS</code></li>
</ul>
It's time to configure the application with environment variables. To get a list of the already available variables simply run <code>clever env</code>. You will notice all the variables related to PostgreSQL. To use them create a new <code>database.yml</code> file under <code>config</code>: <code>touch config/database.yml</code>
<pre><code class="language-yaml">production:
  adapter: postgresql
  database: &lt;%= ENV["POSTGRESQL_ADDON_DB"] %&gt;
  host: &lt;%= ENV["POSTGRESQL_ADDON_HOST"] %&gt;
  username: &lt;%= ENV["POSTGRESQL_ADDON_USER"] %&gt;
  port: &lt;%= ENV["POSTGRESQL_ADDON_PORT"] %&gt;
  password: &lt;%= ENV["POSTGRESQL_ADDON_PASSWORD"] %&gt;
  encoding: utf8
</code></pre>
<ul>
 	<li>Define a new global secret in <code>config/secrets.yml</code>: <code>touch config/secrets.yml</code>
<pre><code class="language-yaml">production:
  secret_key_base: &lt;%= ENV["SECRET_KEY_BASE"] %&gt;
</code></pre>
</li>
 	<li>Define all the other configuration variables under <code>config/configuration.yml</code>: <code>touch config/configuration.yml</code>
<pre><code class="language-yaml">production:
  attachments_storage_path: &lt;%= ENV["APP_HOME"] %&gt;&lt;%= ENV["ATTACHMENTS_STORAGE_PATH"] %&gt;
</code></pre>
</li>
</ul>
The following property uses two different variables. <em>APP_HOME</em> is already available and injected when the VM starts. It's the absolute path to the application repository. The second one is to tell Redmine where to write files.

Time to install the dependencies with <code>./bin/bundle install --without development test</code>. And now setup the various environment variables you will need:
<ul>
 	<li>Set the Ruby version: <code>clever env set RUBY_VERSION 2.3.1</code></li>
 	<li>Setup the Rails environment to use the production configuration: <code>clever env set RAILS_ENV production</code></li>
 	<li>Use <code>en</code> as language: <code>clever env set REDMINE_LANG en</code></li>
 	<li>Use a newly generated secret: <code>clever env set SECRET_KEY_BASE `./bin/rake secret` </code></li>
 	<li>Setup where to write files: <code>clever env set ATTACHMENTS_STORAGE_PATH /data/attachments</code></li>
 	<li>Define where to mount our FS Bucket:<code>clever env set CC_FS_BUCKET /data:`clever env | awk  -F = '/BUCKET_HOST/ { print $2}'` </code></li>
</ul>
The FS bucket is one of the add-ons we setup earlier. It's a FileSystem mounted when the VM starts. Here it's mounted under <code>/public</code>. This path being relative to the home of the application, which is what we had under <em>APP_HOME</em> earlier. The second part of the <em>CC_FS_BUCKET</em> variable separated by a semi-colon is the host for your FS Bucket. It's already available under the <em>BUCKET_HOST</em> variable.

Now Redmine requires to write in some folder, and those folder to be pre-created. To make sure this executed each time the app is ran, we can use a pre-run hook. It will run something each time prior to starting the app. Let's start with the script:

<code>mkdir clevercloud; touch clevercloud/initDirectories.sh &amp;&amp; chmod +x clevercloud/initDirectories.sh</code>
<pre><code class="language-bash">[ -d tmp ] || mkdir tmp
[ -d tmp/pdf ] || mkdir tmp/pdf
[ -d data/plugin_assets ] || mkdir data/plugin_assets
[ -d tmp/pdf ] || mkdir tmp/pdf
[ -d data/attachments ] || mkdir data/attachments
</code></pre>
It first tests the existence of the folder and if it does not exist, creates it. To make sure it's run add the hook like this: <code>clever env set CC_PRE_RUN_HOOK ./clevercloud/initDirectories.sh</code>

The minimum configuration is ready, we can move on to the deployment phase.
<h2 id="deploy">Deploy</h2>
As usual with Clever Cloud the deployment phase is tied to the runtime and build tool used by the application. Here it's a Ruby app so we are going to create a ruby.json file: <code>touch clevercloud/ruby.json</code>
<pre><code class="language-json">{
  "deploy" : {
    "rakegoals": ["db:migrate"],
    "sidekiq": true
  }
}
</code></pre>
Now we need to commit our changes. Create a new deployment branch, commit your stuff and deploy!
<pre><code class="language-bash">git checkout -b clever/deploy
git add Gemfile.lock clevercloud/initDirectories.sh clevercloud/ruby.json config/configuration.yml config/database.yml config/secrets.yml
git commit -m"add clever specifics"
clever deploy
</code></pre>
Last command is the equivalent of <code>git push clever yourBranch</code> where clever is a remote branch that was added when you created the application with the CLI at the very begining.

There is one last thing we can do. In Redmine's documentation they mention some default data you can import by running a rake task. Since we don't want to run these tasks each time we restart the application, we can SSH on the VM and execute them here. Run <code>clever ssh</code>. This will open a connection to the VM. From here you can execute that task:
<pre><code class="language-bash">[ldoguin@caolila redmine]$ clever ssh
Opening an ssh shell.
Warning: Permanently added '[195.154.154.198]:40707' (ED25519) to the list of known hosts.
bas@76afae97-762c-43ee-b861-d5db873b553d ~ $ cd app_58f97386-2ec5-48b6-a774-31d64241f692/
bas@76afae97-762c-43ee-b861-d5db873b553d ~/app_58f97386-2ec5-48b6-a774-31d64241f692 $ RAILS_ENV=production bundle exec rake redmine:load_default_data
Select language: ar, az, bg, bs, ca, cs, da, de, el, en, en-GB, es, es-PA, et, eu, fa, fi, fr, gl, he, hr, hu, id, it, ja, ko, lt, lv, mk, mn, nl, no, pl, pt, pt-BR, ro, ru, sk, sl, sq, sr, sr-YU, sv, th, tr, uk, vi, zh, zh-TW [en] 
====================================
Default configuration data loaded.
bas@76afae97-762c-43ee-b861-d5db873b553d ~/app_58f97386-2ec5-48b6-a774-31d64241f692 $ 
</code></pre>
If you have tasks to run regularly you can also configure a cron by adding a json fle as explained in <a href="https://www.clever.cloud/developers/doc/administrate/cron/">our documentation</a>.

To test this, I invite you to run <code>clever open</code>. This should open the running application in your default browser. By default you can login with admin/admin. I invite you to create a project, an issue and add an attachment to that issue. If everything works correctly you can go in our web console, click on redmineFS and then on File Explorer. You should be able to explore your FS bucket and see the file you attached to the issue :)

<img src="https://www2.cleverapps.io/app/uploads/2021/08/redmineFsBucket.png" alt="Application environment variables" />

What's also interesting here is that everything is configured with env variable so you can use the same code for prod and preprod or staging if you want to.
<h2 id="setup-and-deploy-a-preproduction-redmine">Setup and Deploy a Preproduction Redmine</h2>
You did most of the work already :) Just don't forget to use the <code>--alias</code> option to specify which application you are working with.
<pre><code class="language-bash">clever addon create postgresql-addon --plan s --region eu redminePG
clever addon create fs-bucket --plan s --region eu staging-redmineFS
clever create --type ruby staging-redmine --region par
clever service --alias staging-redmine link-addon staging-redminePG
clever service --alias staging-redmine link-addon staging-redmineFS
clever env --alias staging-redmine set RUBY_VERSION 2.3.1
clever env --alias staging-redmine set RAILS_ENV production
clever env --alias staging-redmine set REDMINE_LANG en
clever env --alias staging-redmine set SECRET_KEY_BASE `./bin/rake secret`
clever env --alias staging-redmine set ATTACHMENTS_STORAGE_PATH /data/attachments
clever env --alias staging-redmine set CC_FS_BUCKET /data:`clever env --alias staging-redmine  | awk  -F = '/BUCKET_HOST/ { print $2}'`
clever env --alias staging-redmine set CC_PRE_RUN_HOOK ./clevercloud/initDirectories.sh
clever deploy --alias staging-redmine
</code></pre>
Then you can inject the default data just like before. As you can see most of the work here was to make sure Redmine could be configured with environment variables. Some Rails projects, or other projects in general, are more or less compliant with <a href="https://12factor.net/">12 factors</a> and as such require some work.

Hopefuly you liked what you read. This is a very minimal setup to enjoy Redmine, there are other things to configure like the SMTP server or some plugins to be added. That's up to you :)]]></description>
										<content:encoded><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-ror-1.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="1fdba ror 1" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2021/08/1fdba-ror-1.png 1400w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-ror-1-300x116.png 300w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-ror-1-1024x395.png 1024w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-ror-1-768x296.png 768w, https://cdn.clever-cloud.com/uploads/2021/08/1fdba-ror-1-1368x528.png 1368w" sizes="auto, (max-width: 1400px) 100vw, 1400px" /></p>Welcome to this new edition of <a href="/blog/features/2017/10/09/1fdba-step0/">One Framework a Day keeps the Boredom Away</a>. In this series I will show you how to deploy a particular framework on Clever Cloud every day until I want to go back to boredom. Today it's about Ruby on Rails.

<span id="more-2907"></span>

In each post of this series we'll see how to deploy a particular framework on Clever Cloud. Today we are taking a look at <a href="https://rubyonrails.org/">Ruby on Rails</a>.

If you want to tag along, make sure you have git, a Clever Cloud account and that you have installed our CLI <a href="https://github.com/CleverCloud/clever-tools">Clever-Tools</a>.
<h2 id="what-is-ruby-on-rails">What is Ruby on Rails?</h2>
<blockquote>Ruby on Rails, or simply Rails, is a server-side web application framework written in Ruby under the MIT License. Rails is a model–view–controller framework, providing default structures for a database, a web service, and web pages.</blockquote>
There are lots of applications built on top of Ruby on Rails. Today I decided to look at <a href="https://github.com/edavis10/redmine">Redmine</a>. It's a project management web application. You can read our documentation on <a href="https://www.clever.cloud/developers/doc/applications/ruby/">Rails</a> first and then folow this tutorial.
<h2 id="setup">Setup</h2>
<ul>
 	<li>Start by cloning the sources, here I am checking out the latest stable branch: <code>git clone https://github.com/edavis10/redmine/ --branch 3.4-stable</code></li>
 	<li>Create the database you want to use, in my case Postgres: <code>clever addon create postgresql-addon --plan dev --region eu redminePG</code></li>
 	<li>Create a <a href="https://www.clever.cloud/developers/addons/fs_buckets/">FS Bucket</a>: <code>clever addon create fs-bucket --plan s --region eu redmineFS</code></li>
 	<li>Create the Ruby application on Clever Cloud: <code>clever create --type ruby redmine --region par</code></li>
 	<li>Link the Postgres add-on to the application: <code>clever service link-addon redminePG</code></li>
 	<li>Link the FS Bucket add-on to the application: <code>clever service link-addon redmineFS</code></li>
</ul>
It's time to configure the application with environment variables. To get a list of the already available variables simply run <code>clever env</code>. You will notice all the variables related to PostgreSQL. To use them create a new <code>database.yml</code> file under <code>config</code>: <code>touch config/database.yml</code>
<pre><code class="language-yaml">production:
  adapter: postgresql
  database: &lt;%= ENV["POSTGRESQL_ADDON_DB"] %&gt;
  host: &lt;%= ENV["POSTGRESQL_ADDON_HOST"] %&gt;
  username: &lt;%= ENV["POSTGRESQL_ADDON_USER"] %&gt;
  port: &lt;%= ENV["POSTGRESQL_ADDON_PORT"] %&gt;
  password: &lt;%= ENV["POSTGRESQL_ADDON_PASSWORD"] %&gt;
  encoding: utf8
</code></pre>
<ul>
 	<li>Define a new global secret in <code>config/secrets.yml</code>: <code>touch config/secrets.yml</code>
<pre><code class="language-yaml">production:
  secret_key_base: &lt;%= ENV["SECRET_KEY_BASE"] %&gt;
</code></pre>
</li>
 	<li>Define all the other configuration variables under <code>config/configuration.yml</code>: <code>touch config/configuration.yml</code>
<pre><code class="language-yaml">production:
  attachments_storage_path: &lt;%= ENV["APP_HOME"] %&gt;&lt;%= ENV["ATTACHMENTS_STORAGE_PATH"] %&gt;
</code></pre>
</li>
</ul>
The following property uses two different variables. <em>APP_HOME</em> is already available and injected when the VM starts. It's the absolute path to the application repository. The second one is to tell Redmine where to write files.

Time to install the dependencies with <code>./bin/bundle install --without development test</code>. And now setup the various environment variables you will need:
<ul>
 	<li>Set the Ruby version: <code>clever env set RUBY_VERSION 2.3.1</code></li>
 	<li>Setup the Rails environment to use the production configuration: <code>clever env set RAILS_ENV production</code></li>
 	<li>Use <code>en</code> as language: <code>clever env set REDMINE_LANG en</code></li>
 	<li>Use a newly generated secret: <code>clever env set SECRET_KEY_BASE `./bin/rake secret` </code></li>
 	<li>Setup where to write files: <code>clever env set ATTACHMENTS_STORAGE_PATH /data/attachments</code></li>
 	<li>Define where to mount our FS Bucket:<code>clever env set CC_FS_BUCKET /data:`clever env | awk  -F = '/BUCKET_HOST/ { print $2}'` </code></li>
</ul>
The FS bucket is one of the add-ons we setup earlier. It's a FileSystem mounted when the VM starts. Here it's mounted under <code>/public</code>. This path being relative to the home of the application, which is what we had under <em>APP_HOME</em> earlier. The second part of the <em>CC_FS_BUCKET</em> variable separated by a semi-colon is the host for your FS Bucket. It's already available under the <em>BUCKET_HOST</em> variable.

Now Redmine requires to write in some folder, and those folder to be pre-created. To make sure this executed each time the app is ran, we can use a pre-run hook. It will run something each time prior to starting the app. Let's start with the script:

<code>mkdir clevercloud; touch clevercloud/initDirectories.sh &amp;&amp; chmod +x clevercloud/initDirectories.sh</code>
<pre><code class="language-bash">[ -d tmp ] || mkdir tmp
[ -d tmp/pdf ] || mkdir tmp/pdf
[ -d data/plugin_assets ] || mkdir data/plugin_assets
[ -d tmp/pdf ] || mkdir tmp/pdf
[ -d data/attachments ] || mkdir data/attachments
</code></pre>
It first tests the existence of the folder and if it does not exist, creates it. To make sure it's run add the hook like this: <code>clever env set CC_PRE_RUN_HOOK ./clevercloud/initDirectories.sh</code>

The minimum configuration is ready, we can move on to the deployment phase.
<h2 id="deploy">Deploy</h2>
As usual with Clever Cloud the deployment phase is tied to the runtime and build tool used by the application. Here it's a Ruby app so we are going to create a ruby.json file: <code>touch clevercloud/ruby.json</code>
<pre><code class="language-json">{
  "deploy" : {
    "rakegoals": ["db:migrate"],
    "sidekiq": true
  }
}
</code></pre>
Now we need to commit our changes. Create a new deployment branch, commit your stuff and deploy!
<pre><code class="language-bash">git checkout -b clever/deploy
git add Gemfile.lock clevercloud/initDirectories.sh clevercloud/ruby.json config/configuration.yml config/database.yml config/secrets.yml
git commit -m"add clever specifics"
clever deploy
</code></pre>
Last command is the equivalent of <code>git push clever yourBranch</code> where clever is a remote branch that was added when you created the application with the CLI at the very begining.

There is one last thing we can do. In Redmine's documentation they mention some default data you can import by running a rake task. Since we don't want to run these tasks each time we restart the application, we can SSH on the VM and execute them here. Run <code>clever ssh</code>. This will open a connection to the VM. From here you can execute that task:
<pre><code class="language-bash">[ldoguin@caolila redmine]$ clever ssh
Opening an ssh shell.
Warning: Permanently added '[195.154.154.198]:40707' (ED25519) to the list of known hosts.
bas@76afae97-762c-43ee-b861-d5db873b553d ~ $ cd app_58f97386-2ec5-48b6-a774-31d64241f692/
bas@76afae97-762c-43ee-b861-d5db873b553d ~/app_58f97386-2ec5-48b6-a774-31d64241f692 $ RAILS_ENV=production bundle exec rake redmine:load_default_data
Select language: ar, az, bg, bs, ca, cs, da, de, el, en, en-GB, es, es-PA, et, eu, fa, fi, fr, gl, he, hr, hu, id, it, ja, ko, lt, lv, mk, mn, nl, no, pl, pt, pt-BR, ro, ru, sk, sl, sq, sr, sr-YU, sv, th, tr, uk, vi, zh, zh-TW [en] 
====================================
Default configuration data loaded.
bas@76afae97-762c-43ee-b861-d5db873b553d ~/app_58f97386-2ec5-48b6-a774-31d64241f692 $ 
</code></pre>
If you have tasks to run regularly you can also configure a cron by adding a json fle as explained in <a href="https://www.clever.cloud/developers/doc/administrate/cron/">our documentation</a>.

To test this, I invite you to run <code>clever open</code>. This should open the running application in your default browser. By default you can login with admin/admin. I invite you to create a project, an issue and add an attachment to that issue. If everything works correctly you can go in our web console, click on redmineFS and then on File Explorer. You should be able to explore your FS bucket and see the file you attached to the issue :)

<img src="https://www2.cleverapps.io/app/uploads/2021/08/redmineFsBucket.png" alt="Application environment variables" />

What's also interesting here is that everything is configured with env variable so you can use the same code for prod and preprod or staging if you want to.
<h2 id="setup-and-deploy-a-preproduction-redmine">Setup and Deploy a Preproduction Redmine</h2>
You did most of the work already :) Just don't forget to use the <code>--alias</code> option to specify which application you are working with.
<pre><code class="language-bash">clever addon create postgresql-addon --plan s --region eu redminePG
clever addon create fs-bucket --plan s --region eu staging-redmineFS
clever create --type ruby staging-redmine --region par
clever service --alias staging-redmine link-addon staging-redminePG
clever service --alias staging-redmine link-addon staging-redmineFS
clever env --alias staging-redmine set RUBY_VERSION 2.3.1
clever env --alias staging-redmine set RAILS_ENV production
clever env --alias staging-redmine set REDMINE_LANG en
clever env --alias staging-redmine set SECRET_KEY_BASE `./bin/rake secret`
clever env --alias staging-redmine set ATTACHMENTS_STORAGE_PATH /data/attachments
clever env --alias staging-redmine set CC_FS_BUCKET /data:`clever env --alias staging-redmine  | awk  -F = '/BUCKET_HOST/ { print $2}'`
clever env --alias staging-redmine set CC_PRE_RUN_HOOK ./clevercloud/initDirectories.sh
clever deploy --alias staging-redmine
</code></pre>
Then you can inject the default data just like before. As you can see most of the work here was to make sure Redmine could be configured with environment variables. Some Rails projects, or other projects in general, are more or less compliant with <a href="https://12factor.net/">12 factors</a> and as such require some work.

Hopefuly you liked what you read. This is a very minimal setup to enjoy Redmine, there are other things to configure like the SMTP server or some plugins to be added. That's up to you :)]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
