<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: arielro85</title>
    <description>The latest articles on Forem by arielro85 (@arielro85).</description>
    <link>https://forem.com/arielro85</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F387589%2F5c6525e1-a88f-4311-ac1a-856e50c2ef8e.png</url>
      <title>Forem: arielro85</title>
      <link>https://forem.com/arielro85</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/arielro85"/>
    <language>en</language>
    <item>
      <title>Full Stack Deployment with Ansible</title>
      <dc:creator>arielro85</dc:creator>
      <pubDate>Fri, 24 May 2024 18:31:02 +0000</pubDate>
      <link>https://forem.com/arielro85/deploy-mean-with-ansible-3h9a</link>
      <guid>https://forem.com/arielro85/deploy-mean-with-ansible-3h9a</guid>
      <description>&lt;p&gt;A few months ago I started practicing ansible and some Javascript with React and NodeJs. &lt;br&gt;
As a playground im using some EC2 instances in AWS, and I did not want to re configure everything everytime that I test the site . For this I wrote an Ansible playbook that performs all the required actions to get the app online.&lt;/p&gt;

&lt;p&gt;High level overview of what it does:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Extracts the repository names from the frontend_git_repo and backend_git_repo variables.&lt;/li&gt;
&lt;li&gt;Updates the system packages and reboots the machine if updates were installed.&lt;/li&gt;
&lt;li&gt;Installs gnupg and curl, which are required for MongoDB.&lt;/li&gt;
&lt;li&gt;Sets up the NodeSource repository and installs Node.js.&lt;/li&gt;
&lt;li&gt;Checks if the MongoDB GPG key is already set up, and if not, it sets it up.&lt;/li&gt;
&lt;li&gt;Creates a list file for MongoDB and updates the package list.&lt;/li&gt;
&lt;li&gt;Installs MongoDB and starts the mongod service.&lt;/li&gt;
&lt;li&gt;Installs pm2 globally, which is a process manager for Node.js applications.&lt;/li&gt;
&lt;li&gt;Installs the Nginx web server and configures it.&lt;/li&gt;
&lt;li&gt;Copies the SSH key to the EC2 instance.&lt;/li&gt;
&lt;li&gt;Clones the frontend and backend repositories from GitHub.&lt;/li&gt;
&lt;li&gt;Creates a new folder in the backend directory.&lt;/li&gt;
&lt;li&gt;Deletes the copied SSH key from the EC2 instance.&lt;/li&gt;
&lt;li&gt;Builds the frontend application and moves it to the appropriate directory.&lt;/li&gt;
&lt;li&gt;Configures pm2 for the backend application and starts it.&lt;/li&gt;
&lt;li&gt;Restarts the Nginx service.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All the actions above described , are handled by Ansible and a UI called Ansible Semaphore.&lt;/p&gt;

&lt;p&gt;Everything is in this repo where you can find the "Mean Stack playbook" and the Ansible Semaphore Docker comppose file to build the controller. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdp3u7l3t1d2rd34qjzye.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdp3u7l3t1d2rd34qjzye.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I really recommend to use Ansible or any tool you want to avoid spending lot of time installing and configuring test  services. &lt;/p&gt;

&lt;p&gt;For sure there is lot of room for improvements, but it saves a lot of time.&lt;br&gt;
My humble collaboration:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/imaerials/ansible-home-lab" rel="noopener noreferrer"&gt;https://github.com/imaerials/ansible-home-lab&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>ansible</category>
      <category>javascript</category>
      <category>development</category>
    </item>
    <item>
      <title>DevContainers in WSL with Docker and without Docker Desktop</title>
      <dc:creator>arielro85</dc:creator>
      <pubDate>Sat, 28 Oct 2023 15:14:06 +0000</pubDate>
      <link>https://forem.com/arielro85/devcontainers-in-wsl-with-docker-209a</link>
      <guid>https://forem.com/arielro85/devcontainers-in-wsl-with-docker-209a</guid>
      <description>&lt;p&gt;A time ago I decided to migrate all my code development to VSCode DevContainers. &lt;br&gt;
As a WSL user, I was facing some issues when tried to create the containers from VsCode. &lt;br&gt;
Visual Studio code was not able to find the Docker binary cause it was searching it in Windows and not in the WSL instance. &lt;br&gt;
To fix this in VScode Settings configure the following ones:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;dev.containers.dockerPath&lt;/code&gt; set to &lt;code&gt;/usr/bin/docker&lt;/code&gt;&lt;br&gt;
&lt;code&gt;dev.containers.executeInWSL&lt;/code&gt; must be checked&lt;br&gt;
&lt;code&gt;dev.containers.executeInWSLDistro&lt;/code&gt;  only required if you have more than 1 distro in WSL. &lt;/p&gt;

&lt;p&gt;With the configurations mentioned above you should now be able to create DevContainers within WSL with docker binary installed. &lt;/p&gt;

&lt;p&gt;Hope this little article help improving your coding skills.&lt;/p&gt;

</description>
      <category>docker</category>
      <category>vscode</category>
      <category>containers</category>
      <category>development</category>
    </item>
    <item>
      <title>Installing MongoDB in WSL2 with Ubuntu-22.04</title>
      <dc:creator>arielro85</dc:creator>
      <pubDate>Thu, 20 Apr 2023 18:40:18 +0000</pubDate>
      <link>https://forem.com/arielro85/install-mongodb-on-wsl2-and-ubuntu2204-33j4</link>
      <guid>https://forem.com/arielro85/install-mongodb-on-wsl2-and-ubuntu2204-33j4</guid>
      <description>&lt;p&gt;These last days I've been with no time to practice coding, and one thing stopping me was that I didn't have my dev environment as I would like to.&lt;br&gt;
So this week I decided to write this article on how I did to install MongoDB (latest) on my WSL setup.&lt;/p&gt;

&lt;p&gt;Head to root folder&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd /
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install GNUPG&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install gnupg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Issue following command to import GPG keys&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -fsSL https://pgp.mongodb.com/server-6.0.asc | \
   sudo gpg -o /usr/share/keyrings/mongodb-server-6.0.gpg \
   --dearmor
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create List file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Reload Packages&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install Mongo db Packages&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install -y mongodb-org
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create DB Folder&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir -p data/db
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Apply permissions&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo chown -R `id -un` data/db
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run MongoD&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mongod
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify&lt;/p&gt;

&lt;p&gt;You should be able to see something like &lt;code&gt;Waiting for connections","attr":{"port":27017,"ssl":"off"&lt;/code&gt; on the terminal.&lt;/p&gt;

&lt;p&gt;Hope it helps"&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>wsl</category>
      <category>mongodb</category>
      <category>ubuntu</category>
    </item>
  </channel>
</rss>
