<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Jorge Maroto</title>
    <description>The latest articles on Forem by Jorge Maroto (@patoroco).</description>
    <link>https://forem.com/patoroco</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%2F458815%2Fec5bc63a-df9c-444f-b4a3-c8aacba818d4.jpeg</url>
      <title>Forem: Jorge Maroto</title>
      <link>https://forem.com/patoroco</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/patoroco"/>
    <language>en</language>
    <item>
      <title>Doorkeeper (open/close ports from GHActions) for DigitalOcean</title>
      <dc:creator>Jorge Maroto</dc:creator>
      <pubDate>Wed, 26 Aug 2020 17:45:26 +0000</pubDate>
      <link>https://forem.com/patoroco/doorkeeper-for-digitalocean-1ca2</link>
      <guid>https://forem.com/patoroco/doorkeeper-for-digitalocean-1ca2</guid>
      <description>&lt;p&gt;This Github action allows you to open or close an specific port in your DigitalOcean firewall. It's really useful for deploy in your instances from Github Actions, as they don't provide a list of IPs to add to your security groups.&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Instructions
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;You need to generate a &lt;strong&gt;personal access token&lt;/strong&gt; from &lt;a href="https://cloud.digitalocean.com/account/api/tokens" rel="noopener noreferrer"&gt;your DigitalOcean Applications &amp;amp; API&lt;/a&gt; page.&lt;/li&gt;
&lt;li&gt;Copy that token, and paste in the secrets of your repo.&lt;/li&gt;
&lt;li&gt;Create or update a workflow, adding the file &lt;code&gt;.github/workflows/doorkeeper.yml&lt;/code&gt; (&lt;a href="https://help.github.com/en/actions/getting-started-with-github-actions/starting-with-preconfigured-workflow-templates" rel="noopener noreferrer"&gt;more info about how to use Github Actions&lt;/a&gt;).
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;
&lt;span class="c1"&gt;############################&lt;/span&gt;
&lt;span class="c1"&gt;## prepare your artifacts ##&lt;/span&gt;
&lt;span class="c1"&gt;############################&lt;/span&gt;

&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Doorkeeper open&lt;/span&gt;
  &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;patoroco/doorkeeper@master&lt;/span&gt;
  &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;digitaloceanToken&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.DO_TOKEN }}&lt;/span&gt;
    &lt;span class="na"&gt;firewallName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name_of_the_firewall"&lt;/span&gt;
    &lt;span class="na"&gt;actionToDo&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;add"&lt;/span&gt;
    &lt;span class="na"&gt;dryRun&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;

&lt;span class="c1"&gt;############################&lt;/span&gt;
&lt;span class="c1"&gt;## deploy to DigitalOcean ##&lt;/span&gt;
&lt;span class="c1"&gt;############################&lt;/span&gt;

&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Doorkeeper close&lt;/span&gt;
  &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;patoroco/doorkeeper@master&lt;/span&gt;
  &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;digitaloceanToken&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.DO_TOKEN }}&lt;/span&gt;
    &lt;span class="na"&gt;firewallName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name_of_the_firewall"&lt;/span&gt;
    &lt;span class="na"&gt;actionToDo&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;remove"&lt;/span&gt;
    &lt;span class="na"&gt;dryRun&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To check that everything is working as expected, you have to push these changes to your repo, and a new build in the &lt;code&gt;Actions&lt;/code&gt; tab should be starting.&lt;/p&gt;

&lt;h3&gt;
  
  
  My Workflow
&lt;/h3&gt;

&lt;p&gt;I'm using this workflow to allow to deploy to my small 5$ instance in digitalocean (I'm using dokku as the PaaS).&lt;br&gt;
It's really easy to push a new commit, and wait for the automatic release :)&lt;/p&gt;

&lt;h3&gt;
  
  
  Submission Category
&lt;/h3&gt;

&lt;p&gt;DIY Deployments&lt;/p&gt;

&lt;h3&gt;
  
  
  Yaml File or Link to Code
&lt;/h3&gt;

&lt;p&gt;This is a github action, and all the code is available in my repo: &lt;a href="https://github.com/patoroco/doorkeeper/" rel="noopener noreferrer"&gt;https://github.com/patoroco/doorkeeper/&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Additional Resources / Info
&lt;/h3&gt;

&lt;p&gt;Feel free to collaborate with issues / PRs :)&lt;/p&gt;

</description>
      <category>actionshackathon</category>
      <category>github</category>
      <category>digitalocean</category>
    </item>
  </channel>
</rss>
