<?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: Shuaib</title>
    <description>The latest articles on DEV Community by Shuaib (@shuaib).</description>
    <link>https://dev.to/shuaib</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%2F749%2Fb_hBv7q4.jpeg</url>
      <title>DEV Community: Shuaib</title>
      <link>https://dev.to/shuaib</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shuaib"/>
    <language>en</language>
    <item>
      <title>Eliminate Clutter and Clean  HTML Fluff in Microsoft Word Generated HTML Documents, specifically for Emails</title>
      <dc:creator>Shuaib</dc:creator>
      <pubDate>Fri, 25 Jun 2021 01:20:23 +0000</pubDate>
      <link>https://dev.to/shuaib/eliminate-clutter-and-clean-html-fluff-in-microsoft-word-generated-html-documents-specifically-for-emails-3e6f</link>
      <guid>https://dev.to/shuaib/eliminate-clutter-and-clean-html-fluff-in-microsoft-word-generated-html-documents-specifically-for-emails-3e6f</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oRMXtJRZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2021/06/grid.layoutit.com_.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oRMXtJRZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2021/06/grid.layoutit.com_.png" alt="Eliminate Clutter and Clean HTML Fluff in Microsoft Word Generated HTML Documents, specifically for Emails"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This post is a distillation of lessons learned during reverse engineering an email template and making it somewhat editable. By the end of this post, you will learn how to tame a Microsoft Word-generated HTML template so that you can use it for your purposes.&lt;/p&gt;

&lt;p&gt;Perhaps you had created a Microsoft Word document and used the HTML code generated by it and lost the original Word document and want to make changes in pure HTML code. Or you are in an unfortunate position where you don't have access to the original Word document but need a cleaner version of HTML code. Or you just want pure clean HTML code because it is a matter of principle. Or it's just a fascinating intellectual exercise. You could also just be using Word to create simple web pages or landing pages but know that having a cleaner and more semantic version of your HTML code will help you rank better on search engines as well as reduce page loading times for your users. Whatever the reason, you want clean HTML.&lt;/p&gt;

&lt;p&gt;People at work asked me to automate an email that we need to send periodically. Of course, I said this won't be a problem, and it wasn't supposed to be. I asked them to provide an HTML of the email they'd like to send and I'll add some dynamic text and send it off.&lt;/p&gt;

&lt;p&gt;Turns out the task I thought would be the simplest wasn't that simple.&lt;/p&gt;

&lt;p&gt;The template I received was sent by email on Microsoft Outlook. There were some simple styling issues such as inconsistent fonts for some of the text which I thought would be a simple fix. When I viewed the source of the email, I was horrified to see it filled with junk I'm not usually used to. I attempted to employ some of my basic CSS skills to resolve these and thought I don't need to optimize the template as it's doing its job and no one is going to care about viewing the source as long as it renders beautifully. I didn't want spend time to manually handle CSS quirks since I'm not that great at CSS and I know I will get stuck in a back-and-forth loop of fixing minor quirks here and there which weren't that important.&lt;/p&gt;

&lt;p&gt;In the first iteration, I made some minor changes as used online tools like &lt;a href="https://html-cleaner.com/"&gt;https://html-cleaner.com/&lt;/a&gt; to clean up some of the mess, as long as the formatting still staying intact.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IG1chDWy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2021/06/html-cleaner.com_--2--2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IG1chDWy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2021/06/html-cleaner.com_--2--2.png" alt="Eliminate Clutter and Clean HTML Fluff in Microsoft Word Generated HTML Documents, specifically for Emails"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the second iteration, I attempted to redo the entire template by creating a CSS grid to ensure the right layout using &lt;a href="https://grid.layoutit.com/"&gt;https://grid.layoutit.com/&lt;/a&gt;. This wasn't too bad. I spent perhaps 20 minutes defining the grid. Considering I also learned this grid tool on the run, it was fairly quick.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lox5Krhl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2021/06/image-36.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lox5Krhl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2021/06/image-36.png" alt="Eliminate Clutter and Clean HTML Fluff in Microsoft Word Generated HTML Documents, specifically for Emails"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the HTML it created:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6DLLR7oM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2021/06/image-37.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6DLLR7oM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2021/06/image-37.png" alt="Eliminate Clutter and Clean HTML Fluff in Microsoft Word Generated HTML Documents, specifically for Emails"&gt;&lt;/a&gt;CSS Grid Layout HTML&lt;/p&gt;

&lt;p&gt;And this is the CSS that I was blessed with, good thing I don't have to spend too much brains on what's going on in here as long as it works.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--J5iRH2UA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2021/06/image-38.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--J5iRH2UA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2021/06/image-38.png" alt="Eliminate Clutter and Clean HTML Fluff in Microsoft Word Generated HTML Documents, specifically for Emails"&gt;&lt;/a&gt;CSS Grid Styles&lt;/p&gt;

&lt;p&gt;I then manually populated the template with my desired content and basic CSS styling and was able to create a modern well-formatted HTML email template from scratch that was I proud of.&lt;/p&gt;

&lt;p&gt;Until I tested sending an email with the template in Outlook. That's when I discovered that many email client software like Microsoft Outlook can't render modern CSS well. I spent a good few hours on this, but with no meaningful result.&lt;/p&gt;

&lt;p&gt;Back to the drawing board.&lt;/p&gt;

&lt;p&gt;Finally, I gave it another crack with HTML tidy. This is the tool the cleaned up the HTML well enough to maintain the semantic elements enough that a human can easily interpret them and make changes to the CSS. However, there is a trick to this that I will reveal shortly.&lt;/p&gt;

&lt;p&gt;If you're tech-savvy, you can download and install the tidy utility on Windows, Linux, or Mac. Or you can use an online version of the tool at &lt;a href="https://infohound.net/tidy/"&gt;https://infohound.net/tidy/&lt;/a&gt; (I've done both).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5pjRiUPG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2021/06/infohound.net_tidy_.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5pjRiUPG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2021/06/infohound.net_tidy_.png" alt="Eliminate Clutter and Clean HTML Fluff in Microsoft Word Generated HTML Documents, specifically for Emails"&gt;&lt;/a&gt;infohound.net/tidy&lt;/p&gt;

&lt;p&gt;Select the 'Word 2000' option and click Tidy!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tyP2fOPR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2021/06/infohound.net_tidy_tidy.pl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tyP2fOPR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2021/06/infohound.net_tidy_tidy.pl.png" alt="Eliminate Clutter and Clean HTML Fluff in Microsoft Word Generated HTML Documents, specifically for Emails"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You'll get this page that shows the warning as well as cleaned HTML. Copy and paste that into JSBin.com. jsbin.com is a free web-based editor to quickly make and preview changes you make to an HTML document.&lt;/p&gt;

&lt;p&gt;Just look at how clean that HTML is on the left and a clean version of it in the preview on the right.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jYZK8hUs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2021/06/image-40.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jYZK8hUs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2021/06/image-40.png" alt="Eliminate Clutter and Clean HTML Fluff in Microsoft Word Generated HTML Documents, specifically for Emails"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And this the clean HTML that was generated. How clean!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PymZ4LT6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2021/06/image-41.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PymZ4LT6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2021/06/image-41.png" alt="Eliminate Clutter and Clean HTML Fluff in Microsoft Word Generated HTML Documents, specifically for Emails"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But there is one problem that you may have noted. All the formatting is gone. Do you want to do all the formatting by hand? Well yes and no. There's no 100% automated way to do this that I know of, but you can get some of the styles back and then tweak them by hand.&lt;/p&gt;

&lt;p&gt;But this requires dealing with an issue with tidy. See when you run tidy with the &lt;code&gt;--clean y&lt;/code&gt; and &lt;code&gt;--word-2000 y&lt;/code&gt; options selected, there are CSS style rules generated that preserve some of the original formattings, but are not embedded in the document. I don't know why, I assume it's a bug.&lt;/p&gt;

&lt;p&gt;But if you first run the document with only the &lt;code&gt;--clean y&lt;/code&gt; option, you do get a CSS style tag as below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3sObS7Ct--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2021/06/image-42.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3sObS7Ct--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2021/06/image-42.png" alt="Eliminate Clutter and Clean HTML Fluff in Microsoft Word Generated HTML Documents, specifically for Emails"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you copy the CSS styles and then run it with the --word-2000 option. Then copy the styles generated the first time manually to your document, you'll get something better.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MPZQvsiy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2021/06/image-43.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MPZQvsiy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2021/06/image-43.png" alt="Eliminate Clutter and Clean HTML Fluff in Microsoft Word Generated HTML Documents, specifically for Emails"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You may not see it, but the footer text is bold. As I said it's not ideal, but with the additional CSS rules available you have a little more to start with. It didn't work entirely great in this fabricated example, but my original email worked fairly well with the background colors coming through. It's a hit and miss.&lt;/p&gt;

&lt;p&gt;If you like this sort of reverse engineering and would like to get updates on random interesting stuff I'm working on and what I'm learning along the way, give me a follow on Twitter &lt;a href="https://twitter.com/shuuabe"&gt;@shuuabe&lt;/a&gt;.🐤&lt;/p&gt;

</description>
      <category>journalentry</category>
      <category>web</category>
    </item>
    <item>
      <title>Setting up Cron jobs to run bash scripts</title>
      <dc:creator>Shuaib</dc:creator>
      <pubDate>Sun, 05 Apr 2020 16:04:14 +0000</pubDate>
      <link>https://dev.to/shuaib/setting-up-cron-jobs-to-run-bash-scripts-n5n</link>
      <guid>https://dev.to/shuaib/setting-up-cron-jobs-to-run-bash-scripts-n5n</guid>
      <description>&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%2Fimages.unsplash.com%2Fphoto-1548672150-6d77dcc2639d%3Fixlib%3Drb-1.2.1%26q%3D80%26fm%3Djpg%26crop%3Dentropy%26cs%3Dtinysrgb%26w%3D2000%26fit%3Dmax%26ixid%3DeyJhcHBfaWQiOjExNzczfQ" 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%2Fimages.unsplash.com%2Fphoto-1548672150-6d77dcc2639d%3Fixlib%3Drb-1.2.1%26q%3D80%26fm%3Djpg%26crop%3Dentropy%26cs%3Dtinysrgb%26w%3D2000%26fit%3Dmax%26ixid%3DeyJhcHBfaWQiOjExNzczfQ" alt="Setting up Cron jobs to run bash scripts"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The setup of cron jobs is fairly easy. However, I ran into problems running shell scripts using that create files as outputs. This post covers some of the gotchas to keep in mind.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to setup Cron jobs
&lt;/h3&gt;

&lt;p&gt;To setup a cronjob, you use a command called &lt;code&gt;crontab&lt;/code&gt;. If you execute &lt;code&gt;crontab -l&lt;/code&gt; you will see a list of currently installed cron jobs. Jobs are defined in a text file using crontab syntax that you can find or generate at &lt;a href="https://crontab-generator.org/" rel="noopener noreferrer"&gt;https://crontab-generator.org/&lt;/a&gt;. Each line is a job that will be executed. To add/modify/delete a job run &lt;code&gt;crontab -e&lt;/code&gt; and perform the deed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Running a job as a root user
&lt;/h3&gt;

&lt;p&gt;If you want to run a job as a root user, run &lt;code&gt;sudo crontab -e&lt;/code&gt; to define a job. Once you save the crontab file, you will see an output on the console saying &lt;code&gt;crontab: installing new crontab&lt;/code&gt; which confirms you newly defined changes have been configured.&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%2Fblog.shuaib.org%2Fcontent%2Fimages%2F2020%2F04%2Fimage-7.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%2Fblog.shuaib.org%2Fcontent%2Fimages%2F2020%2F04%2Fimage-7.png" alt="Setting up Cron jobs to run bash scripts"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Ensure you shell script is running with the right shell and environment variables
&lt;/h3&gt;

&lt;p&gt;When you normally run a shell script, it runs under the context of your user profile's shell settings. So it knows which shell executor to use, the programs that are available in your PATH environment variable etc. However, when you run the same script with crontab, you may have a very different context/environment variables. It's best to specify these explicitly so that others and your future self can understand your state of mind and thinking if they every look at it.&lt;/p&gt;

&lt;p&gt;You can determine the correct shell location by running &lt;code&gt;which bash&lt;/code&gt; to get the shell location (in my case its bash on Ubuntu but you may have a different shell. Similarly, if you are using other programs such as docker, you can run &lt;code&gt;which docker&lt;/code&gt; to get the exact file path of the program. Then in your shell script, instead of just using &lt;code&gt;docker&lt;/code&gt; you specify the exact docker file you want the script to run. The alternative is the set environment variables in your script to keep the configuration dynamic, it all depends on your situation and use case.&lt;/p&gt;

&lt;h3&gt;
  
  
  Specify absolute paths in outputs
&lt;/h3&gt;

&lt;p&gt;If your script is creating outputs, its a good idea to specify these in absolute terms. There is some confusion around what is the working directory where the files created by scripts run by crontab are placed. You should explicitly CD into the directory you'd like to work in. Here are a few cron jobs you can run to get an idea of you environment.&lt;/p&gt;

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

#Identify what in the path variable in the context of your script
* * * * * echo $PATH &amp;gt; ~/cron.log

#Identify the shell being use in your script
* * * * * echo $SHELL &amp;gt; ~/cron.log

#Identify the working directory your cron job natively executes in
* * * * * echo $PATH &amp;gt; ~/cron.log


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;View the outputs of these logs by inspecting the &lt;code&gt;cron.log&lt;/code&gt; file the logs are output to &lt;code&gt;cat ~/cron.log&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Make sure your script is executable and has the right permissions
&lt;/h3&gt;

&lt;p&gt;Set a script to be executable by running &lt;code&gt;chmod +x myscript.sh&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Set the correct ownership by running &lt;code&gt;chown myusername: myscript.sh&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Inspect cron job runs
&lt;/h3&gt;

&lt;p&gt;Run the following to see if the cronjob you've defined actually runs.&lt;/p&gt;

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

sudo grep CRON /var/log/syslog


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Are there any other common mistakes you ran in to as a beginner when defining cronjobs to run shell scripts or cron jobs in general. Let me know in the comments.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>cron</category>
    </item>
    <item>
      <title>Setting up Drone CI to work with self hosted Gitlab Repository</title>
      <dc:creator>Shuaib</dc:creator>
      <pubDate>Sat, 04 Apr 2020 17:07:27 +0000</pubDate>
      <link>https://dev.to/shuaib/setting-up-drone-ci-to-work-with-self-hosted-gitlab-repository-4egf</link>
      <guid>https://dev.to/shuaib/setting-up-drone-ci-to-work-with-self-hosted-gitlab-repository-4egf</guid>
      <description>&lt;p&gt;I have already setup Gitlab CI to build docker images which I'll be covering in a separate post. &lt;em&gt;I may not have posted it to dev.to but you'll be able to find some material if you search on my &lt;a href="https://blog.shuaib.org/"&gt;blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I had successfully setup Drone CI to work with Gitea. However, I ran into trouble getting it to work with a Gitlab repository. Most of the problems result from SSL certificate configurations and proxy configurations in a self-hosted environment.&lt;/p&gt;

&lt;p&gt;First off, once drone was connected to Gitlab repositories, it was able to sync the repositories. The problem came when I attempted to activate the repository for automated builds in Drone. I got the message &lt;em&gt;&lt;a href="https://discourse.drone.io/t/failed-to-activate-your-repository/2876"&gt;failed to activate your repository&lt;/a&gt; and check &lt;a href="https://discourse.drone.io/t/error-activating-gitlab-repository/3153/3"&gt;this&lt;/a&gt;.&lt;/em&gt; Following the steps in that post did not resolve the issues for me. As always, I had a suspicion this is something related to communication between Gitlab and Drone not working because of SSL certificate not being configured correctly. Setting the &lt;code&gt;DRONE_LOGS_DEBUG=true&lt;/code&gt; in my drone server and inspecting the logs gave some insight.&lt;/p&gt;

&lt;p&gt;The problem was that Drone CI was attempting to create a webhook via Gitlab API that will be triggered everytime a commit occurs on the repo to trigger a build in Drone. However, it was not getting a response. This is related to a Gitlab setting that prevents Outbound requests from Gitlab. The solution is described &lt;a href="https://discourse.drone.io/t/failed-to-activate-your-repository/2876/6"&gt;here&lt;/a&gt;. You have to enable requests to the local network from web hooks and service.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4d8i8_Wd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2020/04/image.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4d8i8_Wd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2020/04/image.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once this is done. You should be able to activate the repository in Drone. However, we're not done yet.&lt;/p&gt;

&lt;p&gt;Even if the Omnibus docker distribution of Gitlab has the custom SSL certificates mapped, these are not applied to the webhooks (or atleast I haven't figure out yet how to make them be used by Gitlab webhooks for verification). Also by default, the project specific webhook created by Drone in Gitlab to trigger builds has SSL verification enabled by default. This results in the error ad depicted below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cVdELqQ7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2020/04/image-6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cVdELqQ7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2020/04/image-6.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--H3_QKmRP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2020/04/image-1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--H3_QKmRP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2020/04/image-1.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--I405SdKO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2020/04/image-3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--I405SdKO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2020/04/image-3.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The simple solution is to disable SSL verification at this point if you're OK to do that in your environment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--v2u4yS72--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2020/04/image-5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--v2u4yS72--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.shuaib.org/content/images/2020/04/image-5.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The last part you need to ensure is that all the required runners required for your projects have been configured correctly. For the docker image build and deploy setup, I require a docker-exec-runner and a docker-runner.&lt;/p&gt;

&lt;p&gt;The final drone configuration for building a docker image and deploying via docker-compose on the same host is as follow. Deployment on other hosts could be achieved by tweaking the commands to login to remote host via ssh and perform the same actions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kind: pipeline
type: docker
name: build
#cd
steps:
- name: publish
  pull: if-not-exists
  image: plugins/docker
  settings:
    registry: registry.mydomain.net
    username:
      from_secret: username
    password:
      from_secret: password
    repo: registry.mydomain.net/my-project
    tags: 
      - latest
    insecure: true
--------
kind: pipeline
type: exec
name: deploy

# Cloning the respository in deploy stage is necessary to copy docker-compose.yml
# clone:
# disable: true

steps:
- name: deploy
  environment:
    USERNAME:
      from_secret: username
    PASSWORD:
      from_secret: password
  commands:
  - echo $(pwd)
  #Be careful with command below to not overwrite an existing project
  - mkdir -p /home/docker/services/my-project
  - cp docker-compose.yml /home/docker/services/my-project/docker-compose.yml
  - cd /home/docker/services/my-project
  #Notice below the synatax for using environment variables source in the environment command above
  - docker login -u $USERNAME -p $PASSWORD registry.mydomain.net
  - docker-compose pull &amp;amp;&amp;amp; docker-compose up -d
depends_on:
  - build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Dockerfile that will be used in the build step must reference an image from the private repository if it does not have access to public docker repository.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM registry.mydomain.net/nginx:alpine
COPY /build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Add disqus comments and search functionality to your ghost blog</title>
      <dc:creator>Shuaib</dc:creator>
      <pubDate>Thu, 12 Mar 2020 13:28:20 +0000</pubDate>
      <link>https://dev.to/shuaib/add-disqus-comments-and-search-functionality-to-your-ghost-blog-10o8</link>
      <guid>https://dev.to/shuaib/add-disqus-comments-and-search-functionality-to-your-ghost-blog-10o8</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fdDd8GGd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.unsplash.com/photo-1461969539980-32974612df40%3Fixlib%3Drb-1.2.1%26q%3D80%26fm%3Djpg%26crop%3Dentropy%26cs%3Dtinysrgb%26w%3D2000%26fit%3Dmax%26ixid%3DeyJhcHBfaWQiOjExNzczfQ" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fdDd8GGd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.unsplash.com/photo-1461969539980-32974612df40%3Fixlib%3Drb-1.2.1%26q%3D80%26fm%3Djpg%26crop%3Dentropy%26cs%3Dtinysrgb%26w%3D2000%26fit%3Dmax%26ixid%3DeyJhcHBfaWQiOjExNzczfQ" alt="Add disqus comments and search functionality to your ghost blog"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have been meaning to add commenting functionality to &lt;a href="https://blog.shuaib.org/"&gt;this blog&lt;/a&gt; for a while because I am really interested in hearing feedback from readers on what they like and what can be improved. Adding disqus commenting facility to my site had been on the to do list for a while and I finally tackled it today. It was much quicker and easier to setup than I had expected and primarily just required setting up some configuration options. I have also changed the theme for the site to &lt;a href="https://github.com/zutrinken/attila"&gt;Attila&lt;/a&gt; which I came across reading another blog last night. The theme itself introduced me to the client-side search functionality via &lt;a href="https://github.com/jamalneufeld/ghostHunter"&gt;ghostHunter&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Detailed and clear setup instructions are provided in the links above so I'm not going to repeat them here but I will lay down high level steps that you will be able to follow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Setup a &lt;a href="https://disqus.com/"&gt;disqus&lt;/a&gt; account and make note of your &lt;em&gt;disqus short name&lt;/em&gt; that we will require for configuration.&lt;/li&gt;
&lt;li&gt;Via the ghost integrations &amp;gt; custom intergrations, create a new custom integration called &lt;em&gt;ghostHunter&lt;/em&gt; and copy the &lt;em&gt;Content API Key&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Clone the attila theme repository for GitHub from command line and cd into the directory /assets&lt;/li&gt;
&lt;li&gt;Clone the ghostHunter repository as mentioned in the setup on the ghostHunter GitHub readme page.&lt;/li&gt;
&lt;li&gt;Zip the resulting attila theme folder and upload it via Ghost Admin web interface under the Design section. Activate the theme.&lt;/li&gt;
&lt;li&gt;Go to the Code integrations page an copy and paste the &lt;code&gt;script&lt;/code&gt; tags mentioned in the attila GitHub repository readme in the Ghost Blog Header section. Add the &lt;em&gt;disqus short name&lt;/em&gt; and &lt;em&gt;Content API Key&lt;/em&gt; from earlier steps as relevant. Save changes.&lt;/li&gt;
&lt;li&gt;Go to your blog home page. You will notice the search icon on the top right. Play with the search functionality to make sure it works. Navigate to one of the pages and go to the bottom of the page and verify that you have disqus section visible. Click the 'Show Comments' button to see that comment input form appears.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's it. Everything should be working correctly. The whole setup will take 15 to 30 mins. I setup all this and wrote this blog post within my 1 hour train ride.&lt;/p&gt;

</description>
      <category>ghost</category>
    </item>
  </channel>
</rss>
