<?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>infrastructure &#8211; Rafael Bernard Araujo</title>
	<atom:link href="https://rafael.bernard-araujo.com/tag/infrastructure/feed" rel="self" type="application/rss+xml" />
	<link>https://rafael.bernard-araujo.com</link>
	<description>desenvolvendo... while(!success){  try(); }</description>
	<lastBuildDate>Sun, 01 Dec 2024 23:16:56 +0000</lastBuildDate>
	<language>pt-BR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
<site xmlns="com-wordpress:feed-additions:1">21941730</site>	<item>
		<title>Tropeçando 105</title>
		<link>https://rafael.bernard-araujo.com/tropecando-105.php</link>
					<comments>https://rafael.bernard-araujo.com/tropecando-105.php#respond</comments>
		
		<dc:creator><![CDATA[rafael]]></dc:creator>
		<pubDate>Wed, 28 Dec 2022 18:24:08 +0000</pubDate>
				<category><![CDATA[Tropeçando]]></category>
		<category><![CDATA[adr]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[cdk]]></category>
		<category><![CDATA[ci/cd]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[design pattern]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[infrastructure]]></category>
		<category><![CDATA[orm]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[PostGreSQL]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[serverless]]></category>
		<category><![CDATA[software engineering]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[typescript]]></category>
		<guid isPermaLink="false">https://rafael.bernard-araujo.com/?p=1476</guid>

					<description><![CDATA[CQRS and Event Sourcing implementation in PHP A walk-through of using CQRS along with Event Sourcering using PHP. Is my autovacuum configured properly? Some tips to identify if you need to tune your autovacuum configurations. A proper house cleaning can improve your database health and performance. Learn how to migrate to the PHP framework Symfony [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a href="https://tsh.io/blog/cqrs-event-sourcing-php/">CQRS and Event Sourcing implementation in PHP</a></p>
<blockquote><p>
A walk-through of using CQRS along with Event Sourcering using PHP.
</p></blockquote>
<p><a href="https://www.depesz.com/2022/03/13/is-my-autovacuum-configured-properly/">Is my autovacuum configured properly?</a></p>
<blockquote><p>
Some tips to identify if you need to tune your autovacuum configurations. A proper house cleaning can improve your database health and performance.
</p></blockquote>
<p><a href="https://blog.sensiolabs.com/2022/03/03/learn-migrate-php-framework-symfony/">Learn how to migrate to the PHP framework Symfony</a></p>
<blockquote><p>
SensioLabs and Smile released a joint white paper “PHP framework migration: from legacy to Symfony” explaining how to migrate to modern PHP frameworks like Symfony. Find a selection of the key information in this infographic design by SensioLabs.
</p></blockquote>
<p><a href="https://github.com/trufflesecurity/trufflehog">trufflehog</a></p>
<blockquote><p>
Find leaked credentials. Search on your repos, source-code, etc.
</p></blockquote>
<p><a href="https://web.archive.org/web/20240523051540/https://squeaky.ai/blog/development/why-we-dont-use-a-staging-environment/">Why we don’t use a staging environment</a></p>
<blockquote><p>
Squeaky deploys their code directly from laptops to production environments. The blog posts details their strategies, such as a good suite of tests, clear branch strategy and use of feature flags.
</p></blockquote>
<p><a href="https://www.vladionescu.me/posts/scaling-containers-on-aws-in-2022/">Scaling containers on AWS in 2022</a></p>
<blockquote><p>
Benchmarking for different types of workloads and scales capabilities on AWS services in 2022: lambda, EKS, ECS, Fargate...
</p></blockquote>
<p><a href="https://aws.amazon.com/blogs/compute/building-well-architected-serverless-applications-introduction">Building well-architected serverless applications: Introduction</a></p>
<blockquote><p>
Multi-part series addressing each of the questions within the Serverless Lens of the Well-Architected Tool.
</p></blockquote>
<p><a href="https://www.atlassian.com/git/tutorials/comparing-workflows">Comparing Workflows</a></p>
<blockquote><p>
Comparision of different types of git flows: centralized, feature branch, gitflow and fork flow. Simple comparision, but easy to get the sense of their use cases.
</p></blockquote>
<p><a href="https://constructs.dev/">Construct Hub</a></p>
<blockquote><p>
Find libraries for AWS Cloud Development Kit (AWS CDK), which generates AWS CloudFormation templates, CDK for Terraform (CDKtf), which generates HashiCorp Terraform configuration files, and CDK for Kubernetes (CDK8s), which generates Kubernetes manifests.
</p></blockquote>
<p><a href="https://matthiasnoback.nl/2022/03/too-much-magic/">Too much magic?</a></p>
<blockquote><p>
A good thinking about the &quot;magic&quot; under some awesomeness that are provided by frameworks or libraries. Although they are good for quicker development, there is good to think a little bit more about how and when use it when we have a software that we aim to last longer and get to the phase of greater maintainability.
</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://rafael.bernard-araujo.com/tropecando-105.php/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1476</post-id>	</item>
		<item>
		<title>Tropeçando 90</title>
		<link>https://rafael.bernard-araujo.com/tropecando-90.php</link>
					<comments>https://rafael.bernard-araujo.com/tropecando-90.php#respond</comments>
		
		<dc:creator><![CDATA[rafael]]></dc:creator>
		<pubDate>Thu, 18 Jun 2020 04:29:22 +0000</pubDate>
				<category><![CDATA[Tropeçando]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[docker]]></category>
		<category><![CDATA[engineering]]></category>
		<category><![CDATA[feature flag]]></category>
		<category><![CDATA[infrastructure]]></category>
		<guid isPermaLink="false">https://rafael.bernard-araujo.com/?p=1352</guid>

					<description><![CDATA[Auto-restart a crashed service in systemd Systemd allows you to configure a service so that it automatically restarts in case it’s crashed. My Personal Best Practices For Using LaunchDarkly Feature Flags The Most-Neglected Postgres Feature? log_line_prefix should be the most-neglected postgres feature. Overused and mis-configured. The author talk about his finding, the great use and [&#8230;]]]></description>
										<content:encoded><![CDATA[<p class="font-thin break-normal leading-tight text-gray-900 pt-6 pb-4 text-4xl md:text-5xl"><a href="https://ma.ttias.be/auto-restart-crashed-service-systemd/" target="_blank" rel="noopener noreferrer">Auto-restart a crashed service in systemd</a></p>
<blockquote>
Systemd allows you to configure a service so that it automatically restarts in case it’s crashed.
</blockquote>

<p><a href="https://www.bennadel.com/blog/3766-my-personal-best-practices-for-using-launchdarkly-feature-flags.htm?mkt_tok=eyJpIjoiTkdVek9XTXdNRFUwTlRneiIsInQiOiJOTmJYZDFPMEVVQWxtUnljQnF4cVBadHJGdk1OXC9MaTc4YVprOTgxemsxTUlnWDkwSXVFaE5taHg1NFprRytJeXpVQmRVbmdLaFg5cUhhQzNSSzdjWHNZWjU1WlJcL3ZCVW9tdzRRV01IRDVcL1RMbnhXRHJDS1hJc0lGRk5ZZkNvYSJ9" class="aioseop-link">My Personal Best Practices For Using LaunchDarkly Feature Flags</a></p>


<p><a aria-label="The Most-Neglected Postgres Feature? (opens in a new tab)" href="https://richyen.com/postgres/2020/01/29/underestimating_log.html" target="_blank" rel="noreferrer noopener" class="aioseop-link">The Most-Neglected Postgres Feature?</a></p>


<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">log_line_prefix should be the most-neglected postgres feature. Overused and mis-configured. The author talk about his finding, the great use and some tips for log_line_prefix configuration. This feature is very powerful on PostgreSQL.</p></blockquote>


<p><a href="https://web.archive.org/web/20221208084330/https://www.highgo.ca/2020/03/24/logical-replication-between-postgresql-and-mongodb/">Logical Replication Between PostgreSQL and MongoDB</a>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">A decoder plugin to enable logical replication from a PostgreSQL (as publisher) to MongoDB (as subscriber).</p></blockquote>



<p><a href="https://github.com/docker/awesome-compose" title="Awesome-Compose: Application samples for project development kickoff" target="_blank" rel="noreferrer noopener">Awesome-Compose: Application samples for project development kickoff</a>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">A curated list of Docker Compose samples.

<p>These samples provide a starting point for how to integrate different services using a Compose file and to manage their deployment with Docker Compose.</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://rafael.bernard-araujo.com/tropecando-90.php/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1352</post-id>	</item>
		<item>
		<title>PostgreSQL &#8211; pg_upgrade from 10 to 12</title>
		<link>https://rafael.bernard-araujo.com/postgresql-pg_upgrade-from-10-to-12.php</link>
					<comments>https://rafael.bernard-araujo.com/postgresql-pg_upgrade-from-10-to-12.php#respond</comments>
		
		<dc:creator><![CDATA[rafael]]></dc:creator>
		<pubDate>Tue, 31 Mar 2020 14:20:19 +0000</pubDate>
				<category><![CDATA[PostGreSQL]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[infrastructure]]></category>
		<guid isPermaLink="false">https://rafael.bernard-araujo.com/?p=1344</guid>

					<description><![CDATA[I have some PostgreSQL databases running pretty well but we need to keep our software updated. This is a mandatory practice for a high-quality service. Those servers are running version 10 and they need to be upgraded to version 12. I have used pg_dump / pg_restore strategy for a long time, but this time I [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I have some PostgreSQL databases running pretty well but we need to keep our software updated. This is a mandatory practice for a high-quality service. Those servers are running version 10 and they need to be upgraded to version 12. I have used <code>pg_dump</code> / <code>pg_restore</code> strategy for a long time, but this time I would rather use <code>pg_upgrade</code>.</p>
<p>Let's dive into how to do it.</p>
<p>Table of contents:</p>
<ol>
<li>Install</li>
<li>InitDB</li>
<li>Check upgrade consistency</li>
<li>Set locale</li>
<li>Upgrade</li>
<li>Configurations</li>
</ol>
<h2>Install</h2>
<p>The package <code>postgresql12-server</code> contains everything needed to run the server, but my databases use some extensions [1], then I will add <code>postgresql12-devel</code> and <code>postgresql12-contrib</code> to be able to compile and to install the extensions.</p>
<pre><code class="language-sh">yum install postgresql12-server postgresql12-devel postgresql12-contrib</code></pre>
<h2>InitDB</h2>
<p>After installation we need to setup new server with initdb:</p>
<pre><code class="language-sh">~% /usr/pgsql-12/bin/postgresql-12-setup initdb
Initializing database … OK</code></pre>
<h2>Check upgrade consistency</h2>
<p>We need to check compatibility. Turn to postgres user (<code>su - postgres</code>) and run the command:</p>
<pre><code class="language-sh">~% /usr/pgsql-12/bin/pg_upgrade --old-bindir=/usr/pgsql-10/bin --new-bindir=/usr/pgsql-12/bin --old-datadir=/var/lib/pgsql/10/data --new-datadir=/var/lib/pgsql/12/data --check

Performing Consistency Checks on Old Live Server
------------------------------------------------
Checking cluster versions                                   ok
Checking database user is the install user                  ok
Checking database connection settings                       ok
Checking for prepared transactions                          ok
Checking for reg* data types in user tables                 ok
Checking for contrib/isn with bigint-passing mismatch       ok
Checking for tables WITH OIDS                               fatal

Your installation contains tables declared WITH OIDS, which is not supported
anymore. Consider removing the oid column using
    ALTER TABLE ... SET WITHOUT OIDS;
A list of tables with the problem is in the file:
    tables_with_oids.txt

Failure, exiting</code></pre>
<p>As you may see, I got a fatal error, indicating that the upgrade is not possible. In my case, tables with OIDs are the culprit. In your case could be something else. In any case, we need to fix before upgrading.</p>
<p>I fixed tables removing OIDs on mentioned tables. And ran check again:</p>
<pre><code class="language-sh">Performing Consistency Checks on Old Live Server
------------------------------------------------
Checking cluster versions                                   ok
Checking database user is the install user                  ok
Checking database connection settings                       ok
Checking for prepared transactions                          ok
Checking for reg* data types in user tables                 ok
Checking for contrib/isn with bigint-passing mismatch       ok
Checking for tables WITH OIDS                               ok
Checking for invalid &quot;sql_identifier&quot; user columns          ok
Checking for presence of required libraries                 ok
Checking database user is the install user                  ok
Checking for prepared transactions                          ok

*Clusters are compatible*</code></pre>
<p>Yay!</p>
<h2>Set locale</h2>
<p>There is a tricky configuration that is not detected by <code>pg_upgrade check</code> but it is very important to me. I use <code>C</code> locale on my databases [2], then I need to perform an extra step. If this is your case, you may follow the same steps applying yours.</p>
<p>I need to stop postgresql10 and start postgresql12:</p>
<pre><code class="language-sh">systemctl stop postgresql-10.service
systemctl start postgresql-12.service</code></pre>
<p>Then I run locale change at my template1 then locale will be enabled when my database will be upgraded.</p>
<pre><code class="language-sql">UPDATE pg_database SET datcollate=&#039;C&#039;, datctype=&#039;C&#039; WHERE datname=&#039;template1&#039;;</code></pre>
<p>And stop again: <code>systemctl stop postgresql-12.service</code> to be ready to upgrade.</p>
<h2>Upgrade</h2>
<p>Upgrade command is the same that we run before, without <code>--check</code> flag.</p>
<pre><code class="language-sh">~% /usr/pgsql-12/bin/pg_upgrade --old-bindir=/usr/pgsql-10/bin --new-bindir=/usr/pgsql-12/bin --old-datadir=/var/lib/pgsql/10/data --new-datadir=/var/lib/pgsql/12/data

Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok
Checking database user is the install user                  ok
Checking database connection settings                       ok
Checking for prepared transactions                          ok
Checking for reg* data types in user tables                 ok
Checking for contrib/isn with bigint-passing mismatch       ok
Checking for tables WITH OIDS                               ok
Checking for invalid &quot;sql_identifier&quot; user columns          ok
Creating dump of global objects                             ok
Creating dump of database schemas
                                                            ok
Checking for presence of required libraries                 ok
Checking database user is the install user                  ok
Checking for prepared transactions                          ok

If pg_upgrade fails after this point, you must re-initdb the
new cluster before continuing.

Performing Upgrade
------------------
Analyzing all rows in the new cluster                       ok
Freezing all rows in the new cluster                        ok
Deleting files from new pg_xact                             ok
Copying old pg_xact to new server                           ok
Setting next transaction ID and epoch for new cluster       ok
Deleting files from new pg_multixact/offsets                ok
Copying old pg_multixact/offsets to new server              ok
Deleting files from new pg_multixact/members                ok
Copying old pg_multixact/members to new server              ok
Setting next multixact ID and offset for new cluster        ok
Resetting WAL archives                                      ok
Setting frozenxid and minmxid counters in new cluster       ok
Restoring global objects in the new cluster                 ok
Restoring database schemas in the new cluster
                                                            ok
Copying user relation files
                                                            ok
Setting next OID for new cluster                            ok
Sync data directory to disk                                 ok
Creating script to analyze new cluster                      ok
Creating script to delete old cluster                       ok

Upgrade Complete
----------------
Optimizer statistics are not transferred by pg_upgrade so,
once you start the new server, consider running:
    ./analyze_new_cluster.sh

Running this script will delete the old cluster&#039;s data files:
    ./delete_old_cluster.sh</code></pre>
<p>Consider running analyze_new_cluster. Optional but nice to have.</p>
<pre><code class="language-sh">vacuumdb: processing database &quot;mydb&quot;: Generating minimal optimizer statistics (1 target)
vacuumdb: processing database &quot;postgres&quot;: Generating minimal optimizer statistics (1 target)
vacuumdb: processing database &quot;template1&quot;: Generating minimal optimizer statistics (1 target)
vacuumdb: processing database &quot;mydb&quot;: Generating medium optimizer statistics (10 targets)
vacuumdb: processing database &quot;postgres&quot;: Generating medium optimizer statistics (10 targets)
vacuumdb: processing database &quot;template1&quot;: Generating medium optimizer statistics (10 targets)
vacuumdb: processing database &quot;mydb&quot;: Generating default (full) optimizer statistics
vacuumdb: processing database &quot;postgres&quot;: Generating default (full) optimizer statistics
vacuumdb: processing database &quot;template1&quot;: Generating default (full) optimizer statistics

Done</code></pre>
<h2>Configurations</h2>
<p>Before deleting your old cluster, remember to get some of your configurations.</p>
<pre><code class="language-sh">mv /var/lib/pgsql/12/data/pg_hba.conf /var/lib/pgsql/12/data/pg_hba.conf.new
cp /var/lib/pgsql/10/data/pg_hba.conf /var/lib/pgsql/12/data/</code></pre>
<p>I am not a big fan of writing directly to <code>postgresql.conf</code> file. Instead, I keep configuration files under version control and include the directory where those files are deployed. I treat them as code, then it becomes easier to maintain and manage.</p>
<p>Another advantage is that I don't have any mess about config file differences when a new version arises. I am automatically using new default configurations, my customized setting are loaded and I can quickly address any incompatibility caused by migration without touching the original conf file.</p>
<p>Let's go for it:</p>
<pre><code># Add settings for extensions here
include_dir = &#039;/var/lib/pgsql/conf.d&#039;   # include files ending in &#039;.conf&#039; from</code></pre>
<p>Then you may delete your old cluster. <img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>Links:</p>
<ol>
<li>Extensions: <a href="https://www.postgresql.org/docs/current/contrib.html">https://www.postgresql.org/docs/current/contrib.html</a></li>
<li>Locale: <a href="https://www.postgresql.org/docs/current/locale.html">https://www.postgresql.org/docs/current/locale.html</a></li>
</ol>
]]></content:encoded>
					
					<wfw:commentRss>https://rafael.bernard-araujo.com/postgresql-pg_upgrade-from-10-to-12.php/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1344</post-id>	</item>
		<item>
		<title>Tropeçando 88</title>
		<link>https://rafael.bernard-araujo.com/tropecando-88.php</link>
					<comments>https://rafael.bernard-araujo.com/tropecando-88.php#respond</comments>
		
		<dc:creator><![CDATA[rafael]]></dc:creator>
		<pubDate>Thu, 26 Dec 2019 19:42:51 +0000</pubDate>
				<category><![CDATA[Tropeçando]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[docker]]></category>
		<category><![CDATA[infrastructure]]></category>
		<category><![CDATA[PostGreSQL]]></category>
		<guid isPermaLink="false">https://rafael.bernard-araujo.com/?p=1331</guid>

					<description><![CDATA[Intro Guide to Dockerfile Best Practices There are over one million Dockerfiles on GitHub today, but not all Dockerfiles are created equally. Efficiency is critical, and this blog series will cover five areas for Dockerfile best practices to help you write better Dockerfiles: incremental build time, image size, maintainability, security and repeatability. If you’re just [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a href="https://www.docker.com/blog/intro-guide-to-dockerfile-best-practices/" rel="noopener noreferrer" target="_blank">Intro Guide to Dockerfile Best Practices</a></p>
<blockquote><p>There are over one million Dockerfiles on GitHub today, but not all Dockerfiles are created equally. Efficiency is critical, and this blog series will cover five areas for Dockerfile best practices to help you write better Dockerfiles: incremental build time, image size, maintainability, security and repeatability. If you’re just beginning with Docker, this first blog post is for you! The next posts in the series will be more advanced.</p></blockquote>
<p><a href="http://nikic.github.io/2014/01/10/The-case-against-the-ifsetor-function.html" rel="noopener noreferrer" target="_blank">The case against the ifsetor function</a></p>
<blockquote><p>how to traverse nested array structures with potentially non-existing keys without throwing notices</p></blockquote>
<p><a href="https://stitcher.io/blog/laravel-beyond-crud" rel="noopener noreferrer" target="_blank">Laravel Beyond CRUD</a></p>
<blockquote><p>Proposal for thinking Laravel applications using DDD approach. A blog series for PHP developers working on larger-than-average Laravel projects.</p></blockquote>
<p><a href="https://www.docker.com/blog/designing-your-first-application-kubernetes-part1/" rel="noopener noreferrer" target="_blank">Designing Your First App in Kubernetes, Part 1: Getting Started</a></p>
<blockquote><p>Kubernetes’s gravity as the container orchestrator of choice continues to grow, and for good reason: It has the broadest capabilities of any container orchestrator available today. But all that power comes with a price; jumping into the cockpit of a state-of-the-art jet puts a lot of power under you, but how to actually fly the thing is not obvious.</p></blockquote>
<p><a href="https://www.depesz.com/2019/09/26/how-to-run-short-alter-table-without-long-locking-concurrent-queries/" rel="noopener noreferrer" target="_blank">How to run short ALTER TABLE without long locking concurrent queries</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://rafael.bernard-araujo.com/tropecando-88.php/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1331</post-id>	</item>
	</channel>
</rss>
