<?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>fsbucket Archives | Clever Cloud</title>
	<atom:link href="https://www.clever.cloud/blog/tag/fsbucket/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.clever.cloud/blog/tag/fsbucket/</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>fsbucket Archives | Clever Cloud</title>
	<link>https://www.clever.cloud/blog/tag/fsbucket/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<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" fetchpriority="high" 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="(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" 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="(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>
		<item>
		<title>FS Buckets configured with Environment Variables</title>
		<link>https://www.clever.cloud/blog/features/2017/09/22/fs-bucket-environment-variable/</link>
		
		<dc:creator><![CDATA[Laurent Doguin]]></dc:creator>
		<pubDate>Fri, 22 Sep 2017 16:44:00 +0000</pubDate>
				<category><![CDATA[Features]]></category>
		<category><![CDATA[addons]]></category>
		<category><![CDATA[fsbucket]]></category>
		<guid isPermaLink="false">https://www2.cleverapps.io/wp/blog/technology/2017/09/22/fs-bucket-environment-variable/</guid>

					<description><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/fsb-envvar-1.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="fsb envvar 1" decoding="async" srcset="https://cdn.clever-cloud.com/uploads/2021/08/fsb-envvar-1.png 1400w, https://cdn.clever-cloud.com/uploads/2021/08/fsb-envvar-1-300x116.png 300w, https://cdn.clever-cloud.com/uploads/2021/08/fsb-envvar-1-1024x395.png 1024w, https://cdn.clever-cloud.com/uploads/2021/08/fsb-envvar-1-768x296.png 768w, https://cdn.clever-cloud.com/uploads/2021/08/fsb-envvar-1-1368x528.png 1368w" sizes="(max-width: 1400px) 100vw, 1400px" /></p><p>For a long time the only way to configure an FS Bucket for your application was to create a  <code>buckets.json</code> file in <code>./clevercloud/</code> and specify the configuration in there. Not very Immutable Infrastucture friendly. It ends today.</p>
<span id="more-2903"></span>

<p>Because you had to write a file in your code for a specific application, it made your code repository tied to a particular application. Sure there was a workaround with the <code>apps</code> field that allowed us to whitelist applications for each buckets. But it is still more painful than it should be.</p>
<p>Well starting today you can configure FS Buckets using environment variable. Here&#39;s what you need to add:</p>
<pre><code class="language-scala">CC_FS_BUCKET=/path/to/folder:bucket_host
</code></pre>
<p>So if you have the following file:</p>
<pre><code class="language-json">[
  {
    &quot;bucket_host&quot;: &quot;bucket-c65762b6-4086-4c99-84b0-23eb85695809-fsbucket.services.clever-cloud.com&quot;,
    &quot;folder&quot;: &quot;/sites/default/files&quot;
  }
]
</code></pre>
<p>You can delete it and replace it with the environment variable <code>CC_FS_BUCKET=/sites/default/files:bucket-c65762b6-4086-4c99-84b0-23eb85695809-fsbucket.services.clever-cloud.com</code>.</p>
<p>If you have multiple buckets you can use multiple variables like so:</p>
<pre><code class="language-scala">CC_FS_BUCKET=/path/to/folder:bucket_host
CC_FS_BUCKET_0=/path/to/folder:bucket_host
CC_FS_BUCKET_10=/path/to/folder:bucket_host
</code></pre>
]]></description>
										<content:encoded><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/fsb-envvar-1.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="fsb envvar 1" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2021/08/fsb-envvar-1.png 1400w, https://cdn.clever-cloud.com/uploads/2021/08/fsb-envvar-1-300x116.png 300w, https://cdn.clever-cloud.com/uploads/2021/08/fsb-envvar-1-1024x395.png 1024w, https://cdn.clever-cloud.com/uploads/2021/08/fsb-envvar-1-768x296.png 768w, https://cdn.clever-cloud.com/uploads/2021/08/fsb-envvar-1-1368x528.png 1368w" sizes="auto, (max-width: 1400px) 100vw, 1400px" /></p><p>For a long time the only way to configure an FS Bucket for your application was to create a  <code>buckets.json</code> file in <code>./clevercloud/</code> and specify the configuration in there. Not very Immutable Infrastucture friendly. It ends today.</p>
<span id="more-2903"></span>

<p>Because you had to write a file in your code for a specific application, it made your code repository tied to a particular application. Sure there was a workaround with the <code>apps</code> field that allowed us to whitelist applications for each buckets. But it is still more painful than it should be.</p>
<p>Well starting today you can configure FS Buckets using environment variable. Here&#39;s what you need to add:</p>
<pre><code class="language-scala">CC_FS_BUCKET=/path/to/folder:bucket_host
</code></pre>
<p>So if you have the following file:</p>
<pre><code class="language-json">[
  {
    &quot;bucket_host&quot;: &quot;bucket-c65762b6-4086-4c99-84b0-23eb85695809-fsbucket.services.clever-cloud.com&quot;,
    &quot;folder&quot;: &quot;/sites/default/files&quot;
  }
]
</code></pre>
<p>You can delete it and replace it with the environment variable <code>CC_FS_BUCKET=/sites/default/files:bucket-c65762b6-4086-4c99-84b0-23eb85695809-fsbucket.services.clever-cloud.com</code>.</p>
<p>If you have multiple buckets you can use multiple variables like so:</p>
<pre><code class="language-scala">CC_FS_BUCKET=/path/to/folder:bucket_host
CC_FS_BUCKET_0=/path/to/folder:bucket_host
CC_FS_BUCKET_10=/path/to/folder:bucket_host
</code></pre>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
