<?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:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Falgi Faisal on Medium]]></title>
        <description><![CDATA[Stories by Falgi Faisal on Medium]]></description>
        <link>https://medium.com/@falgifaisal?source=rss-1bca30b54b44------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*kJz_cJPPHg43NjiX</url>
            <title>Stories by Falgi Faisal on Medium</title>
            <link>https://medium.com/@falgifaisal?source=rss-1bca30b54b44------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 06:39:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@falgifaisal/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How I Built a Simple High Availability Setup in AWS: Auto Scaling Group + ALB from Scratch]]></title>
            <link>https://medium.com/@falgifaisal/how-i-build-a-simple-high-availability-in-aws-auto-scaling-group-alb-from-scratch-f2974cda7021?source=rss-1bca30b54b44------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2974cda7021</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[load-balancing]]></category>
            <category><![CDATA[high-availability]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Falgi Faisal]]></dc:creator>
            <pubDate>Sat, 22 Mar 2025 08:34:38 GMT</pubDate>
            <atom:updated>2025-03-24T23:42:11.114Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Hi,<br>In this article, I will walk you through a tutorial on how I built a simple High Availability (HA) setup in AWS, including both public and private subnets.</p><p>Here is the architecture diagram for this tutorial:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*v9EcqUF9uX8pF_HOCusXqg.png" /></figure><h3>Steps I Followed</h3><h3>1. Login to AWS Console and Open VPC</h3><p>The first step is to log in to the AWS Management Console and navigate to the <strong>VPC Dashboard</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7866xcfmfbC_gyCG-ekvVQ.png" /></figure><h3>2. Create a VPC</h3><p>Next, I created a new <strong>VPC</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*_L7Rbh156UyVmJlrQRuv3g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5OqWlydgUhst3SgK1lwOEw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*79tbmf-ZNunSJ9pw1HFS5w.png" /></figure><p>Here is the result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G_1ATH-z41LgiovH5BnhGA.png" /></figure><h3>3. Create Subnets</h3><p>I created <strong>four subnets</strong> — two public and two private.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lmib2-1HJz41QV8os6V4BQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UmjzIWiFI77Oz8wvzc0pCg.png" /></figure><p>Here are the results:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xlloacrkSpnVWxNJT4PyZg.png" /></figure><h3>4. Create an Internet Gateway</h3><p>To allow instances in the public subnet to connect to the internet, I created an <strong>Internet Gateway (IGW)</strong> and attached it to my VPC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*J52Th_w1TF0ZC84-elNaLw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vrK4a1AinI9NCn_G4TPI6A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P-8ToDbxm5SeQKFbwd7cJw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b9t--oad_e82I2xYUj2x-g.png" /></figure><h3>5. Create Route Tables</h3><p>I created <strong>two route tables</strong>:</p><ul><li><strong>Public Route Table</strong> (for public subnets)</li><li><strong>Private Route Table</strong> (for private subnets)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/347/1*H4jyFtx68iaPf7EU1LjDeA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sf5QJSmf2KMMLGw9rZlwiA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5mxTtEdBB7quDvERIqKFfg.png" /></figure><p>Then, I clicked “<strong>Edit subnet associations”</strong> to attach:</p><ul><li>The <strong>public-rt</strong> to public subnets</li><li>The <strong>private-rt</strong> to private subnets</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*INieX4eCn3Iu5lpjTAN5Og.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UDHl7QoC7093wRKc8r-ekg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eXzpnEeyOgJ7vbbfFT63-A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TtvnDKLmK3yonOIJzYHf8g.png" /></figure><p>In the <strong>public route table</strong>, I added a new route:</p><ul><li><strong>Destination:</strong> 0.0.0.0/0</li><li><strong>Target:</strong> Internet Gateway (IGW)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gN898fLKiiBtF-MRKfJmHQ.png" /></figure><h3>6. Create a NAT Gateway</h3><p>To allow instances in private subnets to access the internet, I created a <strong>NAT Gateway</strong> and attached it to my VPC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/246/1*pUBIix3mTEkPOh6ky1eq3Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4lsL6g4_M29TFJUrxgBnNA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6ySSUcaKH97HH-_aQ4zZFw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AnJwlEJkGHrHXkx0O3MJbg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*30Q7VKSNbSrfDPfmgBTgmw.png" /></figure><p>In the <strong>private route table</strong>, I added a new route:</p><ul><li><strong>Destination:</strong> 0.0.0.0/0</li><li><strong>Target:</strong> NAT Gateway</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bibNXbUHJOKtmYYBLrDpyA.png" /></figure><h3>7. Create a Bastion Host</h3><p>To securely SSH into private instances, I set up a <strong>Bastion Host</strong> in the public subnet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*nhZsE6kQ9TDkBJgsPfmQwA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*SjCST2FyeKcsSlR1WCuhRQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*Xg8LtyuQzwmIqCg0bpfOow.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*pL9kAlv35qrgnc_R24Dy4w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BtcCmOpU4rF9WQ8cw-ZOnw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s7KetEF6zYGzsWEQrWuNJw.png" /></figure><h3>8. Create an Application Load Balancer (ALB)</h3><p>I then created an <strong>Application Load Balancer (ALB)</strong> under the <strong>Load Balancers</strong> section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/167/1*vtbF7WG5bcj6uQFyRXcBxg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v1ikqxUsmFAoIqKeA54Azg.png" /></figure><p>Select <strong>Application Load Balancer</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NNT4ZUPrYuO7pJwqppcL0g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yCjQdvBNJT0yKBkrDcMJWQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5KzlZ7DcoKiDSM1xty-DEw.png" /></figure><p>Click <strong>Create a new security group</strong> and configure it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5KzlZ7DcoKiDSM1xty-DEw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JpayY8RgEMWGeIZ8juUuvg.png" /></figure><p>Then choose the security group i created</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DyQ3jdyYG_hVM_FPt6LNTw.png" /></figure><p>Then click “Create target group”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5xHUWP3YGxsRKkf6fk_Q7Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GpRCgE18hWC0ZlEj9lqeMg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qp_WKJvQuFZQenvFDLnvIA.png" /></figure><p>Then, refresh in “Default action” and choose the <strong>target group</strong> I created</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OZ_MbbzprPqqd4oqhZak5Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mb6eM_trRK3sfBKICTvGwA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JuaQhchoR42CSJxUt2XkAQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qy_r44r0x0Li9rA2OqqlNg.png" /></figure><p>Click <strong>Create Load Balancer</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OMiDVadsvqwzJUkIVE4z4A.png" /></figure><p>After a few minutes, the <strong>ALB state</strong> changed from <strong>Provisioning</strong> to <strong>Active</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zNJpnSKAAFLwSdBKb-vBDQ.png" /></figure><p><strong>9. Create a Launch Template and Auto Scaling Group</strong></p><p>Next, I created a <strong>Launch Template</strong> to define how instances should be launched.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*iJ7t-Ft6bBdIoI2yh1qTTQ.png" /></figure><h4>Steps:</h4><ol><li>Click <strong>Create Launch Template</strong> and fill in the required details</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1GVyJkL-po6OV4XmW9FYYw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*yEhMZ20xjD6fzMoKB2vwpg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nD2hiwDoVe2NhXrOEifGUA.png" /></figure><p>2. In the <strong>SSH section</strong>, I set the source IP to my Bastion Host’s IP</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hipagabVXkGcDwdhvpEQjQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FA6-cfz62QQk44aLf7bWLQ.png" /></figure><p>3. Added a <strong>User Data script</strong> to verify that the Load Balancer works</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1JwHU0eZSC9HEIK444jD7A.png" /></figure><p>4. Click <strong>Create Launch Template</strong></p><p>Here is the result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*D4MhYZ3Bi0Zsi2vOituSSw.png" /></figure><p>After that, I created an Auto Scaling Group based on the Launch Template.</p><h4>Steps:</h4><ol><li>Click <strong>Create Auto Scaling Group</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/235/1*tO9hWv9TVRioovDgp9fr8A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wakyOcBCmC941AnhOeuIAQ.png" /></figure><p>2. Configure scaling policies</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JX2_C2FtmMI10XkSKmt9BA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PldO46zkqOpwEMzYuzY0Tg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aNos0pL6Ws0KKTndWUunJQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K-_PEBksusodX_5pmMBJJA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KELrIjwkh2n6IoBcAwIqww.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c37ttej3CL56YDMTnXBw9w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T_-yUuptQTisH76XZvgQCQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HOhBv5WpxYzYN_DEkic-yQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DxrjL5fMsFjZN5uuewgmyw.png" /></figure><p>3. Review the setup</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FJb3l6cOXUICXPGNvXBcSw.png" /></figure><p>4. Click <strong>Create Auto Scaling Group</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3GFTLmFRgQd6CaoDaFsRLg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e62CzE5HrvfoLQgYjTpZAA.png" /></figure><h3>10. Verify the Setup</h3><p>Finally, I accessed the <strong>Load Balancer URL</strong> to verify that everything was working correctly. Here is the result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*xmWcW8ko7z7vDvk8O5sdwA.png" /></figure><h3>Conclusion</h3><p>In this tutorial, I demonstrated how to set up a <strong>Highly Available</strong> infrastructure in AWS using:<br> ✅ <strong>VPC with Public &amp; Private Subnets</strong><br> ✅ <strong>Internet Gateway &amp; NAT Gateway</strong><br> ✅ <strong>Bastion Host for Secure SSH Access</strong><br> ✅ <strong>Application Load Balancer (ALB)</strong><br> ✅ <strong>Launch Template &amp; Auto Scaling Group</strong></p><p>This setup ensures that applications can handle failures and scale automatically based on traffic demand. 🚀</p><p>In the future, I might create the same setup using Terraform to automate the entire process.</p><p>💡 <strong>I’d love to hear your thoughts!</strong> If you have any feedback, suggestions, or ideas for improvement, feel free to share them in the comments. Let me know if there are any specific topics you’d like me to cover in the next article!</p><p>👉 <em>If you find any issues or have suggestions to improve this setup, feel free to experiment and share your thoughts!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2974cda7021" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Setup CI/CD With Github Actions For K3s]]></title>
            <link>https://medium.com/@falgifaisal/how-i-setup-ci-cd-with-github-actions-for-k3s-e1760e5edbbc?source=rss-1bca30b54b44------2</link>
            <guid isPermaLink="false">https://medium.com/p/e1760e5edbbc</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Falgi Faisal]]></dc:creator>
            <pubDate>Sun, 16 Jan 2022 16:27:00 GMT</pubDate>
            <atom:updated>2022-01-16T16:27:00.719Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, i want to share about setup ci/cd with github actions for k3s.</p><p>I assume that the reader of my article already setup 3 servers for kubernetes cluster and open the port needed for setup kubernetes cluster.</p><p>First, login to the server that will be the master node and install the docker.<br>I collect all the steps in this <a href="https://docs.docker.com/engine/install/ubuntu/">link</a> into one script and then execute it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*U8uPcG93Wbttz5u97rT4_Q.png" /></figure><p>And also change the hostname</p><pre>sudo nano /etc/hostname</pre><p>Then reboot</p><pre>sudo reboot</pre><p>Then do the same steps for 2 worker nodes and also change the hostname</p><pre>sudo apt update &amp;&amp; sudo nano /etc/hostname</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*rfSsDip9cRGpwfX_NJ8Kog.png" /><figcaption>Worker 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/985/1*5dimEW7RBw5bG0EMGEpB7g.png" /><figcaption>Worker 2</figcaption></figure><p>Then reboot</p><p>After all the steps above done, then we need to login to our docker hub repository in every nodes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*srHut2FPI1Rfen0jT6zy_A.png" /><figcaption>Master node</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n3B2yOOC8JC3yG-2pxZb3w.png" /><figcaption>Worker 1 node</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5iTcExfvvBTPlAYAmigwKg.png" /><figcaption>Worker 2 node</figcaption></figure><p>Then i use <a href="https://k3s.io/">k3s</a> for my kubernetes cluster</p><p>You can visit this <a href="https://k3s.io/">link</a> to know how to install it into your server</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*9sMeZ3QwvPA7lOcHdiNkSA.png" /><figcaption>K3S Installation at Master Node</figcaption></figure><p>There is a syntax difference between master node and worker node.</p><p>To know about k3s_token variabel then please run this command as a root</p><pre>cat /var/lib/rancher/k3s/server/node-token</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EWPatqNx0PyEUUQI49DeaQ.jpeg" /><figcaption>K3S Installation at Worker 1 Node</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RFavtu79-pvexWHPyk8Crg.jpeg" /><figcaption>K3S Installation at Worker 2 Node</figcaption></figure><p>Then we can run this command from master node</p><pre>sudo kubectl get no</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/1*D_dAHfkiRFPNDn6xqIrnGg.png" /></figure><p>After we setup our kubernetes cluster using k3s, the next step is to configure the repository to use deploy keys, so whenever the server pull from the repository, this does not need to enter a password.</p><p>First, we need to generate the ssh key by run this command from the user that clone the repository</p><pre>ssh-keygen -t rsa</pre><p>Then copy the result of this command</p><pre>cat .ssh/id_rsa.pub</pre><p>Then paste it into your github repository</p><p>1. Go to “Settings”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*pSZu_oi1_Ss4AX0cvsrAig.png" /></figure><p>2. Go to “Deploy Keys”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*UIhPz--NNvPSmJ7IdDqGKQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wiJn4OtExrehtxRwYCHZ9w.png" /></figure><p>3. Fill the “Title” and paste your public key to “Key”</p><p>Then, try to clone it using “SSH” from your master node</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*pSZu_oi1_Ss4AX0cvsrAig.png" /></figure><p>After you clone your repository with “SSH”, then we setup ci cd with github actions</p><p>First, go to “Settings” and choose “Secrets”. Then, fill it with your need</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1GsTph1F0LpBY1xSrvvJfA.png" /></figure><p>In this section, i fill it with HOST, KEY, PORT and USERNAME</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8CNm1gf7Y2cPuLJc4WEa_w.png" /></figure><p>Then, go to “Actions” and “set up a workflow yourself”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LLi7dspIBXGDT0wF8SwBlg.png" /></figure><p>Then i use this, so whenever there is a push in my main branch, it will do ssh connection to my server and run the script to do :</p><ol><li>Build the image</li><li>Push the image into docker hub</li><li>Update the deployment image</li></ol><pre>name: Deployment                                                           on:                               <br>  push: <br>    branches: [ main ]</pre><pre>jobs:<br>  build:<br>    runs-on: ubuntu-latest                                                               </pre><pre>    steps:<br>      # Runs a single command using the runners shell                <br>      - name: executing remote ssh commands using ssh key      <br>        uses: appleboy/ssh-action@master                      <br>        with:<br>          host: ${{ secrets.HOST }}                     <br>          username: ${{ secrets.USERNAME }}                    <br>          key: ${{ secrets.KEY }}                              <br>          port: ${{ secrets.PORT }}                         <br>          script: sh /home/ubuntu/deploy.sh</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zGXV29L6PrPf4liDp1rcDg.png" /><figcaption>Build the Image</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nYRjwoYZrnw-Sv8gGFlYQQ.png" /><figcaption>Push the Image</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*kMlyMAr-shOtMUWqHw8EFQ.png" /><figcaption>Update the Deployment Image</figcaption></figure><p>This is the result from the script above “Complete Job”</p><p>That’s all what i did to create ci cd with github actions.</p><p>Then i still have to create some improvements.</p><p>Thank you</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e1760e5edbbc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Setup A Simple CI/ CD Process With Jenkins And GKE Part 2]]></title>
            <link>https://medium.com/@falgifaisal/how-i-setup-a-simple-ci-cd-process-with-jenkins-and-gke-part-2-6d85ca9d3776?source=rss-1bca30b54b44------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d85ca9d3776</guid>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[cicd]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[google-kubernetes-engine]]></category>
            <dc:creator><![CDATA[Falgi Faisal]]></dc:creator>
            <pubDate>Wed, 01 Jul 2020 11:05:43 GMT</pubDate>
            <atom:updated>2020-07-01T11:05:43.193Z</atom:updated>
            <content:encoded><![CDATA[<p>In my previous article (<a href="https://medium.com/@falgifaisal/how-i-setup-a-simple-ci-cd-process-with-jenkins-and-gke-part-1-a7f5b6564a3b?source=---------2------------------">How I Setup A Simple CI/ CD Process With Jenkins And GKE Part 1</a>), i already setup jenkins and GKE. And now i will share how i setup for my simple CI / CD</p><p>First, to i want to connect the jenkins server with my kubernetes machines so i installed kubectl from the jenkins server</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BgXRRCS4XmCAN9zWFmjcxg.png" /></figure><p>After installed, i clicked “Kubernetes Engine” and “Clusters”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*3uLF4MMOxr1mTHbSS2URSQ.png" /></figure><p>Next, i clicked “Connect” in my cluster (in my case, the cluster name is “testing”) and copy the command that shown in the console and paste it into my jenkins server</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QzkX5QiVLdrwEG--ybgXyg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BgXRRCS4XmCAN9zWFmjcxg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*FiSMXeqqUkKNqRVQvmluNQ.jpeg" /></figure><p>And then, to test is it already connected to my cluster or no, i try to run “kubectl get nodes” and this is the result</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*ZWpZ8kk_ELuS1zMuUgOEPw.png" /></figure><p>Now, i installed docker in the jenkins server. This is used when i want to build the docker image. After installed the docker, i runned “docker run hello-world” to test it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*unN3x7sPWR7Vtul9SwyZCA.png" /></figure><p>After installed the docker, i runned “gcloud auth configure-docker” so i can push and pull the docker image from Google Container Registry</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UhVO636exjZ1dH86Z4V61g.png" /></figure><p>Next, i setup the jenkins and my repository so when i do something to my repository like push to my repository, it will trigger my jenkins to do something to cluster</p><p>First, after logged in to my account, i clicked “Settings”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2C80NjsM1VYLMQflmJ_grg.png" /></figure><p>Next, go to “Developer Settings”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bSEEqpDI9qV0FnizgXzllw.png" /></figure><p>Next, i choosed “Personal Access Tokens” and “Generate new token” and clicked the options that accordance with my needs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4nTdJZqDfGvTdpkwlX8baQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cYcGMWOgcJlHyye9_5_eEg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zTx6B7HtNvN01guhrwtnqw.png" /></figure><p>Then i clicked “Generate token”. And this is the result for my token</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*wpaWc7iRVxF9qxBPurr7TQ.png" /></figure><p>I will use this token for my Dockerfile, so i can clone my repository without entering my credentials.</p><p>Next, from my repository i choosed “Settings” and “Webhooks”. This is i use to trigger the jenkins server if there is an event like push or pull requests</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fcGipu0XU8RK6QvmhoFWTw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7-9tvD9iOdXb8noZIuHgTA.png" /></figure><p>Next, i clicked “Add webhook” and filled the form that accordance with my needs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZhVdjCWjzyname2FRbV0dg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2c2UyaRIeVEsldMNXmFsCQ.png" /></figure><p>Next, i clicked “Add webhook”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NPeJKXTY0AyRG9SyfXEs3Q.png" /></figure><p>Now, time to setup the jenkins.</p><p>I logged in to my jenkins server and click “New Item”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/372/1*WcbTam_gZuTA0LRNze3NOw.png" /></figure><p>Next, i filled the form with “test” and choosed “Freestyle Project”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*19P3g3Ic9hjY35IrH7Zwrg.png" /></figure><p>Next, i filled the form</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F9LPubRcUmVr2H1y9EeHJw.png" /></figure><p>In “Repositories” section, i filled with my private repository</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qmtr9Olkf5eC2-h2e08MQQ.png" /></figure><p>To connect with my private repository, i need to add my credential so i clicked “Add” and “Jenkins”. And filled the form with my username and password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1009/1*427LE5H10iJgr-zFQXiirg.png" /></figure><p>And in the “Build Trigger” section, i choosed “GitHub hook trigger for GITScm polling”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*NzuEYKt99jXp8SqmakRncg.png" /></figure><p>And in the “Build” section i clicked “Add build step” and “Execute shell”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/410/1*5ymub_lwKyaTrfGb3dxdKw.png" /></figure><p>And run bash script to process ci /cd where the process of this script is</p><p>a. Create timestamp for versioning of docker image</p><p>b. Build docker image with — no-cache option and tag the image with versioning of timestamp that already created in step a.</p><p>c. Push the docker image into google container registry</p><p>d. Update the image with newer version in kubernetes</p><p>Here is the script that i saved in deploy.sh</p><pre>date &quot;+%Y%m%d%H%M%S&quot; &gt; time-build.txt<br>docker build --no-cache -t asia.gcr.io/latihan-281707/testing-deployment:production-$(cat time-build.txt) .<br>docker push asia.gcr.io/latihan-281707/testing-deployment:production-$(cat time-build.txt)<br>kubectl set image deployment/testing-deployment testing-deployment=asia.gcr.io/latihan-281707/testing-deployment:production-$(cat time-build.txt)</pre><p>And then click “Save”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G0vlv7HcOfFknt7E0BmEsw.png" /></figure><p>Now, i created a simple deployment with my simple image with command “kubectl create deployment testing-deployment — image=asia.gcr.io/latihan-281707/testing-deployment:production-20200629143158”</p><p>And this is the result</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*du2lkJhpQPKEbrF7OxqBQw.png" /></figure><p>Based on the picture, after created the deployment, i run curl ip-of-the-pod:port-of-my-container (in this case i run curl 10.24.2.27:3000), the output give me “Hello World version production 2”.</p><p>Now, i will update the code in my repository from version 2 to version 3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dnAQstFDnLbPDlzbrc4njA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oCse00kVCBNiInUddvdhYA.png" /></figure><p>After click “Commit Changes”, this will trigger the job that already created in jenkins. You can find it in “Build History”. In my case, the update i did at number 20</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/351/1*suxsBDxMXfHHNOVweJ6GIg.png" /></figure><p>Then, i clicked this build history and this is the output after i clicked “Console Output” to see the output of this job</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2AbLu0eH4i1e2bU0Cg1Fcg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qE8IuHeh_tzbTVDH0e3o6g.png" /></figure><p>Now, i will check into my server and run curl ip-of-the-pod:port-of-my-container (in this case i run curl 10.24.1.39:3000), the output give me “Hello World version production 3”. The output shows the latest code in the repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SgNG6hSd4dyekzywTw8t3g.png" /></figure><p>And this is the output when i want to check the image in my deployment</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/1*Ho4XY7IjIjFHtLYAGAYeiQ.png" /></figure><p>I think it’s enough for a very simple ci / cd and i still need to improve this to make the performance better than now.</p><p>Please correct me if you find a mistake.</p><p>Thank you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d85ca9d3776" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Setup A Simple CI/ CD Process With Jenkins And GKE Part 1]]></title>
            <link>https://medium.com/@falgifaisal/how-i-setup-a-simple-ci-cd-process-with-jenkins-and-gke-part-1-a7f5b6564a3b?source=rss-1bca30b54b44------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7f5b6564a3b</guid>
            <category><![CDATA[cicd]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[google-kubernetes-engine]]></category>
            <dc:creator><![CDATA[Falgi Faisal]]></dc:creator>
            <pubDate>Sun, 28 Jun 2020 10:08:50 GMT</pubDate>
            <atom:updated>2020-06-28T10:08:50.669Z</atom:updated>
            <content:encoded><![CDATA[<p>In my writing this time, i would like to share how i setup a simple CI/ CD process with jenkins and GKE. Of course, all i did just a simple thing and still need to improve it for a better performance. The purpose of this writing is to be a reminder for myself how I setup ci / cd for the js node application.</p><p>In this step, i will do the steps below :</p><p>Setup server for jenkins in google cloud platform</p><p>Setup kubernetes in google kubernetes engine</p><p>Let’s do this</p><p>In the first step, i create the server on google cloud platform with the details below</p><p>After login to my console, i choosed “Compute Engine” and “VM Instances”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/372/1*3kCAx8lrvyXyknxGa4xOrQ.png" /></figure><p>Next, i clicked “Create”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l-Ajb1JBSNlzH1Py90LtIQ.png" /></figure><p>Next, I filled out the form that appears on the screen based on my need</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*WMRXk_-KNd8OMGylUeKNGg.png" /></figure><p>Then, i choosed Centos 8 as the operating system for the jenkins server</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pj5IW-O7_Zcksw1jXbdcMQ.png" /></figure><p>Next, in “Access Scope” i choosed “Allow full access to all Cloud APIs” in order to access All Cloud APIs from the jenkins server. In my case, i choosed this to run “kubectl” in kubernetes machine from the jenkins server</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pj5IW-O7_Zcksw1jXbdcMQ.png" /></figure><p>Next, i clicked “Management, security, disks, networking, sole tenancy” and choosed “Networking”. In “Networking” section, i filled out “Network Tags” with “jenkins”. I filled out the form with “jenkins” tag so that the firewall that I will create later can be implemented in instances with the “Jenkins” tags.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*6PqwxhFB2wSWH0wTupYu-A.png" /></figure><p>Now, click “Create”</p><p>This is the result after i completed the steps above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*REiJ1Z27AZZdq_l_mFUBwA.png" /></figure><p>Now, i configured the firewall for the jenkins server. I choose “VPC Network” in “Networking” and choosed “Firewall” from the console</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*Os792D-C-3iQoRraJXZMdg.png" /></figure><p>Next, i clicked “Create Firewall Rule”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*4Fy0UvjtYMcibgrP-Me8lQ.png" /></figure><p>Then i filled out the form that appear in the screen</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*19CqjgDqHUfZMAsCo0iihw.png" /></figure><p>In the “Target tags”, i typed “jenkins” to implement this rule into the jenkins server and source ip ranges with “0.0.0.0/0” so i can access the server from anywhere</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*gsk_7p9uiFexkhoanOG1PQ.png" /></figure><p>Then i ticked the “tcp” and typed “8080” because this the default of jenkins port that i want to access</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*d3WoaBCW9dbtiNuNRgpPUg.png" /></figure><p>Now, i back to my instance and choose “SSH” to connect to my jenkins server</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*TsnUoF2fYtN7C7UudSR2qQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*Z9H-sjMuzgumE2YTjeXUsA.png" /></figure><p>Next, i run the script below with user root</p><pre>yum install wget -y<br>wget -O /etc/yum.repos.d/jenkins.repo \<br>    https://pkg.jenkins.io/redhat-stable/jenkins.repo<br>rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key<br>yum upgrade<br>yum install jenkins java-1.8.0-openjdk -y<br>systemctl enable jenkins<br>systemctl start jenkins</pre><p>Next, after finish the installation of jenkins, i accessed my server from the browser with <a href="http://ip-address:8080/">http://ip-address:8080</a> and setup the jenkins after installed jenkins in the server</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GZYc0RtElFvAzXvja5ZnnA.png" /></figure><p>To get the password, type “cat /var/lib/jenkins/secrets/initialAdminPassword” and copy the result. Then paste into form and click “Continue”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*duPdI0nVyREA2bbCWOr7gA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*j4H5O62QTTQqGUo00SSA3w.png" /></figure><p>Next, i clicked “Install suggested plugins”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*8J-Rw4ED1t7fDhHR0Hofvg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*WZmCAXUeXn4WsTCSZPO5YA.png" /></figure><p>After completed this step, i filled out the form and choose “Save and Continue”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*sBvsBkH7XtviydtpCoWrfg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*1co75udYlEUp3dBobP3uYQ.png" /></figure><p>Now, i clicked “Save and Finish” and “Start Using Jenkins”</p><p>All the steps for setup the jenkins server is done. Now, it’s time to setup the kubernetes machines with google kubernetes engine.</p><p>First, i choosed “Kubernetes Engine” and “Clusters”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rHud_lY5NM3f7F39y6dIGw.png" /></figure><p>Then, i choosed “Create cluster”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y4zo1f9h9LfQM9u0ZWA8Kw.png" /></figure><p>Then, i need to setup some configuration so i choosed “Nodes” in “default-pool”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q28tX8Gc88-22O6ua7S5Hw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jsOWt-VAj5ofinkKoKHgAQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*LtkhUZdX5deMQ-cSpe65KQ.png" /></figure><p>Now, i choosed “Security” and ticked “Allow full access to all Cloud APIs” in order to access All Cloud APIs from the kubernetes machines</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/1*HZ8lsJRDLTuS8iNNzcCD9w.png" /></figure><p>Then i choosed “asia-southeast-2” for the “Location Type”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1019/1*YN1UjNhVBozE4z2gTTmwoQ.png" /></figure><p>Then i clicked “Create”. And this is the result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i5MZRYgW-c1bCwyE6DLzEA.png" /></figure><p>This is all the steps that I did for this section. I will continue in the second article about simple deployment from Jenkins to GKE</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7f5b6564a3b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simple CI / CD With Gitlab-CI]]></title>
            <link>https://medium.com/@falgifaisal/simple-ci-cd-with-gitlab-ci-e423628d174e?source=rss-1bca30b54b44------2</link>
            <guid isPermaLink="false">https://medium.com/p/e423628d174e</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[gitlab-ci]]></category>
            <category><![CDATA[aws-ec2]]></category>
            <dc:creator><![CDATA[Falgi Faisal]]></dc:creator>
            <pubDate>Wed, 13 May 2020 09:12:41 GMT</pubDate>
            <atom:updated>2020-05-13T09:13:02.625Z</atom:updated>
            <content:encoded><![CDATA[<p>This is just a simple tutorial about how i implement ci / cd with gitlab-ci to aws ec2. And forgive me for my english :)</p><p>Please note that this can be different with your need so you might adjust it for your application.</p><p>I assume that you have logged in to your gitlab’s account</p><p>First, you can click “Settings” in the menu and choose “CI / CD”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yO61o_hfIRQPyIKHFNW5vA.png" /></figure><p>After do the first step,click “Expand” in the “Variable” section</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fGBI0cMUFO8dhJJpcGhmeg.png" /></figure><p>After that, fill the variable according to your needs. In my case, i fill the form with ip of the staging’s server and the pem key of the staging’s server<br>So, let’s click the “Add Variable” button</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W4qe9-lYKOICFCZuBsri-g.png" /></figure><p>After that, fill the form based on your need. In my case, i fill the form with my staging’s server ip and the pem key</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FNCYACx268Q0Ma6YVjUAHw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-DKl82l6pk9joEZXA6nK0g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FmgBgZPVFtL_hMuqeakmiA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ra3205p7ii8UD01HK5JvZg.png" /></figure><p>After that, click the “Hide Values” to hide the value that you just fill</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wd5pMF05e7UUdbgbt11ARg.png" /></figure><p>Now, after do all of this steps, now point your mouse to “Repository” menu and choose “Files”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6nfBs-iX700Igp95F5TYcA.png" /></figure><p>Now, point your mouse to “+” and choose “New File</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MlOQixwtPN87EoKJMAUbFA.png" /></figure><p>Now, in the “File Name” section, type “.gitlab-ci.yml” to create .gitlab-ci.yml file in order to run the ci / cd process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*valF3vLETABLUBwceN4YxQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9JKZPUMikFC0Q58io-HXOA.png" /></figure><p>Here is the code in the picture</p><pre>compile_staging:<br>  stage: deploy<br>  image: kroniak/ssh-client<br>  script:<br>    - mkdir -p ~/.ssh<br>    - chmod 700 ~/.ssh<br>    - echo -e &quot;Host *\n\tStrictHostKeyChecking no\n\n&quot; &gt; ~/.ssh/config<br>    - echo &quot;$PRIVATE_KEY_STAGING&quot; &gt; ~/.ssh/id_rsa<br>    - chmod 600 ~/.ssh/id_rsa<br>    - ssh -p22 ec2-user@$SERVER_STAGING &quot;uname -a&quot;</pre><p>In this code, i do the command “uname -a” in the server every time i push the code into my repository. So, if your need for your application is just do the command “git pull origin master” so you can replace “uname -a” with “git pull origin master” or another command according to your need.<br>Now, click “Commit changes” to save your file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J9ZDxRqWxFtJ_uVbbqRjDw.png" /></figure><p>This is the result after i click the “Commit changes” button</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VDzc5G9M6wl_q4b2pAfxwA.png" /></figure><p>Now, to check whether our ci / cd is run or no, point the mouse into “CI / CD” menu and choose “Pipelines”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZnVF7F0DFVkBUO_N1MeJFA.png" /></figure><p>If the status is “passed”, we can find the detail by click the ID of the pipeline. In my case, i click the ID “<a href="https://gitlab.com/falgifaisal/latihan/pipelines/145488501">#145488501</a>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PgSM5Vw0e-iRUeRaaYdLVQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2feNzsxlkhM2plM8XdXwGg.png" /></figure><p>And then click the job, in my case the job’s name is “compile_staging”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DQntrpK3sb0cmul6d_Opvw.png" /></figure><p>And this is the result, I crop the image so that it only shows the results</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*x2hqeqngZ7Rp6T3b5-CbNw.png" /></figure><p>That’s all the steps i did to create a Simple CI / CD With Gitlab-CI.<br>You can modify the .gitlab-ci.yml accordings to your need like pull the code from the repo and then restart the application. Just change this in your .gitlab-ci.yml</p><p>If you have a question, please comment this.</p><p>Thank you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e423628d174e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>