<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[Revealbot Dev]]></title><description><![CDATA[Revealbot Dev]]></description><link>https://revealbot.dev/</link><image><url>https://revealbot.dev/favicon.png</url><title>Revealbot Dev</title><link>https://revealbot.dev/</link></image><generator>Ghost 4.32</generator><lastBuildDate>Wed, 06 May 2026 04:06:06 GMT</lastBuildDate><atom:link href="https://revealbot.dev/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[AWS CloudFront on Rails]]></title><description><![CDATA[<p>Content Delivery Network is a useful tool to reduce the latency of delivering images, scripts, and stylesheets to your customer. Since we at Revealbot are using AWS as our cloud provider we decided to give Amazon&apos;s own CDN CloudFront a try. In this post I&apos;ll describe</p>]]></description><link>https://revealbot.dev/aws-cloudfront-and-rails-6/</link><guid isPermaLink="false">6189256f12a35b0001e89dfd</guid><dc:creator><![CDATA[Mike Salosin]]></dc:creator><pubDate>Tue, 14 Jun 2022 21:51:22 GMT</pubDate><content:encoded><![CDATA[<p>Content Delivery Network is a useful tool to reduce the latency of delivering images, scripts, and stylesheets to your customer. Since we at Revealbot are using AWS as our cloud provider we decided to give Amazon&apos;s own CDN CloudFront a try. In this post I&apos;ll describe how to setup Rails and CloudFront to work with each other. </p><p>On the Rails side configuration is pretty straightforward. To enable CDN we need to add one line to our <code>production.rb</code> config file:</p><pre><code class="language-Ruby">config.asset_host = &apos;cdn.revealbot.com&apos;</code></pre><p>Now we need to set up CloudFront. Go to CloudFront <a href="https://console.aws.amazon.com/cloudfront/v3/home">page</a> in the AWS console. Click on Create distribution. Fill in the Origin domain, with the site domain select protocol that CloudFront will use to access your sites.</p><figure class="kg-card kg-image-card"><img src="https://revealbot.dev/content/images/2022/05/image-2.png" class="kg-image" alt loading="lazy" width="1512" height="1296"></figure><p>In the Settings tab enter the domain name that will be used as the CDN subdomain and request an SSL certificate to enable HTTPS.</p><figure class="kg-card kg-image-card"><img src="https://revealbot.dev/content/images/2022/05/image-3.png" class="kg-image" alt loading="lazy" width="1438" height="1264"></figure><p>Then click Create Distribution. It will take AWS a couple of minutes to roll up distribution to all regions, in the meantime, we can continue our setup. Click on created distribution and go to the Origins tab. Since we only want to serve our assets through CDN we can add additional &quot;fake&quot; origin <code>invalid.invalid</code> that will help us reject all requests except for assets.</p><figure class="kg-card kg-image-card"><img src="https://revealbot.dev/content/images/2022/05/image-4.png" class="kg-image" alt loading="lazy" width="1400" height="1184"></figure><p>Ok, almost done, now let&apos;s set up path rules, go to Behavior and create rules that will define how CDN is processing different paths. This is our current setup:</p><figure class="kg-card kg-image-card"><img src="https://revealbot.dev/content/images/2022/05/image-5.png" class="kg-image" alt loading="lazy" width="1766" height="666"></figure><p>Notice that the <code>Default (*)</code> path is set to <code>invalid.invalid</code> that we set up earlier, this will prevent CDN from serving anything else besides assets - images, fonts, stylesheets, and js files.</p><p>And that&apos;s it, redeploy your production app and all assets will be served through CloudFront CDN.</p>]]></content:encoded></item><item><title><![CDATA[Easy migration to Ansible Vault id]]></title><description><![CDATA[<p>To keep all our tokens secure we use <a href="https://docs.ansible.com/ansible/latest/user_guide/vault.html">the Ansible vault</a> to encrypt them. Historically all files with secrets were encrypted with a single password instead of using a vault id and password file. This week we decided to migrate to vault id. </p><p>All files encrypted with a password and</p>]]></description><link>https://revealbot.dev/easy-migration-to-ansible-vault-id/</link><guid isPermaLink="false">62a90203a789330001daec50</guid><dc:creator><![CDATA[Mike Salosin]]></dc:creator><pubDate>Tue, 14 Jun 2022 21:50:18 GMT</pubDate><content:encoded><![CDATA[<p>To keep all our tokens secure we use <a href="https://docs.ansible.com/ansible/latest/user_guide/vault.html">the Ansible vault</a> to encrypt them. Historically all files with secrets were encrypted with a single password instead of using a vault id and password file. This week we decided to migrate to vault id. </p><p>All files encrypted with a password and without vault id specified will have the header <code>$ANSIBLE_VAULT;1.1;AES256</code>. We can use grep to find all files with this header. To do that run</p><pre><code>grep &quot;\$ANSIBLE_VAULT;1.1;AES256&quot; group_vars/**/*.yml
</code></pre><p>Now we have a list of files that looks like that:</p><pre><code>group_vars/staging/amazon.yml:$ANSIBLE_VAULT;1.1;AES256
group_vars/staging/db.yml:$ANSIBLE_VAULT;1.1;AES256
group_vars/staging/docker_registry.yml:$ANSIBLE_VAULT;1.1;AES256
....
</code></pre><p>Grep adds matched string at the end of every file. We can use the <code>cut</code> command to remove this part since we only need file names. <code>cut -d: -f1</code> will leave only the file name.</p><p>And finally, we can use <code>xargs</code> to pass the file list to the <code>ansible-vault rekey</code> command to convert all encrypted files to encrypted files with vault id.</p><p>The full command will look like this:</p><pre><code>grep &quot;\$ANSIBLE_VAULT;1.1;AES256&quot; group_vars/**/*.yml | cut -d: -f1 | xargs ansible-vault rekey --new-vault-id vaultID@vaultfile
</code></pre>]]></content:encoded></item></channel></rss>