<?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>puma Archives | Clever Cloud</title>
	<atom:link href="https://www.clever.cloud/blog/tag/puma/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.clever.cloud/blog/tag/puma/</link>
	<description>From Code to Product</description>
	<lastBuildDate>Mon, 16 Oct 2017 17:15:00 +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>puma Archives | Clever Cloud</title>
	<link>https://www.clever.cloud/blog/tag/puma/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<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" fetchpriority="high" 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="(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" 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="(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>
	</channel>
</rss>
