<?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"><channel><title><![CDATA[Diego Cornejo (RamdomTechGuy)]]></title><description><![CDATA[A journey from a random guy to a random tech guy :D]]></description><link>https://blog.diegocornejo.com</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Apr 2026 00:59:33 GMT</lastBuildDate><atom:link href="https://blog.diegocornejo.com/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Setting Up a Monitoring Stack in Docker Compose]]></title><description><![CDATA[This guide provides instructions on setting up a comprehensive monitoring stack using Grafana, Prometheus, Node Exporter, cAdvisor and Loki. These components are orchestrated with Docker Compose and exposed via an NGINX reverse proxy, making them acc...]]></description><link>https://blog.diegocornejo.com/setting-up-a-monitoring-stack-in-docker-compose</link><guid isPermaLink="true">https://blog.diegocornejo.com/setting-up-a-monitoring-stack-in-docker-compose</guid><category><![CDATA[Grafana]]></category><category><![CDATA[Docker]]></category><category><![CDATA[nginx]]></category><category><![CDATA[loki]]></category><category><![CDATA[Docker compose]]></category><category><![CDATA[#prometheus]]></category><dc:creator><![CDATA[Diego Cornejo]]></dc:creator><pubDate>Tue, 23 Jul 2024 06:16:43 GMT</pubDate><content:encoded><![CDATA[<p>This guide provides instructions on setting up a comprehensive monitoring stack using Grafana, Prometheus, Node Exporter, cAdvisor and Loki. These components are orchestrated with Docker Compose and exposed via an NGINX reverse proxy, making them accessible through a single domain.</p>
<h2 id="heading-components">Components</h2>
<ul>
<li><p><strong>Grafana</strong>: The analytics and monitoring solution with support for multiple data sources, including Prometheus.</p>
</li>
<li><p><strong>Prometheus</strong>: The monitoring and alerting toolkit, collecting metrics from configured targets at specified intervals.</p>
</li>
<li><p><strong>Node Exporter</strong>: A Prometheus exporter for hardware and OS metrics exposed by *NIX kernels.</p>
</li>
<li><p><strong>cAdvisor</strong>: Analyzes resource usage and performance characteristics of running containers.</p>
</li>
<li><p><strong>Loki</strong>: A horizontally-scalable, highly-available, multi-tenant log aggregation system.</p>
</li>
<li><p><strong>NGINX</strong>: Used as a reverse proxy to expose Grafana on the internet securely.</p>
</li>
</ul>
<h2 id="heading-prerequisites">Prerequisites</h2>
<ul>
<li><p>Docker and Docker Compose installed on your host machine.</p>
</li>
<li><p>Domain name configured to point to the host machine (for NGINX configuration).</p>
</li>
</ul>
<h2 id="heading-configuration-files-overview">Configuration Files Overview</h2>
<ul>
<li><p><code>docker-compose.yml</code>: Defines the services, networks, and volumes for the Docker containers.</p>
</li>
<li><p><code>prometheus.yml</code>: Configuration file for Prometheus to define scrape targets and intervals.</p>
</li>
<li><p><code>grafana.ini</code>: Configuration file for Grafana's settings, including SMTP for email notifications.</p>
</li>
<li><p><code>loki-config.yml</code>: Configuration file for Loki to define the storage backend and other settings.</p>
</li>
<li><p><code>domain.conf</code>: NGINX configuration for proxying requests to Grafana and handling WebSocket connections.</p>
</li>
</ul>
<h2 id="heading-installation-steps">Installation Steps</h2>
<ol>
<li><p><strong>Configure Docker Daemon</strong>: Enable Docker metrics by adding the following to <code>/etc/docker/daemon.json</code> and restarting Docker:</p>
<pre><code class="lang-bash"> {
   <span class="hljs-string">"metrics-addr"</span>: <span class="hljs-string">"127.0.0.1:9323"</span>
 }
 <span class="hljs-comment"># Then reload Docker configurations:</span>
 sudo systemctl reload docker
</code></pre>
</li>
<li><p><strong>Install Loki plugin for Docker</strong>: Install the Loki plugin for Docker to enable log collection:</p>
<pre><code class="lang-bash"> docker plugin install grafana/loki-docker-driver:latest --<span class="hljs-built_in">alias</span> loki --grant-all-permissions
</code></pre>
</li>
<li><p><strong>Clone the Repository</strong>: Clone the repository to your host machine:</p>
<pre><code class="lang-bash"> git <span class="hljs-built_in">clone</span> https://gist.github.com/398e94fb0aebb994b25223d99e7ae769.git monitoring-stack
 <span class="hljs-built_in">cd</span> monitoring-stack
</code></pre>
</li>
<li><p><strong>Start the Services</strong>: Start the monitoring stack using Docker Compose:</p>
<pre><code class="lang-bash"> docker-compose up -d
</code></pre>
</li>
<li><p><strong>Access Grafana</strong>: Access Grafana at <code>http://&lt;your-domain&gt;</code> and log in with the default credentials (username: <code>admin</code>, password: <code>admin</code>).</p>
</li>
</ol>
<blockquote>
<p><strong>Important Notes:</strong></p>
<ul>
<li><p>Replace placeholder values in grafana.ini with your SMTP credentials to enable email notifications.</p>
</li>
<li><p>Adjust the domain.conf to match your domain and specific requirements.</p>
</li>
<li><p>Review Docker and NGINX logs in case of any issues during setup.</p>
</li>
</ul>
</blockquote>
<ol start="6">
<li><p>How to send container logs to loki:</p>
<pre><code class="lang-dockerfile"> docker <span class="hljs-keyword">run</span><span class="bash"> --name nginx-loki -d \
 -p 8080:80 \
 --log-driver=loki \
 --log-opt loki-url=http://localhost:3100/loki/api/v1/push \
 nginx:latest</span>
</code></pre>
</li>
</ol>
]]></content:encoded></item><item><title><![CDATA[Deploy Jupyter Lite on Vercel / Netlify]]></title><description><![CDATA[Introduction:
Jupyter Notebook is an incredibly versatile tool for working with code and data interactively and collaboratively. In this article, I'll guide you through an exciting journey that begins with an introduction to Jupyter and its Notebooks...]]></description><link>https://blog.diegocornejo.com/deploy-your-own-jupyter-lite-on-vercel</link><guid isPermaLink="true">https://blog.diegocornejo.com/deploy-your-own-jupyter-lite-on-vercel</guid><dc:creator><![CDATA[Diego Cornejo]]></dc:creator><pubDate>Tue, 07 Nov 2023 04:20:20 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1729052689671/a09ad832-4459-400a-9928-fe55c376dedb.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction"><strong>Introduction:</strong></h2>
<p>Jupyter Notebook is an incredibly versatile tool for working with code and data interactively and collaboratively. In this article, I'll guide you through an exciting journey that begins with an introduction to Jupyter and its Notebooks, moves on to using a GitHub template or forking, and finally, reaches the setup and deployment on Vercel.</p>
<h2 id="heading-what-jupyter-and-notebooks-are"><strong>What Jupyter and Notebooks Are</strong></h2>
<p>Jupyter Notebook is an open-source tool that allows you to create and share interactive documents that combine code, visualizations, and explanatory text all in one place. It's widely used in fields like data science, programming, scientific research, and education.</p>
<blockquote>
<p>Note: The Jupyter Lite team offers excellent documentation for deploying Notebooks on GitHub Pages <a target="_blank" href="https://jupyterlite.readthedocs.io/en/latest/quickstart/deploy.html">https://jupyterlite.readthedocs.io/en/latest/quickstart/deploy.html</a>. However, in this post, we'll show you how to achieve the same process on Vercel.</p>
</blockquote>
<h2 id="heading-using-the-github-template-or-forking"><strong>Using the GitHub Template or Forking</strong></h2>
<p>You can kickstart your Jupyter Lite Notebook project by using this Github template <a target="_blank" href="https://github.com/new?template_name=vercel-jupyter-lite&amp;template_owner=diegofcornejo">Vercel / Netlify Jupyter Lite Template</a>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1699327152714/485d91bf-6a3d-420b-9b6c-85e091e83e5b.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1699327219371/ac6dd6be-00ef-45f5-9228-5004521c1ad9.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-setting-up-on-vercel"><strong>Setting Up on Vercel</strong></h2>
<ol>
<li><p>Sign up for Vercel (if you haven't already).</p>
</li>
<li><p>Create a new project on Vercel and follow the instructions to connect your GitHub repository with Vercel.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1699327326967/e7de8de7-d602-4b76-a0dd-b9ba3668fbc5.png" alt class="image--center mx-auto" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1699327390773/014a64ed-9df7-4b81-8fd1-a0e37d93d6e9.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Configure deployment options and follow the steps to guide you through the deployment process.</p>
<ul>
<li><p>Set a name for your project</p>
</li>
<li><p>Open "Build and Outputs Settings"</p>
</li>
<li><p>Enable "Build Command" and add this text: <code>bash ./deploy.sh</code></p>
</li>
<li><p>Enable "Output Directory" and add this text: <code>dist</code></p>
</li>
<li><p>Click on "Deploy"</p>
</li>
</ul>
</li>
</ol>
<p>    <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1699327478429/2dfe6e70-ec83-41d9-b648-a4edfdb87ff1.png" alt class="image--center mx-auto" /></p>
<ol start="4">
<li>Once deployment is complete, your Jupyter Notebook project will be online and accessible.</li>
</ol>
<h2 id="heading-setting-up-on-netlify"><strong>Setting Up on Netlify</strong></h2>
<ol>
<li><p>Sign up for Netlify (if you haven't already).</p>
</li>
<li><p>Create a new project on Netlify and follow the instructions to connect your GitHub repository with Netlify.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1729050630017/63e7dc00-261f-445f-85ea-d00035e44c2e.png" alt class="image--center mx-auto" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1729050565939/d702899d-1350-40f3-9c9a-e6ff9162a2ed.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Configure deployment options and follow the steps to guide you through the deployment process.</p>
<ul>
<li><p>Set a name for your project</p>
</li>
<li><p>Set "Build command" with this text: <code>bash ./deploy.sh</code></p>
</li>
<li><p>Set "Publish directory" with this text: <code>dist</code></p>
</li>
<li><p>Click on "Deploy {projectname}"</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1729051563582/d32d826c-8621-4111-ac3f-dddfa2f3f0fd.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
</li>
<li><p>Once deployment is complete, your Jupyter Notebook project will be online and accessible.</p>
</li>
</ol>
<h2 id="heading-demo"><strong>Demo</strong></h2>
<p>Before starting your own project, we invite you to explore a demo of what you'll accomplish with <strong>Jupyter Lite Notebook on Vercel / Netlify</strong>.</p>
<p>You can see the demo in action at:</p>
<p><a target="_blank" href="https://jupyter.vercel.app">https://jupyter.vercel.app</a>.</p>
<p><a target="_blank" href="https://jupyterlite.netlify.app/">https://jupyterlite.netlify.app/</a></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1699330614098/476d30cd-ca5a-4bab-a3cd-d82ff030c1f1.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1699330631107/c92cf67c-96ca-4647-8e80-fe36c4b08743.png" alt class="image--center mx-auto" /></p>
]]></content:encoded></item><item><title><![CDATA[Dockerize a Rect App (vite) inside a Turborepo]]></title><description><![CDATA[Ultra-Light HTTP Server with Busybox HTTPD Applet
Description: This Docker image is designed to provide an ultra-lightweight HTTP server optimized for efficiently serving static files. It is based on the Busybox system and utilizes the Applet HTTPD f...]]></description><link>https://blog.diegocornejo.com/dockerize-a-rect-app-vite-inside-a-turborepo</link><guid isPermaLink="true">https://blog.diegocornejo.com/dockerize-a-rect-app-vite-inside-a-turborepo</guid><category><![CDATA[Docker]]></category><category><![CDATA[turborepo]]></category><category><![CDATA[React]]></category><category><![CDATA[vite]]></category><category><![CDATA[Devops]]></category><dc:creator><![CDATA[Diego Cornejo]]></dc:creator><pubDate>Tue, 24 Oct 2023 13:38:02 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1698166613444/53130a14-0d4f-4f07-beab-3ae9a34176ef.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-ultra-light-http-server-with-busybox-httpd-applet">Ultra-Light HTTP Server with Busybox HTTPD Applet</h2>
<p><strong>Description:</strong> This Docker image is designed to provide an ultra-lightweight HTTP server optimized for efficiently serving static files. It is based on the Busybox system and utilizes the Applet HTTPD for web server functionality.</p>
<p><strong>General Image Details:</strong></p>
<ul>
<li><p><strong>Base Image:</strong> diegofcornejo/httpd-lite:latest</p>
</li>
<li><p><strong>Purpose:</strong> Efficiently serve static files.</p>
</li>
<li><p><strong>Size:</strong> The image size has been optimized to be as lightweight as possible, making it ideal for quick and efficient deployments of static content in containerized environments. (158kb)</p>
</li>
</ul>
<h3 id="heading-example-usage">Example Usage</h3>
<h4 id="heading-serving-static-files-from-your-host-machine">Serving Static Files from your Host Machine</h4>
<pre><code class="lang-bash"><span class="hljs-comment"># Serve static files from the current directory</span>
<span class="hljs-comment"># Create a configuration file if you don't have one</span>
touch httpd.conf 
<span class="hljs-comment"># Run the container with the following command:</span>
docker run -p 80:8080 --init --rm -ti -v <span class="hljs-string">"<span class="hljs-subst">$(PWD)</span>:/home/static"</span> diegofcornejo/httpd-lite:latest
</code></pre>
<h4 id="heading-using-in-a-dockerfile">Using in a Dockerfile</h4>
<p>Here's an example of how to use this image. The <code>CMD</code> instruction is optional but can be used to replace the parameters as needed:</p>
<pre><code class="lang-Dockerfile"><span class="hljs-keyword">FROM</span> diegofcornejo/httpd-lite:latest as production

<span class="hljs-keyword">EXPOSE</span> <span class="hljs-number">8080</span>

<span class="hljs-comment"># Copy your static files</span>
<span class="hljs-keyword">COPY</span><span class="bash"> . .</span>

<span class="hljs-keyword">CMD</span><span class="bash"> [<span class="hljs-string">"/busybox"</span>, <span class="hljs-string">"httpd"</span>, <span class="hljs-string">"-f"</span>, <span class="hljs-string">"-v"</span>, <span class="hljs-string">"-p"</span>, <span class="hljs-string">"8080"</span>, <span class="hljs-string">"-c"</span>, <span class="hljs-string">"httpd.conf"</span>]</span>
</code></pre>
<h4 id="heading-vite-react-app-built-inside-a-turborepo-full-example">(Vite) React App built inside a turborepo full example</h4>
<p>Assuming you have a project structure like this:</p>
<pre><code class="lang-plaintext">├── turbo.json
├── package.json
├── yarn.lock
├── README.md
└── apps
    └── myapp
        ├── src
        ├── index.html
        └── Dockerfile
</code></pre>
<pre><code class="lang-Dockerfile"><span class="hljs-comment"># Base image</span>
<span class="hljs-keyword">FROM</span> alpine:<span class="hljs-number">3.18</span>.<span class="hljs-number">4</span> as build

<span class="hljs-keyword">RUN</span><span class="bash"> apk update</span>
<span class="hljs-keyword">RUN</span><span class="bash"> apk add --no-cache nodejs npm</span>
<span class="hljs-keyword">RUN</span><span class="bash"> npm install -g yarn</span>

<span class="hljs-comment"># Create app directory</span>
<span class="hljs-keyword">WORKDIR</span><span class="bash"> /app</span>

<span class="hljs-comment"># Copy the whole project</span>
<span class="hljs-keyword">COPY</span><span class="bash"> ../../ .</span>

<span class="hljs-comment"># Install dependencies</span>
<span class="hljs-keyword">RUN</span><span class="bash"> yarn install</span>

<span class="hljs-comment"># Build the app</span>
<span class="hljs-keyword">RUN</span><span class="bash"> yarn workspace myapp build</span>

<span class="hljs-comment"># Production stage</span>
<span class="hljs-keyword">FROM</span> diegofcornejo/httpd-lite:latest as production

<span class="hljs-comment"># Copy build artifacts from the build-vite stage</span>
<span class="hljs-keyword">COPY</span><span class="bash"> --from=build /app/apps/myapp/dist .</span>

<span class="hljs-keyword">EXPOSE</span> <span class="hljs-number">8080</span>
</code></pre>
<h4 id="heading-build-image-and-run-container">Build image and run container</h4>
<pre><code class="lang-bash"><span class="hljs-comment"># To build the docker image, run the following command:</span>
docker build -f apps/myapp/Dockerfile -t myreactapp:latest .

<span class="hljs-comment"># To run the docker image, run the following command:</span>
docker run -p 80:8080 --init --rm -ti myreactapp:latest

<span class="hljs-comment"># Or in detach mode (background):</span>
docker run -p 80:8080 --init --rm -d myreactapp:latest

<span class="hljs-comment"># Now Open your browser and go to http://localhost:80</span>

<span class="hljs-comment"># To stop the docker image, run the following command:</span>
docker stop &lt;container_id&gt;
</code></pre>
<p>Note: When running the container, sending a TERM signal to your TTY won't get propagated due to how Busybox is built. Instead, you can call <code>docker stop</code> (or <code>docker kill</code> if you can't wait 15 seconds). Alternatively, you can run the container with <code>docker run -it --rm --init</code>, which will propagate signals to the process correctly.</p>
]]></content:encoded></item><item><title><![CDATA[Export AWS SSM Parameter Store as Environment Variables with Bash]]></title><description><![CDATA[1. Add parameters to AWS System Manager
aws ssm put-parameter --name "/my-app/my-param-name" --value "my-param-value" --type "String"

Replace "/my-app/my-param-name" with the desired path and name for the parameter. Note that the path must begin wit...]]></description><link>https://blog.diegocornejo.com/export-aws-ssm-parameter-store-as-environment-variables-with-bash</link><guid isPermaLink="true">https://blog.diegocornejo.com/export-aws-ssm-parameter-store-as-environment-variables-with-bash</guid><dc:creator><![CDATA[Diego Cornejo]]></dc:creator><pubDate>Fri, 28 Apr 2023 05:34:43 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1682659960431/0615fb6e-ccbb-44d9-a4f3-828b7ea69dca.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-1-add-parameters-to-aws-system-manager">1. Add parameters to AWS System Manager</h3>
<pre><code class="lang-sh">aws ssm put-parameter --name <span class="hljs-string">"/my-app/my-param-name"</span> --value <span class="hljs-string">"my-param-value"</span> --<span class="hljs-built_in">type</span> <span class="hljs-string">"String"</span>
</code></pre>
<p>Replace <code>"/my-app/my-param-name"</code> with the desired path and name for the parameter. Note that the path must begin with a forward slash (<code>/</code>) and can include multiple levels separated by forward slashes. Also, if the path does not exist, the <code>put-parameter</code> command will create it automatically.</p>
<p>Make sure you have permission to create parameters in the SSM parameter store, and specify any necessary additional parameters like <code>--region</code> or <code>--profile</code>.</p>
<h3 id="heading-2-create-the-bash-script">2.  Create the bash script</h3>
<p>The script sets some parameters like <code>APP</code>, <code>SERVICE</code>, <code>ENVIRONMENT</code>, and <code>REGION</code>. These variables are used to construct the SSM path to retrieve the parameters.</p>
<p>The script uses the <code>aws ssm get-parameters-by-path</code> command to retrieve all SSM parameter names under the given path. Then, it loops through each parameter and exports it as an environment variable. The script also appends the export statements to the <code>~/.bashrc</code> file so that they persist on future logins.</p>
<p>Finally, the script reloads the <code>~/.bashrc</code> file with the <code>source</code> command.</p>
<h4 id="heading-create-a-file-for-the-script">Create a file for the script</h4>
<pre><code class="lang-sh">nano export-ssm-params.sh
<span class="hljs-comment">#or</span>
vim export-ssm-params.sh
</code></pre>
<p>Copy/paste the following code.</p>
<p>Here's the script:</p>
<pre><code class="lang-sh"><span class="hljs-meta">#!/bin/bash</span>

<span class="hljs-comment"># This script will export all SSM parameters under a given path as environment variables</span>
<span class="hljs-comment"># It will also append the export statements to the ~/.bashrc file so that they are available on future logins</span>

<span class="hljs-comment"># Set some parameters</span>
APP=<span class="hljs-string">"myapp"</span>
SERVICE=<span class="hljs-string">"api"</span>
ENVIRONMENT=<span class="hljs-string">"production"</span>
REGION=<span class="hljs-string">"us-east-1"</span>

<span class="hljs-comment"># Set the SSM path</span>
SSM_PATH=<span class="hljs-string">"/<span class="hljs-variable">$APP</span>/<span class="hljs-variable">$SERVICE</span>/<span class="hljs-variable">$ENVIRONMENT</span>"</span>

<span class="hljs-comment"># Get all SSM parameter names under the given path</span>
SSM_PARAMETER_NAMES=$(aws ssm get-parameters-by-path \
  --region <span class="hljs-variable">$REGION</span> \
  --path <span class="hljs-string">"<span class="hljs-variable">$SSM_PATH</span>"</span> \
  --recursive \
  --with-decryption \
  --query <span class="hljs-string">'Parameters[].Name'</span> \
  --output text)

<span class="hljs-comment"># Loop through each parameter and export it as an environment variable</span>
<span class="hljs-keyword">for</span> name <span class="hljs-keyword">in</span> <span class="hljs-variable">$SSM_PARAMETER_NAMES</span>; <span class="hljs-keyword">do</span>
  value=$(aws ssm get-parameter \
    --region <span class="hljs-variable">$REGION</span> \
    --name <span class="hljs-variable">$name</span> \
    --with-decryption \
    --query <span class="hljs-string">'Parameter.Value'</span> \
    --output text)
  <span class="hljs-keyword">if</span> [ ! -z <span class="hljs-string">"<span class="hljs-variable">$name</span>"</span> ] &amp;&amp; [ ! -z <span class="hljs-string">"<span class="hljs-variable">$value</span>"</span> ]; <span class="hljs-keyword">then</span>
    name=$(<span class="hljs-built_in">echo</span> <span class="hljs-variable">$name</span> | awk -F/ <span class="hljs-string">'{print toupper($NF)}'</span>)
    <span class="hljs-built_in">export</span> <span class="hljs-string">"<span class="hljs-variable">$name</span>"</span>=<span class="hljs-string">"<span class="hljs-variable">$value</span>"</span>
    <span class="hljs-built_in">echo</span> <span class="hljs-string">"Exported variable: <span class="hljs-variable">$name</span>=<span class="hljs-variable">$value</span>"</span>
    <span class="hljs-built_in">echo</span> <span class="hljs-string">"export <span class="hljs-variable">$name</span>=<span class="hljs-variable">$value</span>"</span> &gt;&gt; ~/.bashrc
  <span class="hljs-keyword">fi</span>
<span class="hljs-keyword">done</span>

<span class="hljs-comment"># Reload the bashrc file</span>
<span class="hljs-built_in">source</span> ~/.bashrc
</code></pre>
<h3 id="heading-3-how-to-run-the-script">3.  How to Run the Script</h3>
<p>To use this script, you need to have the AWS client (<code>awscli</code>) installed and configured to authenticate to an AWS account. Then, simply execute the script with Bash in a terminal.</p>
<p>You can save the script in a file with <code>.sh</code> extension, for example <code>export-ssm-params.sh</code>. </p>
<pre><code class="lang-sh">nano export-ssm-params.sh
<span class="hljs-comment">#or</span>
vim export-ssm-params.sh
</code></pre>
<p>Don't forget add execution permission</p>
<pre><code class="lang-sh">chmod +x export-ssm-params.sh
</code></pre>
<p>Now you can run the script with the following command:</p>
<pre><code class="lang-sh">bash export-ssm-params.sh
<span class="hljs-comment">#or</span>
./export-ssm-params.sh
</code></pre>
<h2 id="heading-conclusion">Conclusion</h2>
<p>In summary, this bash script is useful to export AWS Systems Manager parameters as environment variables. This can be helpful in different situations, for example, to avoid the need to repeatedly call the AWS API to get the parameter values.</p>
<p>Additionally, the script also adds the export statements to the <code>~/.bashrc</code> file, meaning that the environment variables will be available in future Bash terminal sessions.</p>
]]></content:encoded></item><item><title><![CDATA[Publish Express API to EKS Fargate]]></title><description><![CDATA[Important: This tutorial assume you already has installed and know how to use, aws cli, kubectl and eksctl
Create and Setup Cluster and required policies
1. Create Fargate Cluster
eksctl create cluster --region us-west-1 --name express-api --version ...]]></description><link>https://blog.diegocornejo.com/publish-express-api-to-eks-fargate</link><guid isPermaLink="true">https://blog.diegocornejo.com/publish-express-api-to-eks-fargate</guid><category><![CDATA[Kubernetes]]></category><category><![CDATA[EKS]]></category><category><![CDATA[Docker]]></category><category><![CDATA[Express]]></category><category><![CDATA[aws-fargate]]></category><dc:creator><![CDATA[Diego Cornejo]]></dc:creator><pubDate>Sun, 26 Mar 2023 17:19:25 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1679850947261/a58e9f8d-94a1-49a8-80ca-23e2fc0b25a2.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Important: This tutorial assume you already has installed and know how to use, aws cli, kubectl and eksctl</p>
<h3 id="heading-create-and-setup-cluster-and-required-policies">Create and Setup Cluster and required policies</h3>
<h4 id="heading-1-create-fargate-cluster">1. Create Fargate Cluster</h4>
<pre><code>eksctl create cluster --region us-west<span class="hljs-number">-1</span> --name express-api --version <span class="hljs-number">1.25</span> --fargate
</code></pre><p>Note: This command create a stack in cloudformation</p>
<h4 id="heading-2-enable-cluster-to-use-iam">2.  Enable cluster to use IAM</h4>
<pre><code>eksctl utils associate-iam-oidc-provider --region us-west<span class="hljs-number">-1</span> --cluster express-api --approve
</code></pre><h4 id="heading-3-download-the-iam-policy-to-allow-aws-load-balancer-controller-to-make-requests-to-aws-apis">3. Download the IAM policy to allow AWS Load Balancer Controller to make requests to AWS API's</h4>
<pre><code>curl -o iam_policy.json https:<span class="hljs-comment">//raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.4.4/docs/install/iam_policy.json</span>
</code></pre><h4 id="heading-4-create-an-iam-policy-with-the-file-downloaded-in-step-3">4. Create an IAM policy with the file downloaded in step 3</h4>
<pre><code>aws iam create-policy \
   --policy-name AWSLoadBalancerControllerIAMPolicy \
   --policy-<span class="hljs-built_in">document</span> file:<span class="hljs-comment">//iam_policy.json</span>
</code></pre><h4 id="heading-5-to-create-a-service-account-named-aws-load-balancer-controller-in-the-kube-system-namespace-for-the-aws-load-balancer-controller-run-the-following-command">5. To create a service account named aws-load-balancer-controller in the kube-system namespace for the AWS Load Balancer Controller, run the following command:</h4>
<pre><code>eksctl create iamserviceaccount \
  --cluster=express-api \
  --namespace=kube-system \
  --name=aws-load-balancer-controller \
  --attach-policy-arn=arn:aws:iam::{org-id}:policy/AWSLoadBalancerControllerIAMPolicy \
  --override-existing-serviceaccounts \
  --approve \
  --region us-west<span class="hljs-number">-1</span>
</code></pre><p>Note: This command create a stack in cloudformation</p>
<h4 id="heading-6-to-verify-that-the-new-service-role-is-created-run-one-of-the-following-commands">6. To verify that the new service role is created, run one of the following commands:</h4>
<pre><code>eksctl get iamserviceaccount --region us-west<span class="hljs-number">-1</span> --cluster express-api --name aws-load-balancer-controller --namespace kube-system
#or
kubectl get serviceaccount aws-load-balancer-controller --namespace kube-system
</code></pre><h3 id="heading-install-the-aws-load-balancer-controller-using-helm">Install the AWS Load Balancer Controller using Helm</h3>
<h4 id="heading-1-add-the-amazon-eks-chart-repo-to-helm">1.  Add the Amazon EKS chart repo to Helm</h4>
<pre><code>helm repo add eks https:<span class="hljs-comment">//aws.github.io/eks-charts</span>
</code></pre><h4 id="heading-2-install-the-targetgroupbinding-custom-resource-definitions-crds">2. Install the TargetGroupBinding custom resource definitions (CRDs)</h4>
<pre><code>kubectl apply -k <span class="hljs-string">"github.com/aws/eks-charts/stable/aws-load-balancer-controller//crds?ref=master"</span>
</code></pre><h4 id="heading-3-install-helm-chart">3. Install helm chart</h4>
<pre><code>helm install aws-load-balancer-controller eks/aws-load-balancer-controller \
    --set clusterName=express-api \
    --set serviceAccount.create=<span class="hljs-literal">false</span> \
    --set region=us-west<span class="hljs-number">-1</span> \
    --set vpcId={vpc-id} \
    --set serviceAccount.name=aws-load-balancer-controller \
    -n kube-system
</code></pre><h3 id="heading-setup-aws-load-balancer-controller">Setup AWS Load Balancer Controller</h3>
<h4 id="heading-1-create-a-fargate-profile">1. Create a Fargate profile</h4>
<pre><code>eksctl create fargateprofile --cluster express-api --region us-west<span class="hljs-number">-1</span> --name express-api-profile --namespace express-api-namespace
</code></pre><h4 id="heading-2-deploy-yml-file">2. Deploy YML file</h4>
<p>Download: https://gist.github.com/diegofcornejo/5b271c7ec69b2e813804bdcbe2bd0684#file-express-api-alb-yml</p>
<pre><code>kubectl apply -f express-api-alb.yml
</code></pre><p>Note: If you want https on your load balancer, you need to create it before in the same region when you are deployed your cluster (us-west-1 for this example), then pass the certificate arn in the file.yml</p>
<h4 id="heading-3-verify-that-the-ingress-resource-was-created">3. Verify that the Ingress resource was created</h4>
<pre><code>kubectl get ingress/express-api-ingress -n express-api-namespace
#or
kubectl get ingresses.networking.k8s.io express-api-ingress -n express-api-namespace
</code></pre><p>Output:</p>
<pre><code>NAME                  CLASS   HOSTS   ADDRESS                                                                 PORTS   AGE
express-api-ingress   alb     *       k8s-expressa-expressa-xxxxxxxxxx-xxxxxxxx.us-west<span class="hljs-number">-2.</span>elb.amazonaws.com   <span class="hljs-number">80</span>      <span class="hljs-number">12</span>m
</code></pre><p>Note: If your Ingress isn't created after several minutes, view the AWS Load Balancer Controller logs by running the following command:</p>
<pre><code>kubectl logs -n kube-system deployment.apps/aws-load-balancer-controller
</code></pre><h4 id="heading-4-open-the-browser-and-paste-the-load-balancer-url-or-your-custom-domain">4. Open the browser and paste the load balancer url or your custom domain</h4>
<p>Note: Remember create an A record in route 53 or your domain admin point to load balancer</p>
<h4 id="heading-5-scale-your-deployment">5. Scale your deployment</h4>
<pre><code>kubectl scale deployments express-api-deployment --replicas=<span class="hljs-number">3</span> -n express-api-namespace
</code></pre><h5 id="heading-references">References</h5>
<p>https://repost.aws/knowledge-center/eks-alb-ingress-controller-fargate</p>
<p>https://aws.amazon.com/blogs/containers/how-to-expose-multiple-applications-on-amazon-eks-using-a-single-application-load-balancer/</p>
<h4 id="heading-delete-cluster">Delete Cluster</h4>
<pre><code>eksctl <span class="hljs-keyword">delete</span> cluster --region us-west<span class="hljs-number">-1</span> --name express-api
</code></pre>]]></content:encoded></item><item><title><![CDATA[Crear blog con Hexo, Github Pages, Cloudflare SSL]]></title><description><![CDATA[UPDATE 2021
Todos estos pasos son fácilmente reemplazables al importar tu repositorio hexo en vercel, pero si por alguna razón no quieres usar vercel, sigue leyendo.
Para esto necesitamos:

Una cuenta en godaddy.com con un dominio
Una cuenta en cloud...]]></description><link>https://blog.diegocornejo.com/crear-blog-con-hexo-github-pages-cloudflare-ssl</link><guid isPermaLink="true">https://blog.diegocornejo.com/crear-blog-con-hexo-github-pages-cloudflare-ssl</guid><category><![CDATA[blog]]></category><category><![CDATA[cloudflare]]></category><category><![CDATA[SSL]]></category><category><![CDATA[GitHub]]></category><category><![CDATA[JAMstack]]></category><dc:creator><![CDATA[Diego Cornejo]]></dc:creator><pubDate>Fri, 20 Aug 2021 03:04:55 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1629428297247/YTJ_YsO-z.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="update-2021">UPDATE 2021</h2>
<p>Todos estos pasos son fácilmente reemplazables al importar tu repositorio hexo en <a target="_blank" href="https://vercel.com">vercel</a>, pero si por alguna razón no quieres usar vercel, sigue leyendo.</p>
<h2 id="para-esto-necesitamos"><strong>Para esto necesitamos:</strong></h2>
<ul>
<li>Una cuenta en godaddy.com con un dominio</li>
<li>Una cuenta en cloudflare.com</li>
<li>Una cuenta en github.com</li>
<li>Git Bash (https://git-scm.com/downloads) u otra bash en la que puedas ejecutar comandos git</li>
<li>Node JS (https://nodejs.org)</li>
</ul>
<h2 id="proceso"><strong>Proceso</strong></h2>
<h3 id="1-entrar-a-cloudflarecom-y-agregar-un-sitio">1. Entrar a cloudflare.com y agregar un sitio</h3>
<p><img src="https://randomtechguy.vercel.app/images/20190105/1-1.jpg" alt />
<img src="https://randomtechguy.vercel.app/images/20190105/1-2.PNG" alt />
<img src="https://randomtechguy.vercel.app/images/20190105/1-3.PNG" alt />
<img src="https://randomtechguy.vercel.app/images/20190105/1-4.PNG" alt />
<img src="https://randomtechguy.vercel.app/images/20190105/1-5.PNG" alt />
<img src="https://randomtechguy.vercel.app/images/20190105/1-6.jpg" alt />
<img src="https://randomtechguy.vercel.app/images/20190105/1-7.jpg" alt /></p>
<h3 id="2-entrar-a-godaddycom-y-configurar-nameservers">2. Entrar a godaddy.com y configurar nameservers</h3>
<h4 id="configurar-nameservers">Configurar Nameservers</h4>
<p>Click en "DNS"
<img src="https://randomtechguy.vercel.app/images/20190105/2-1.jpg" alt />
En la sección "Nameservers" click en "Change"
<img src="https://randomtechguy.vercel.app/images/20190105/2-2.jpg" alt /></p>
<p>Seleccionar custom y agregar nameservers obtenidos en cloudflare.com</p>
<p>Eliminar cualquier otro nameserver que exista.</p>
<p>Cloudflare nameservers</p>
<ul>
<li>joan.ns.cloudflare.com</li>
<li>nash.ns.cloudflare.com
<img src="https://randomtechguy.vercel.app/images/20190105/2-3.PNG" alt /></li>
</ul>
<h4 id="validar-nameservers">Validar Nameservers</h4>
<p>Según Cloudflare y Godaddy este proceso de cambio de nameservers puede tomar hasta 24 horas,  pero normalmente toma unos pocos minutos, para validar si el cambio se realizó podemos hacerlo de dos formas:</p>
<h4 id="desde-la-cli-o-linea-de-comandos">Desde la cli o línea de comandos</h4>
<p>Abrir la terminal o cmd y pegar el siguiente comando</p>
<pre><code class="lang-sh">$ nslookup -<span class="hljs-built_in">type</span>=ns randomtechguy.com
</code></pre>
<p><img src="https://randomtechguy.vercel.app/images/20190105/2-4.PNG" alt /></p>
<h4 id="desde-la-web">Desde la web</h4>
<p>Ingresar a https://dnschecker.org/
<img src="https://randomtechguy.vercel.app/images/20190105/2-5.PNG" alt /></p>
<h3 id="3-crear-repositorio-en-github">3. Crear repositorio en Github</h3>
<p>Ingresar a github.com y crear repositorio
<img src="https://randomtechguy.vercel.app/images/20190105/3-1.PNG" alt />
Agregar nombre al nuevo repositorio y hacer click en "Create repository"
<img src="https://randomtechguy.vercel.app/images/20190105/3-2.PNG" alt />
<img src="https://randomtechguy.vercel.app/images/20190105/3-3.PNG" alt /></p>
<h3 id="4-verificar-disponibilidad-de-certificado-de-seguridad-ssl">4. Verificar disponibilidad de certificado de seguridad (SSL)</h3>
<p>Para este punto nuestro dominio ya está siendo administrado por cloudflare por lo que contamos con un certificado SSL.
Ingresar a cloudflare.com
Click en nuestrio sitio creado en el paso 1
Click en Crypto y verificamos el estado del certificado, que debería estar activo como muestra la imagen abajo:
<img src="https://randomtechguy.vercel.app/images/20190105/4-1.PNG" alt />
Ir a sección "Always Use HTTPS" y marca la casilla en "On"
<img src="https://randomtechguy.vercel.app/images/20190105/4-2.PNG" alt /></p>
<h2 id="desde-aqui-usaremos-la-consola-o-terminal-o-como-la-llames-d">Desde aquí usaremos la consola o terminal (o como la llames) :D</h2>
<h3 id="5-instalar-hexo-httpshexoio">5. Instalar hexo (https://hexo.io/)</h3>
<p>Abrir la terminal en la que tienes acceso a los comandos git y npm</p>
<pre><code class="lang-sh"><span class="hljs-comment"># Instalar hexo globalmente</span>
$ npm install hexo-cli -g
<span class="hljs-comment"># Iniciar un proyecto hexo</span>
$ hexo init myawesomeblog
<span class="hljs-comment"># myawesomeblog es el nombre de la carpeta que se creará, pueden usar cualquier nombre pero para poder guiarnos mejor vamos a usar el mismo nombre del repositorio que creamos en el paso 3.</span>
<span class="hljs-comment"># Entrar a la carpeta del proyecto e instalar dependencias</span>
$ <span class="hljs-built_in">cd</span> myawesomeblog
$ npm install
<span class="hljs-comment"># Probar nuestro blog creado con hexo</span>
hexo server
<span class="hljs-comment"># Este comando debería retornar lo siguiente</span>
INFO  Start processing
INFO  Hexo is running at http://localhost:4000 . Press Ctrl+C to stop.
</code></pre>
<p>Abrir nuestro navegador en la dirección http://localhost:4000 para ver nuestro nuevo blog
No cierres la terminal la vamos a usar mas adelante.</p>
<p>Los siguientes pasos son basados en el excelente artículo de Jeff Ferrari
https://www.poweredbyjeff.com/2018/05/14/Deploying-Hexo-website-to-Github-Pages/</p>
<h3 id="6-configurar-hexo-para-subir-a-github">6. Configurar hexo para subir a Github</h3>
<h4 id="editar-archivo-configyml">Editar archivo _config.yml</h4>
<p>Editar URL
    url: https://randomtechguy.com #nuestro dominio con https
Editar public dir from public to docs
    public_dir: docs
Comentar configuracion de Deploy</p>
<pre><code><span class="hljs-comment">#deploy:</span>
<span class="hljs-comment">#   type:</span>
</code></pre><h3 id="7-generar-archivos-y-subir-a-github">7. Generar archivos y subir a Github</h3>
<p>Abrir la terminal en la que tienes acceso a los comandos git y npm</p>
<h4 id="generar-archivos">Generar archivos</h4>
<pre><code class="lang-sh"><span class="hljs-comment"># Remover Plugins</span>
$ npm uninstall hexo-generator-cname hexo-deployer-git
<span class="hljs-comment"># Crear archivo CNAME en carpeta source, usar nano, vim o el editor de su preferencia</span>
$ nano <span class="hljs-built_in">source</span>/CNAME <span class="hljs-comment">#Sin extensión todo en mayúsculas</span>
<span class="hljs-comment"># Escribir nuestro dominio en el archivo CNAME</span>
$ <span class="hljs-built_in">echo</span> myawesomeblog.com &gt; <span class="hljs-built_in">source</span>/CNAME
<span class="hljs-comment"># Generar archivos</span>
hexo generate
<span class="hljs-comment"># Este comando generará una carpeta docs en nuestro proyecto</span>
</code></pre>
<h4 id="agregar-origen-remoto-de-repositorio-y-hacer-el-primer-commit">Agregar origen remoto de repositorio y hacer el primer commit</h4>
<p>Puedes ver el artículo completo en la ayuda de Github
https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/</p>
<pre><code class="lang-sh">$ git init
$ git add .
$ git commit -m <span class="hljs-string">"First commit"</span>
<span class="hljs-comment"># Agregar origen remoto URL de nuestro repositorio creado en el paso 3</span>
$ git remote add origin remote https://github.com/diegofcornejo/myawesomeblog.git 
<span class="hljs-comment"># Verificar la nueva URL remota</span>
git remote -v 
<span class="hljs-comment"># Push cambios</span>
$ git push origin master
</code></pre>
<h3 id="8-configurar-github-pages">8. Configurar Github Pages</h3>
<p>Ingresar nuestro repositorio en la web
https://github.com/diegofcornejo/myawesomeblog
Veremos que ahora nuestro repositorio tiene archivos
<img src="https://randomtechguy.vercel.app/images/20190105/8-1.PNG" alt />
Click en el Tab "Settings"
<img src="https://randomtechguy.vercel.app/images/20190105/8-2.PNG" alt />
En la sección "Github Pages" Seleccionar master branch / docs folder y Salvar
<img src="https://randomtechguy.vercel.app/images/20190105/8-3.PNG" alt /></p>
<h3 id="9-finalmente-abrimos-nuestro-navegador-y-escribimos-nuestro-dominio-randomtechguycom-y-veremos-nuestro-blog-funcionando">9. Finalmente abrimos nuestro navegador y escribimos nuestro dominio (randomtechguy.com) y veremos nuestro blog funcionando.</h3>
]]></content:encoded></item><item><title><![CDATA[How to create a blog using Hexo, Github Pages, Cloudflare with SSL]]></title><description><![CDATA[UPDATE 2021
Those this steps are really easy replacement by import your hexo repo into  vercel , but if for any reason you don't want to use vercel, keep reading.
We need:

A godaddy.com account with a domain
A cloudflare.com account
A github.com acc...]]></description><link>https://blog.diegocornejo.com/how-to-create-a-blog-using-hexo-github-pages-cloudflare-with-ssl</link><guid isPermaLink="true">https://blog.diegocornejo.com/how-to-create-a-blog-using-hexo-github-pages-cloudflare-with-ssl</guid><category><![CDATA[blog]]></category><category><![CDATA[cloudflare]]></category><category><![CDATA[SSL]]></category><category><![CDATA[GitHub]]></category><category><![CDATA[JAMstack]]></category><dc:creator><![CDATA[Diego Cornejo]]></dc:creator><pubDate>Sun, 15 Aug 2021 01:19:39 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1628990168690/8P4B6_WxP.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="update-2021">UPDATE 2021</h2>
<p>Those this steps are really easy replacement by import your hexo repo into  <a target="_blank" href="https://vercel.com">vercel</a> , but if for any reason you don't want to use vercel, keep reading.</p>
<h2 id="we-need"><strong>We need:</strong></h2>
<ul>
<li>A godaddy.com account with a domain</li>
<li>A cloudflare.com account</li>
<li>A github.com account</li>
<li>Git Bash (https://git-scm.com/downloads)</li>
<li>Node JS (https://nodejs.org)</li>
</ul>
<h2 id="process"><strong>Process</strong></h2>
<h3 id="1-enter-to-cloudflarecom-and-add-a-site">1. Enter to cloudflare.com and add a site</h3>
<p><img src="https://randomtechguy.vercel.app/images/20190105/1-1.jpg" alt />
<img src="https://randomtechguy.vercel.app/images/20190105/1-2.PNG" alt />
<img src="https://randomtechguy.vercel.app/images/20190105/1-3.PNG" alt />
<img src="https://randomtechguy.vercel.app/images/20190105/1-4.PNG" alt />
<img src="https://randomtechguy.vercel.app/images/20190105/1-5.PNG" alt />
<img src="https://randomtechguy.vercel.app/images/20190105/1-6.jpg" alt />
<img src="https://randomtechguy.vercel.app/images/20190105/1-7.jpg" alt /></p>
<h3 id="2-enter-to-godaddycom-and-config-nameservers">2. Enter to godaddy.com and config nameservers</h3>
<h4 id="setup-nameservers">Setup Nameservers</h4>
<p>Click on "DNS"
<img src="https://randomtechguy.vercel.app/images/20190105/2-1.jpg" alt />
In the section "Nameservers" click on "Change"
<img src="https://randomtechguy.vercel.app/images/20190105/2-2.jpg" alt /></p>
<p>Select custom and add cloudflare's nameservers</p>
<p>Delete any nameserver if exist.</p>
<p>Cloudflare nameservers</p>
<ul>
<li>joan.ns.cloudflare.com</li>
<li>nash.ns.cloudflare.com
<img src="https://randomtechguy.vercel.app/images/20190105/2-3.PNG" alt /></li>
</ul>
<h4 id="validate-nameservers">Validate Nameservers</h4>
<p>According to Cloudflare and Godaddy the process to change nameservers can take up to 24 hours,  but normally take a few minutes, you can validate in two ways:</p>
<h4 id="from-cli">From CLI</h4>
<p>Open the terminal and paste next command</p>
<pre><code class="lang-sh">$ nslookup -<span class="hljs-built_in">type</span>=ns randomtechguy.com
</code></pre>
<p><img src="https://randomtechguy.vercel.app/images/20190105/2-4.PNG" alt /></p>
<h4 id="from-web">From web</h4>
<p>Enter to https://dnschecker.org/
<img src="https://randomtechguy.vercel.app/images/20190105/2-5.PNG" alt /></p>
<h3 id="3-create-a-repo-in-github">3. Create a repo in Github</h3>
<p>Enter to github.com and create repo
<img src="https://randomtechguy.vercel.app/images/20190105/3-1.PNG" alt />
Add a name to your new repo and click on "Create repository"
<img src="https://randomtechguy.vercel.app/images/20190105/3-2.PNG" alt />
<img src="https://randomtechguy.vercel.app/images/20190105/3-3.PNG" alt /></p>
<h3 id="4-verifies-security-certs-availabilityssl">4. Verifies security certs availability(SSL)</h3>
<p>At this time your domain is management by cloudflare so we have an SSL certificate.
Enter to cloudflare.com
Click on your site created at step 1
Click on Crypto and verify certificate status, it should be active like under image:
<img src="https://randomtechguy.vercel.app/images/20190105/4-1.PNG" alt />
Go to section "Always Use HTTPS" and check "On"
<img src="https://randomtechguy.vercel.app/images/20190105/4-2.PNG" alt /></p>
<h2 id="from-here-we-will-use-the-terminal-d">From here we will use the terminal :D</h2>
<h3 id="5-install-hexo-httpshexoio">5. Install hexo (https://hexo.io/)</h3>
<p>Open the terminal</p>
<pre><code class="lang-sh"><span class="hljs-comment"># Install hexo globally</span>
$ npm install hexo-cli -g
<span class="hljs-comment"># Start a hexo project</span>
$ hexo init myawesomeblog
<span class="hljs-comment"># Enter to project folder and install dependencies</span>
$ <span class="hljs-built_in">cd</span> myawesomeblog
$ npm install
<span class="hljs-comment"># Test our new blog</span>
hexo server
<span class="hljs-comment"># This command should return</span>
INFO  Start processing
INFO  Hexo is running at http://localhost:4000 . Press Ctrl+C to stop.
</code></pre>
<p>Open a browser with url http://localhost:4000.
Don't close the terminal, we will use later</p>
<p>The next steps are based on a awesome post by Jeff Ferrari
https://www.poweredbyjeff.com/2018/05/14/Deploying-Hexo-website-to-Github-Pages/</p>
<h3 id="6-setup-hexo-for-upload-to-github">6. Setup hexo for upload to Github</h3>
<h4 id="edit-configyml">Edit _config.yml</h4>
<p>Edit URL
    url: https://randomtechguy.com #your domain with https</p>
<p>Edit public dir from public to docs
    public_dir: docs</p>
<p>Comment deploy config</p>
<pre><code><span class="hljs-comment">#deploy:</span>
<span class="hljs-comment">#   type:</span>
</code></pre><h3 id="7-generate-files-and-upload-to-github">7. Generate files and upload to Github</h3>
<p>Open the terminal</p>
<h4 id="generate-files">Generate files</h4>
<pre><code class="lang-sh"><span class="hljs-comment"># Remove plugins</span>
$ npm uninstall hexo-generator-cname hexo-deployer-git
<span class="hljs-comment"># Create CNAME file in source folder, use nano, vim or your prefer editor</span>
$ nano <span class="hljs-built_in">source</span>/CNAME <span class="hljs-comment">#no extension, all uppercase</span>
<span class="hljs-comment"># The contents of this file should be the domain of your website</span>
$ <span class="hljs-built_in">echo</span> myawesomeblog.com &gt; <span class="hljs-built_in">source</span>/CNAME
<span class="hljs-comment"># Generate files</span>
hexo generate
<span class="hljs-comment"># This commando should generate a folder named docs</span>
</code></pre>
<h4 id="add-remote-origin-and-make-first-commit">Add remote origin and make first commit</h4>
<p>You can see original post in Github Help
https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/</p>
<pre><code class="lang-sh">$ git init
$ git add .
$ git commit -m <span class="hljs-string">"First commit"</span>
<span class="hljs-comment"># Add remote origin URL, use URL from your repo created at the step 3</span>
$ git remote add origin remote https://github.com/diegofcornejo/myawesomeblog.git 
<span class="hljs-comment"># Verifies the new remote URL</span>
git remote -v 
<span class="hljs-comment"># Push changes</span>
$ git push origin master
</code></pre>
<h3 id="8-setup-github-pages">8. Setup Github Pages</h3>
<p>Open your repo on the web
Now should see files in your repo
<img src="https://randomtechguy.vercel.app/images/20190105/8-1.PNG" alt />
Click on Tab "Settings"
<img src="https://randomtechguy.vercel.app/images/20190105/8-2.PNG" alt />
On section "Github Pages" Select master branch / docs folder and Save
<img src="https://randomtechguy.vercel.app/images/20190105/8-3.PNG" alt /></p>
<h3 id="9-finally-open-a-browser-and-write-your-domain-will-see-your-blog-running-on-your-domain">9. Finally open a browser and write your domain, will see your blog running on your domain.</h3>
]]></content:encoded></item></channel></rss>