<?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 Jimmy Adaro on Medium]]></title>
        <description><![CDATA[Stories by Jimmy Adaro on Medium]]></description>
        <link>https://medium.com/@jimmyadaro?source=rss-28ce6d66b33b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*LaTD9opE2DUDqfzPhBtH4w.jpeg</url>
            <title>Stories by Jimmy Adaro on Medium</title>
            <link>https://medium.com/@jimmyadaro?source=rss-28ce6d66b33b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 13:18:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jimmyadaro/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[2300+ Free online courses (2020)]]></title>
            <link>https://jimmyadaro.medium.com/2300-free-online-courses-2020-ff570f926f70?source=rss-28ce6d66b33b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff570f926f70</guid>
            <category><![CDATA[education]]></category>
            <category><![CDATA[free]]></category>
            <category><![CDATA[online]]></category>
            <category><![CDATA[course]]></category>
            <category><![CDATA[online-learning]]></category>
            <dc:creator><![CDATA[Jimmy Adaro]]></dc:creator>
            <pubDate>Fri, 27 Mar 2020 20:30:57 GMT</pubDate>
            <atom:updated>2020-10-29T14:08:45.052Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Woman about to write on a paper notebook" src="https://cdn-images-1.medium.com/max/1024/1*F8taGRvMdRV-bMuYIVGLkA.jpeg" /><figcaption>Tirachard Kumtanom, <a href="https://www.pexels.com/photo/blur-close-up-focus-gadget-574285/">Pexels</a></figcaption></figure><p>With so many cities on quarantine or lockdown because the <a href="https://www.who.int/emergencies/diseases/novel-coronavirus-2019">COVID-19</a> (Coronavirus) 😷 has hit <em>so</em> bad in 2020 world-wide, many of us are using our <strong>new free time</strong> –previously wasted on commuting to work or meetings that could’ve been an email– to <strong>improve or learn new skills</strong>, so I’ve gone through a couple <strong>free online courses</strong> websites and hand-picked <em>some</em> links for this post, this way we all can gain some knowledge without expending <em>a single dollar</em> 💸</p><blockquote>Please note that while some sites may offer the same content in other languages, all the courses are mainly available in English.</blockquote><p>In this post you’ll get links for free content and training on topics such as:</p><ul><li>Business Management</li><li>Programming</li><li>Artificial Intelligence</li><li>Data Science</li><li>Autonomous Systems</li><li>Economics &amp; Finance</li><li>Career Advancement</li><li>Graphic Design</li><li>Music</li><li>Illustration</li><li>UX/UI Design</li><li>Marketing</li><li>Productivity</li></ul><p>… and many more, so let’s get started!</p><blockquote>Last update: March 27, 2020</blockquote><h3>Table of contents:</h3><ol><li>Udacity</li><li>Skillshare</li><li>Coursera</li><li>Harvard Online</li><li>edX</li></ol><h3>Udacity</h3><p>Udacity offers <strong>more than 190 free courses</strong> on business, programming, computer science, web development, autonomous systems, A.I. and data science. <a href="https://www.udacity.com/courses/all"><strong>Here</strong></a><strong> are all of them</strong>, don’t forget to filter by “<em>Free courses</em>”.</p><p>I’ll share some links here:</p><p><strong>Programming:</strong> <a href="https://www.udacity.com/course/intro-to-html-and-css--ud001">Intro To HTML And CSS</a></p><p><strong>Programming:</strong> <a href="https://www.udacity.com/course/high-performance-computer-architecture--ud007">High Performance Computer Architecture</a></p><p><strong>Programming:</strong> Firebase In A Weekend (<a href="https://www.udacity.com/course/firebase-in-a-weekend-by-google-ios--ud0351">iOS</a>, <a href="https://www.udacity.com/course/firebase-in-a-weekend-by-google-android--ud0352">Android</a>)</p><p><strong>Business:</strong> <a href="https://www.udacity.com/course/how-to-build-a-startup--ep245">How To Build A Startup</a></p><p><strong>Business: </strong><a href="https://www.udacity.com/course/managing-remote-teams-with-upwork--ud942">Managing Remote Teams</a></p><p><strong>Business:</strong> <a href="https://www.udacity.com/course/product-design--ud509">Product Design</a></p><p><strong>Autonomous Systems:</strong> <a href="https://www.udacity.com/course/self-driving-car-fundamentals-featuring-apollo--ud0419">Self-Driving Fundamentals</a></p><p><strong>A.I:</strong> <a href="https://www.udacity.com/course/intro-to-artificial-intelligence--cs271">Intro To Artificial Intelligence</a></p><p><strong>A.I:</strong> <a href="https://www.udacity.com/course/machine-learning--ud262">Machine Learning</a></p><p><strong>A.I:</strong> <a href="https://www.udacity.com/course/machine-learning-for-trading--ud501">Machine Learning For Trading</a></p><p><strong>Data Science:</strong> <a href="https://www.udacity.com/course/intro-to-data-science--ud359">Intro To Data Science</a></p><p><strong>Data Science: </strong><a href="https://www.udacity.com/course/intro-to-data-analysis--ud170">Intro To Data Analysis</a></p><h3>Skillshare</h3><p>Skillshare offers <strong>hundreds of free courses</strong> on animation, illustration, film &amp; video, music, photography, UX/UI design, marketing and many other topics. <a href="https://www.skillshare.com/browse?enrollmentType=free&amp;seeAll=1"><strong>Here</strong></a><strong> are all of them</strong>, it’s already filtered by free content 😁</p><p>Here are some cool classes:</p><p><strong>Entrepreneurship/Marketing:</strong> <a href="https://www.skillshare.com/classes/Introduction-to-Social-Media-Advertising-Learn-with-Buffer/1063310630">Introduction to Social Media Advertising</a></p><p><strong>Entrepreneurship/Marketing</strong>: <a href="https://www.skillshare.com/classes/Content-Marketing-Create-a-One-Minute-Video/1598567171">Content Marketing: Create a One-Minute Video</a></p><p><strong>Entrepreneurship/Product Design</strong>: <a href="https://www.skillshare.com/classes/Brand-an-Online-Shop-Create-a-Cohesive-Product-Line/126331648">Brand an Online Shop: Create a Cohesive Product Line</a></p><p><strong>Animation:</strong> <a href="https://www.skillshare.com/classes/How-to-Make-Dope-Animated-Loops-Vol-2/956064988">How to Make Dope Animated Loops Vol 2</a></p><p><strong>Business Development:</strong> <a href="https://www.skillshare.com/classes/Learn-to-Use-Canva-The-Easy-Effective-Design-Solution-for-Non-Designers/101522117?via=browse-trending-all-layout-grid">Learn to Use Canva: The Easy, Effective Design Solution for Non-Designers</a></p><p><strong>Productivity/Graphic Design:</strong> <a href="https://www.skillshare.com/classes/Photoshop-CC-2020-Productivity-Techniques/144789829">Photoshop CC 2020 Productivity Techniques</a></p><p><strong>Marketing:</strong> <a href="https://www.skillshare.com/classes/Amazon-Affiliate-Marketing-Blueprint-For-Beginners/423779954">Amazon Affiliate Marketing — Blueprint For Beginners</a></p><p><strong>Marketing:</strong> <a href="https://www.skillshare.com/classes/Instagram-for-Business-Build-an-Engaged-Community-Learn-with-Iconosquare/1154735260">Instagram for Business: Build an Engaged Community</a></p><p><strong>Graphic Design:</strong> <a href="https://www.skillshare.com/classes/Graphic-Design-Basics-Core-Principles-for-Visual-Design/1539782161">Graphic Design Basics: Core Principles for Visual Design</a></p><p><strong>Film &amp; Video:</strong> <a href="https://www.skillshare.com/classes/Premiere-Pro-CC-Basics-In-40-Mins-Free-For-Beginners-Crash-Course/1924116627?via=browse-trending-all-layout-grid">Premiere Pro CC Basics In 40 Mins</a></p><h3>Coursera</h3><p>Coursera offers <strong>more than 1800 free courses</strong> on programming, computer science, communication, algorithms, finance, leadership, markets and many other topics. It offers <strong>Professional Certificates</strong> by Google, IBM, UCI (University of California, Irvine), University of Pennsylvania, University of Michigan and other renowned institutions. <a href="https://www.coursera.org/search?query=free&amp;indices%5Bprod_all_products_term_optimization%5D%5BrefinementList%5D%5BallLanguages%5D%5B0%5D=English&amp;indices%5Bprod_all_products_term_optimization%5D%5Bpage%5D=1&amp;indices%5Bprod_all_products_term_optimization%5D%5Bconfigure%5D%5BclickAnalytics%5D=true&amp;indices%5Bprod_all_products_term_optimization%5D%5Bconfigure%5D%5BruleContexts%5D%5B0%5D=en&amp;indices%5Bprod_all_products_term_optimization%5D%5Bconfigure%5D%5BhitsPerPage%5D=10&amp;configure%5BclickAnalytics%5D=true"><strong>Here</strong></a><strong> are all of them</strong>, also filtered by free content 👌</p><p><strong>Data Science:</strong> <a href="https://www.coursera.org/learn/machine-learning">Machine Learning</a></p><p><strong>Data Analysis:</strong> <a href="https://www.coursera.org/professional-certificates/ibm-data-science">IBM Data Science Professional Certificate</a></p><p><strong>Business Essentials:</strong> <a href="https://www.coursera.org/learn/negotiation-skills">Successful Negotiation: Essential Strategies and Skills</a></p><p><strong>Software Development:</strong> <a href="https://www.coursera.org/learn/python-basics">Python Basics</a></p><p><strong>Marketing:</strong> <a href="https://www.coursera.org/specializations/social-media-marketing">Social Media Marketing Specialization</a></p><p><strong>Business Strategy:</strong> <a href="https://www.coursera.org/learn/ai-for-everyone">AI For Everyone</a></p><p><strong>Mobile and Web Development:</strong> <a href="https://www.coursera.org/learn/android-app">Build Your First Android App (Project-Centered Course)</a></p><p><strong>Arts and Humanities:</strong> <a href="https://www.coursera.org/learn/modern-art-ideas">Modern Art &amp; Ideas</a></p><h3>Harvard Online</h3><p>The Harvard University, founded in 1636, offers <strong>50+ free courses</strong> on programming, business, health &amp; medicine, art &amp; design, humanities, social sciences, science, computer science, data science and mathematics. <a href="https://online-learning.harvard.edu/catalog?keywords=&amp;paid%5B1%5D=1&amp;max_price=&amp;start_date_range%5Bmin%5D%5Bdate%5D=&amp;start_date_range%5Bmax%5D%5Bdate%5D=&amp;page=3"><strong>Here</strong></a><strong> are all of them</strong>, obviously filtered by free courses 😊</p><p><strong>Programming:</strong> <a href="https://online-learning.harvard.edu/course/cs50s-web-programming-python-and-javascript">CS50’s Web Programming with Python and JavaScript</a></p><p><strong>Art &amp; Design:</strong> <a href="https://online-learning.harvard.edu/course/18th-century-opera-handel-mozart">18th-Century Opera: Handel &amp; Mozart</a></p><p><strong>Humanities:</strong> <a href="https://online-learning.harvard.edu/course/china-part-9-communist-liberations">China and Communism</a></p><p><strong>Art &amp; Design:</strong> <a href="https://online-learning.harvard.edu/course/pyramids-giza-ancient-egyptian-art-and-archaeology">Pyramids of Giza: Ancient Egyptian Art and Archaeology</a></p><p><strong>Health &amp; Medicine:</strong> <a href="https://online-learning.harvard.edu/course/humanitarian-response-conflict-and-disaster">Humanitarian Response to Conflict and Disaster</a></p><p><strong>Computer Science:</strong> <a href="https://online-learning.harvard.edu/course/cs50-lawyers">CS50 for Lawyers</a></p><p><strong>Computer Science:</strong> <a href="https://online-learning.harvard.edu/course/using-python-research">Using Python for Research</a></p><p><strong>Computer Science:</strong> <a href="https://online-learning.harvard.edu/course/quantitative-methods-biology">Quantitative Methods for Biology</a></p><p><strong>Science:</strong> Fundamentals of Neuroscience: <a href="https://online-learning.harvard.edu/course/fundamentals-neuroscience-part-1-electrical-properties-neuron">part 1</a>, <a href="https://online-learning.harvard.edu/course/fundamentals-neuroscience-part-2-neurons-and-networks">part 2</a>, <a href="https://online-learning.harvard.edu/course/fundamentals-neuroscience-part-3-brain">part 3</a></p><p><strong>Science:</strong> <a href="https://online-learning.harvard.edu/course/energy-within-environmental-constraints">Energy Within Environmental Constraints</a></p><p><strong>Mathematics:</strong> <a href="https://online-learning.harvard.edu/course/fat-chance-probability-ground">Fat Chance: Probability from the Ground Up</a></p><h3>edX</h3><p>Founded by Harvard and the M.I.T, “edX is home to more than 20 million learners, the majority of top-ranked universities in the world and industry-leading companies”. It currently has <strong>over 270 free courses</strong>. <a href="https://www.edx.org/course?search_query=free"><strong>Here</strong></a><strong> are all of them</strong>, definitely filtered by free courses 😜</p><p><strong>Data Analysis:</strong> <a href="https://www.edx.org/course/statistical-learning">Statistical Learning</a></p><p><strong>Data Analysis:</strong> <a href="https://www.edx.org/course/visualizing-data-with-python">Visualizing Data with Python</a></p><p><strong>Computer Science:</strong> <a href="https://www.edx.org/course/hacking-postgresql-data-access-methods">Hacking PostgreSQL: Data Access Methods</a></p><p><strong>Computer Science:</strong> <a href="https://www.edx.org/course/introduction-to-artificial-intelligence-ai-2">Introduction to Artificial Intelligence</a> (by Microsoft)</p><p><strong>Science:</strong> <a href="https://www.edx.org/course/nuclear-energy-science-systems-and-society">Nuclear Energy: Science, Systems and Society</a></p><p><strong>Economics &amp; Finance:</strong> <a href="https://www.edx.org/course/cost-of-capital">Cost of Capital</a></p><p><strong>Economics &amp; Finance: </strong><a href="https://www.edx.org/course/fundamentals-of-market-structure">Fundamentals of Market Structure</a></p><p><strong>Economics &amp; Finance:</strong> <a href="https://www.edx.org/course/cash-flow-analysis">Cash Flow Analysis</a></p><p><strong>Communication: </strong><a href="https://www.edx.org/course/business-communication">Business Communication</a></p><p><strong>Communication:</strong> <a href="https://www.edx.org/course/public-speaking">Public Speaking</a></p><p><strong>Communication:</strong> <a href="https://www.edx.org/course/critical-thinking-problem-solving-2">Critical Thinking &amp; Problem-Solving</a></p><p><strong>Communication/Languages:</strong> <a href="https://www.edx.org/course/toefl-test-preparation-the-insiders-guide">TOEFL® Test Preparation: The Insider’s Guide</a></p><p><strong>Electronics:</strong> Circuits and Electronics: <a href="https://www.edx.org/course/circuits-and-electronics-1-basic-circuit-analysis">part 1</a>, <a href="https://www.edx.org/course/circuits-and-electronics-2-amplification-speed-a-2">part 2</a>,<a href="https://www.edx.org/course/circuits-and-electronics-3-applications"> part 3</a></p><p><strong>Physics:</strong> <a href="https://www.edx.org/course/astrophysics-exploring-exoplanets">Astrophysics: Exploring Exoplanets</a></p><h3>So far so good, right?</h3><p>You’re invited to add more platforms and links in the comments! 🎉</p><h4>Thanks for passing by, don’t forget to clap on Medium and share this post anywhere if you liked it :)</h4><blockquote><strong>Note:</strong> The platforms mentioned in this post are not obligated by any mean to offer these courses. All trademarked company and product names mentioned in this post are the property of their respective owners.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff570f926f70" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a CI/CD Pipeline with Docker and GitLab]]></title>
            <link>https://jimmyadaro.medium.com/build-a-ci-cd-pipeline-with-docker-and-gitlab-f351585a5c83?source=rss-28ce6d66b33b------2</link>
            <guid isPermaLink="false">https://medium.com/p/f351585a5c83</guid>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[continuous-delivery]]></category>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Jimmy Adaro]]></dc:creator>
            <pubDate>Mon, 27 Aug 2018 11:52:31 GMT</pubDate>
            <atom:updated>2018-08-28T02:06:59.425Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NayJh0jm6OehIzdCvzvOvg.png" /><figcaption>Deploy is easier than ever!</figcaption></figure><p>Continuous Integration and Continuous Delivery are not new things this days. This practice can help to make your product or project be <strong>up and running the last version of your code faster and easier than ever</strong>. Today I will show you my way to create a pipeline using a custom Docker image and GitLab CI/CD tools to deploy to a VPS/KVM Linux server.</p><h3>Requirements:</h3><ul><li>Basic understanding of Linux, Docker and CI/CD.</li><li><a href="https://gitlab.com/">GitLab</a> account (free plan is okay).</li><li>Linux server with SSH access (root user is not required). I’ll be using Ubuntu 16.04 LTS with <a href="https://en.wikipedia.org/wiki/LAMP_(software_bundle)">LAMP stack</a>.</li><li>Lightweight Docker image with SSH and <a href="https://lftp.yar.ru/">LFTP</a>.</li></ul><p>Before continue, make sure you are logged-in into your GitLab account, you are owner of a project/repository <em>and</em> you have access to that repo in your local computer through Git, you must to be able to pull and push. I use <a href="https://www.gitkraken.com/">GitKraken</a> (Git GUI) to make it even easier.</p><h3>About GitLab’s CI/CD</h3><p>GitLab offers a simple way to handle CI/CD pipelines using Docker and shared runners. Every time you run your pipeline GitLab will create an <strong>isolated virtual machine</strong> and build a Docker image, which you can setup using a YAML configuration file. Those pipelines can have multiple jobs, but more jobs means more build time and we don’t want that, right? You can have <strong>up to 2000 build minutes per month</strong> using the free plan.</p><blockquote>“<a href="https://about.gitlab.com/gitlab-com/settings/#shared-runners">Shared Runners on GitLab.com</a> run in <a href="https://docs.gitlab.com/runner/configuration/autoscale.html">autoscale mode</a> and are powered by DigitalOcean. Autoscaling means reduced wait times to spin up builds, and isolated VMs for each project, thus maximizing security.”</blockquote><blockquote>– GitLab Docs</blockquote><h3>Create SSH key for GitLab’s runner</h3><p><strong><em>Note:</em></strong><em> Even if you already have SSH access to your server, I recommend to create a new pair just for CI/CD, as well as a new non-root user for deploys.</em></p><p>We’ll connect to our server using SSH in Docker, this means we cannot type our user’s password (a.k.a. <em>non-interactive login</em>), so we need create a <strong>passwordless SSH key pair</strong> in our local computer. I usually create <strong>RSA keys with 2048 bits</strong>, which is secure enough.</p><pre>$ ssh-keygen rsa -b 2048</pre><p>Follow the creation steps — if any doubts, man ssh-keygen— and remember to <strong>not set a password for that key pair</strong>. After that, we have to import the private key into our server:</p><pre>$ ssh-copy-id -i /path/to/key user@host</pre><p>Now you can try to connect using:</p><pre>$ ssh -i /path/to/key user@host</pre><p>It should not ask for password. We’ll use the private key later.</p><h3>Select the Dockerfile</h3><p>I am using Docker Hub to host my custom Dockerfile, which is <strong>a lightweight (~8 Mb) </strong><a href="https://alpinelinux.org/"><strong>Alpine</strong></a><strong>-based container</strong> with OpenSSH and LFTP installed. We need this image to make GitLab’s CI/CD run our jobs and scripts, and less weight means less pulling/download time. You can host your own image or check the one that I use <a href="https://hub.docker.com/r/jimmyadaro/gitlab-ci-cd/">right here</a>.</p><h3>Pipeline configuration</h3><p>You’ll need to create a “<em>.gitlab-ci.yml” </em>file in your repo’s root directory. I’m gonna paste and explain my configuration here, you can have a further read about this configuration file and all available options in <a href="https://docs.gitlab.com/ce/ci/yaml/">this link</a>.</p><p><strong>My config file looks like this:</strong></p><pre>image: jimmyadaro/gitlab-ci-cd:latest</pre><pre>Deploy:<br> stage: deploy<br> only:<br> — ‘master’<br> when: manual<br> allow_failure: false<br> before_script:<br> #Create .ssh directory<br> — mkdir -p ~/.ssh<br> #Save the SSH private key<br> — echo “$SSH_PRIVATE_KEY” &gt; ~/.ssh/id_rsa<br> — chmod 700 ~/.ssh<br> — chmod 600 ~/.ssh/id_rsa<br> — eval $(ssh-agent -s)<br> — ssh-add ~/.ssh/id_rsa<br> script:<br> #Backup everything in /var/www/html/<br> — ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa $USERNAME@$HOST “zip -q -r /var/backups/www/01-Deploy-$(date +%F_%H-%M-%S).zip /var/www/html/”<br> #Deploy new files to /var/www/html<br> — lftp -d -u $USERNAME, -e ‘set sftp:auto-confirm true; set sftp:connect-program “ssh -a -x -i ~/.ssh/id_rsa”; mirror -Rnev ./ /var/www/html — ignore-time — exclude-glob .git* — exclude .git/; exit’ sftp://$HOST<br> — rm -f ~/.ssh/id_rsa<br> — ‘echo Deploy done: $(date “+%F %H:%M:%S”)’</pre><p><strong>Let’s review each line</strong> so we can understand what is going on here.</p><pre>image: jimmyadaro/gitlab-ci-cd:latest</pre><p>This says to the runner “pull and run this container’s last version from the Docker Hub”. Here you can set any image you want to use, but <strong>don’t forget we need SSH and LFTP</strong>.</p><pre>Deploy:</pre><p>This is the pipeline job name, you need to set this for create a job.</p><pre>stage: deploy</pre><p>This is the job’s stage name, which can help you to identify your current pipeline status since you can have multiple stages, such as “backup”, “build”, “deploy”, etc. I’ll use <strong>one job with one stage</strong> since I don’t really need any other stage. Both job name and stage name are totally customizable, you can use “<em>ASDF</em>” as job name and “<em>GHJK</em>” as stage name, but you may like to identify the stages during the pipeline execution so I suggest to normalize those names.</p><pre>only:<br> — ‘master’</pre><p>This indicates the pipeline to trigger <em>only</em> when your repo’s masterbranch receives an update (such a git merge). The pipeline can also be triggered by changes on tags or even via webhooks. I recommend to work on any other branch (development, wip, whatever you like) and keep master as “production branch” since any changes will trigger the pipeline.</p><pre>when: manual</pre><p>This means you need to go into your project’s CI/CD configuration in order to <strong>manually make the whole deploy thing start</strong>. You can skip this, I just prefer to trigger this pipeline by hand. I you remove this line, any changes on your selected branch or tag files will run the pipeline.</p><pre>allow_failure: false</pre><p>This means that, if you have any other stage on your pipeline, <strong>having a failure in this job won’t allow the remaining jobs execution</strong>, so everything will just stop. This is optional too.</p><pre>before_script:<br> #Create .ssh directory<br> — mkdir -p ~/.ssh<br> #Save the SSH private key<br> — echo “$SSH_PRIVATE_KEY” &gt; ~/.ssh/id_rsa<br> — chmod 700 ~/.ssh<br> — chmod 600 ~/.ssh/id_rsa<br> — eval $(ssh-agent -s)<br> — ssh-add ~/.ssh/id_rsa</pre><p>The before_script block will run the specified commands in your container <em>before</em> start executing the main (deploy) script. As you can see, <strong>each shell command is specified using a dash per line</strong>. This block will save our SSH private key in the container’s default SSH path so we can connect to our server using <strong>passwordless authentication</strong>.</p><p>This private key is stored as a <strong>protected variable</strong> in my project CI/CD configuration — currently under <em>Settings &gt; CI/CD &gt; Variables</em> on GitLab’s web UI. I do also have my server host and deploy username (non-root user) in variables to use them later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/985/1*yNh2klaSCrgRB3o3-fxcLg.png" /><figcaption>Settings UI for GitLab’s CI/CD Variables</figcaption></figure><pre>script:<br> #Backup everything in /var/www/html/<br> — ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa $USERNAME@$HOST “zip -q -r /var/backups/www/01-Deploy-$(date +%F_%H-%M-%S).zip /var/www/html/”<br> #Deploy new files to /var/www/html<br> — lftp -d -u $USERNAME, -e ‘set sftp:auto-confirm true; set sftp:connect-program “ssh -a -x -i ~/.ssh/id_rsa”; mirror -Rnev ./ /var/www/html — ignore-time — exclude-glob .git* — exclude .git/; exit’ sftp://$HOST<br> — rm -f ~/.ssh/id_rsa<br> — ‘echo Deploy done: $(date “+%F %H:%M:%S”)’</pre><p><strong>The block above is the main script</strong> that GL’s runner will be executing. First I connect to my server and backup everything in a ZIP file* with the current date formatted as yyyy-mm-dd_hh-mm-ssas filename:</p><pre>— ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa $USERNAME@$HOST “zip -q -r /var/backups/www/01-Deploy-$(date +%F_%H-%M-%S).zip /var/www/html/”</pre><p><em>*You may need to install ZIP CLI in your server.</em></p><p>After that backup under /var/www/html, <strong>LFTP connects to my server and uploads the new repo files</strong> — here I use SFTP, the FTP configuration may be different:</p><pre>— lftp -d -u $USERNAME, -e ‘set sftp:auto-confirm true; set sftp:connect-program “ssh -a -x -i ~/.ssh/id_rsa”; mirror -Rnev ./ /var/www/html — ignore-time — exclude-glob .git* — exclude .git/; exit’ sftp://$HOST</pre><p>Using mirror -Rnev ./ /var/www/htmltells LFTP to upload all files under ./(the repo root directory) to our remote path (var/www/htmlin my server). The options mean:</p><ul><li>-u sets the SSH username to our sftp://$HOST.</li><li>-e for execute a command (the one we set on simple quotes).</li><li>-R for <em>reverse mirror</em> (upload).</li><li>-n for only newer files.</li><li>-e will delete the files not present in our source**.</li><li>-v , as usual, for verbose log.</li><li>ignore-time will <em>ignore time when deciding whether to download</em>.</li><li>exclude-glob .git* will exclude .git* files (such as .gitignore and .gitkeep) from any directory. You can add other file extensions or file names there.</li><li>exclude .git/ will help us to be sure we don’t upload our git file.</li><li>exit will stop LFTP and SSH execution.</li></ul><p><em>**The files present on our server that are not in the repository will be deleted from the server. Remember the source is our GitLab’s repository.</em></p><p>Finally, the script removes the private key from the shared runner’s container (just a security step) and echoes a plain text string with the current date:</p><pre>— rm -f ~/.ssh/id_rsa<br> — ‘echo Deploy done: $(date “+%F %H:%M:%S”)’</pre><p>And that’s it! Now you have your new files up and running in your server.</p><p><strong>This is what a successful pipeline execution looks like in GitLab:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*yDWOod3H56uqtpxy9l6pVg.png" /><figcaption>Running Docker image</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*ahfkaSDxADdzOXG28JhYFQ.png" /><figcaption>Final pipeline status</figcaption></figure><h3>Conclusion</h3><p>I tried other approaches like using <em>rsync</em> instead of <em>LFTP</em>, jobs with multiple stages and artifacts and cache dependencies so I can reuse the SSH key, using Docker’s <em>ENTRYPOINT</em>s and <em>CMD</em>s… but this way seems like the faster and easier way to me.</p><p><strong>Thanks for reading!</strong> I would really appreciate spelling checks as private notes 😇</p><p>Any doubts or comments? Just write them down there! 👇</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f351585a5c83" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>