<?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>DEV Community: Guillermo Fernandez</title>
    <description>The latest articles on DEV Community by Guillermo Fernandez (@ollita7).</description>
    <link>https://dev.to/ollita7</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%2F369894%2Ffec4632a-42b8-44a0-8640-ef8719353ae1.jpeg</url>
      <title>DEV Community: Guillermo Fernandez</title>
      <link>https://dev.to/ollita7</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ollita7"/>
    <language>en</language>
    <item>
      <title>Teamcity + AWS</title>
      <dc:creator>Guillermo Fernandez</dc:creator>
      <pubDate>Fri, 02 Jul 2021 14:18:15 +0000</pubDate>
      <link>https://dev.to/ollita7/teamcity-aws-366n</link>
      <guid>https://dev.to/ollita7/teamcity-aws-366n</guid>
      <description>&lt;p&gt;In this article we will explain how to create an ec2 ubuntu instance with the Teamcity server installed.&lt;/p&gt;

&lt;p&gt;To begin with in this case we will create an instance from an Ubuntu 20.0 image. However, you can take a look at other alternatives that Amazon provides for us here: &lt;a href="https://aws.amazon.com/es/ec2/?ec2-whats-new.sort-by=item.additionalFields.postDateTime&amp;amp;ec2-whats-new.sort-order=desc"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;When we are creating this instance it's important to save the pem file, so that you can access the machine through ssh.&lt;/p&gt;

&lt;p&gt;After we have created the instance we will go to security and use the Public IPv4 DNS, in order to create a CNAME record on your domain to access that machine. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Access to the machine
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; ssh -i "&amp;lt;file_name&amp;gt;.pem" ubuntu@ec2-ip-address.sa-east-1.compute.amazonaws.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Install java 8 to install teamcity
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; sudo apt-get update
&amp;gt; sudo apt-get install openjdk-8-jdk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Check the java version
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; java -version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Download the Teamcity Server, in our case we downloaded the latest version: 2020-2
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; sudo wget https://download-cf.jetbrains.com/teamcity/TeamCity-&amp;lt;version&amp;gt;.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; tar xfz TeamCity-&amp;lt;version&amp;gt;.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; sudo useradd teamcity
&amp;gt; sudo chown -R teamcity:teamcity TeamCity
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To change the server port, in the &amp;lt;&lt;a href="https://www.jetbrains.com/help/teamcity/teamcity-home-directory.html"&gt;TeamCityHome&lt;/a&gt;&amp;gt;/conf/server.xml file, change the port number in the not commented  XML node (here the port number is 8111):&lt;/p&gt;

&lt;p&gt;Now if you browse the IP address of your server using port 8111 you should see the TeamCity web interface.&lt;/p&gt;

&lt;p&gt;Before creating the projects we need to create at least one build agent.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; cd Teamcity/buildAgent/build
&amp;gt; sudo sh install.sh localhost
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally we need to run our TeamCity Server with the following command line from:  &amp;lt;&lt;a href="https://www.jetbrains.com/help/teamcity/teamcity-home-directory.html"&gt;TeamCityHome&lt;/a&gt;&amp;gt;/bin .&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; sudo sh runAll.sh start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We strongly recommend that you use docker instead of installing everything locally on this server, so that you can dockerize all your applications.&lt;/p&gt;

&lt;p&gt;You can find more information about how to Install Docker Engine on Ubuntu, here: (&lt;a href="https://docs.docker.com/engine/install/ubuntu/"&gt;https://docs.docker.com/engine/install/ubuntu/&lt;/a&gt;) &lt;/p&gt;

&lt;p&gt;Moreover, in my previous post you can read about Dockerizing an angular app.&lt;br&gt;
On this link: (&lt;a href="https://dev.to/ollita7/dockerizing-an-angular-app-3nef"&gt;https://dev.to/ollita7/dockerizing-an-angular-app-3nef&lt;/a&gt;)&lt;/p&gt;

</description>
      <category>devops</category>
      <category>aws</category>
      <category>docker</category>
      <category>cavepot</category>
    </item>
    <item>
      <title>Dockerizing an angular app</title>
      <dc:creator>Guillermo Fernandez</dc:creator>
      <pubDate>Thu, 03 Jun 2021 13:55:38 +0000</pubDate>
      <link>https://dev.to/ollita7/dockerizing-an-angular-app-3nef</link>
      <guid>https://dev.to/ollita7/dockerizing-an-angular-app-3nef</guid>
      <description>&lt;p&gt;In this article I will show you how to dockerize an angular application using nginx server. If you would like more information about the nginx server  you can find it here: &lt;a href="https://www.nginx.com/"&gt;https://www.nginx.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To get started we create a dockerfile with two stages:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stage 1&lt;/strong&gt;&lt;br&gt;
Installing and building the angular application:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Copy the angular code from a local machine to a docker machine.&lt;/li&gt;
&lt;li&gt;Copy the packages.json to install dependencies.&lt;/li&gt;
&lt;li&gt;Install the angular-cli and npm dependencies.&lt;/li&gt;
&lt;li&gt;Build an angular application.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For this stage we use a node machine image from the dockerhub &lt;a href="https://hub.docker.com/_/node"&gt;https://hub.docker.com/_/node&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stage 2&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Copy the angular dist folder from the previous docker machine named build on to the nginx location folder.&lt;/li&gt;
&lt;li&gt;Then we use the default cmd that starts the nginx server. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For this stage we will use a node machine from the dockerhub &lt;a href="https://hub.docker.com/_/nginx"&gt;https://hub.docker.com/_/nginx&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM node:12.7-alpine AS build
WORKDIR /app
COPY / ./
COPY package*.json ./

RUN npm install -g @angular/cli@10.0.4 &amp;amp;&amp;amp; \
    npm install &amp;amp;&amp;amp; \
    ng build
COPY . .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  STAGE 2: Run
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM nginx:1.17.1-alpine
WORKDIR /app
COPY --from=build /app/dist/ui /usr/share/nginx/html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once that is done, we will create the Dockerfile, and build the image to run it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; docker build -t &amp;lt;image_name&amp;gt; -f Dockerfile .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we can verify if the image is created by running the following command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; docker images
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that we have created the image in order to run it we have two options:. &lt;br&gt;
1) Run it using the docker command line or 2) run it using the docker-compose.&lt;br&gt;
If we decide to run it using the docker-compose we have to create a &lt;code&gt;docker-compose.yml&lt;/code&gt; file like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;version: '3'
services:
    server:
        image: &amp;lt;image_name&amp;gt;
        ports:
            - "80:80"
        tty: true
        expose:
            - "80" 
        stdin_open: true
        environment:
            - MODE=dev
        command: &amp;lt;command to run&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we want to run a command when we run the image we can specify on command.&lt;br&gt;
In addition to that, we can run the image without the docker-compose by using a command line.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -d -p 80:80 &amp;lt;image_name&amp;gt; command
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hope you liked and also helps you in case you have to dockerize an angular app.&lt;/p&gt;

</description>
      <category>angular</category>
      <category>docker</category>
      <category>googlecloud</category>
      <category>cavepot</category>
    </item>
    <item>
      <title>Why CI/CD is important?</title>
      <dc:creator>Guillermo Fernandez</dc:creator>
      <pubDate>Mon, 03 May 2021 14:03:24 +0000</pubDate>
      <link>https://dev.to/ollita7/why-ci-cd-is-important-44ng</link>
      <guid>https://dev.to/ollita7/why-ci-cd-is-important-44ng</guid>
      <description>&lt;p&gt;According to github recent report nearly 60% of survey respondents said their organizations deploy multiple times a day, once a day, or once every few days, which perhaps reflects the large number of responses from smaller (and thus presumably more nimble) companies. Just 11% said they deploy once a month and only 8% said every few months.&lt;/p&gt;

&lt;p&gt;This post is intended to share my experience why it's so important to think about these techniques.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is?
&lt;/h2&gt;

&lt;p&gt;We can find lots of definitions over the internet but I like this definition I found on the internet: &lt;/p&gt;

&lt;p&gt;&lt;em&gt;“Continuous Delivery (CD) allows you to take the code stored in the repository and continuously deliver it to production. CI/CD creates a fast and effective process of getting your product to market before your competition as well as releasing new features and bug fixes to keep your current customers happy.“&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Also I selected some pages you can read more about like Amazon, &lt;a href="https://cloud.google.com/docs/ci-cd" rel="noopener noreferrer"&gt;Google&lt;/a&gt; or &lt;a href="https://azure.microsoft.com/en-us/services/devops/pipelines/" rel="noopener noreferrer"&gt;Microsoft&lt;/a&gt; among other definitions.&lt;/p&gt;

&lt;p&gt;In my opinion is a group of techniques or practices that helps us in the journey to create software products. I will share my experience as a developer to understand why I think it’s important to use those practices.&lt;/p&gt;

&lt;p&gt;When we are developing it is common to use our local machines to develop and test the application that we are building. It's ok to do that but at some point we need to create environments where other people can take a look in order to use it or test it. Also we need to provide a way to set up a production environment with high availability and scalability.&lt;/p&gt;

&lt;p&gt;To explain ideas I will use a simple web application project with 3 environments: 1) Local for development purposes, 2) Testing for testing purposes and 3) Production environment.&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%2F4kravqz4qhlsti66wu8l.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%2F4kravqz4qhlsti66wu8l.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I will present the steps that we will do periodically in the process of building the web application.&lt;/p&gt;

&lt;p&gt;1) Develop and test our features locally.&lt;br&gt;
2) Deploy to our testing environment.&lt;br&gt;
3) Test our old and new features in the test environment.&lt;br&gt;
4) Continue the process of points 1, 2 and 3.&lt;br&gt;
5) Deploy to production.&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%2Fgoqxde8sq39yokzur3cm.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%2Fgoqxde8sq39yokzur3cm.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are a lot of tasks that we need to do in all steps of development. For example creating the environments, the databases and other stuff. For example if we need to deploy to the testing environment we will have to do the following tasks: Update the database, Get the new code, Compile, Publish, Test among other tasks.&lt;/p&gt;

&lt;p&gt;Imagine that you have to do all that task manually, also you have to do the same every time you want to deliver a new feature. Even worse, imagine that every environment has more than one machine, load balancer, more than one database. &lt;/p&gt;

&lt;p&gt;Normally we think that we will waste a lot of time automating tasks but trust me that you will save a lot of time if you invest thinking on CI/CD.&lt;/p&gt;

&lt;p&gt;Let’s start talking about some good practices we apply in this king of projects.&lt;/p&gt;

&lt;p&gt;First of all we need to have our code in some repository, we have a lot of options there and we can recomend some of theme &lt;a href="https://github.com/" rel="noopener noreferrer"&gt;Github&lt;/a&gt;, &lt;a href="https://gitlab.com/" rel="noopener noreferrer"&gt;GitLab&lt;/a&gt;. Also Google cloud has his own repository &lt;a href="https://cloud.google.com/source-repositories" rel="noopener noreferrer"&gt;Cloud Source Repository&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Suppose we have three branches: develop, test and production. Each branch will have the code that we need in each environment. Think if everytime we push code to test something will prepare the test environment with the latest change for us. Also the same will happen for production or other environments we could have.&lt;/p&gt;

&lt;p&gt;Ideally developers work on their own machines, pushing to different branches with automatic tasks that make the deployment for us. Deployment involves tasks like updating db with new data, compiling code, publishing code, run tests, etc.&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%2Fkn5idms5xo4xnlnkzmc4.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%2Fkn5idms5xo4xnlnkzmc4.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can automatize the tasks using different technologies that Google, Microsoft or Amazon among others can provide to us. In furute we will be talking about &lt;a href="https://cloud.google.com/build" rel="noopener noreferrer"&gt;Cloud Build&lt;/a&gt;, the Google tool to do that.&lt;/p&gt;

&lt;p&gt;In conclusion for me CI/CD are a group of techniques that make our work easier. It doesn't matter the tools or technologies that you use, It matters if you deliver your code as fast as you can with good quality. &lt;/p&gt;

&lt;p&gt;In future posts I will be talking about some specific tools that Google and Amazon provide to us.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>googlecloud</category>
      <category>aws</category>
      <category>cavepot</category>
    </item>
  </channel>
</rss>
