<?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: Renzo Zue</title>
    <description>The latest articles on DEV Community by Renzo Zue (@r3zu3).</description>
    <link>https://dev.to/r3zu3</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%2F600139%2Fa6fe1945-b496-4452-b8b4-9a2fd149fd02.jpg</url>
      <title>DEV Community: Renzo Zue</title>
      <link>https://dev.to/r3zu3</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/r3zu3"/>
    <language>en</language>
    <item>
      <title>EASY CI/CD DEPLOY WITH GITHUB FOR SIMPLE PHP/HTML WEBSITES</title>
      <dc:creator>Renzo Zue</dc:creator>
      <pubDate>Mon, 24 Jan 2022 01:46:27 +0000</pubDate>
      <link>https://dev.to/r3zu3/easy-continuous-integration-with-github-for-simple-phphtml-websites-fd2</link>
      <guid>https://dev.to/r3zu3/easy-continuous-integration-with-github-for-simple-phphtml-websites-fd2</guid>
      <description>&lt;p&gt;ig &lt;a href="https://www.instagram.com/r_zue/"&gt;@r_zue&lt;/a&gt;&lt;br&gt;
twitter &lt;a href="https://twitter.com/re_zue"&gt;@re_zue&lt;/a&gt;&lt;br&gt;
website &lt;a href="https://zueprojects.dev"&gt;zueprojects.dev&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;How does it work?&lt;/li&gt;
&lt;li&gt;
Preparing our web server

&lt;ul&gt;
&lt;li&gt;Cloning the repo&lt;/li&gt;
&lt;li&gt;Creating ssh access pair&lt;/li&gt;
&lt;li&gt;Getting the content of our ssh key pair&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Create github repo secrets

&lt;ul&gt;
&lt;li&gt;Create private ssh key secret&lt;/li&gt;
&lt;li&gt;Create github access token secret&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Add configuration files to the repo&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sometimes we need fast and efficient IC solutions for simple projects. Many platforms like &lt;a href="https://www.netlify.com/"&gt;netlify&lt;/a&gt; allow us to perform these automated CI/CD tasks by linking our repositories to their solutions.&lt;/p&gt;

&lt;p&gt;But what if we need our own CI/CD solutions on our own servers?&lt;/p&gt;

&lt;p&gt;Fortunately, github provides us with a great tool within our repos called &lt;a href="https://github.com/features/actions"&gt;github actions&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In this blog I will explain how to create a simple github action to automate our php/html deployments like CI/CD solutions.&lt;/p&gt;
&lt;h1&gt;
  
  
  How does it work? &lt;a&gt;&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Basically we are going to configure our remote server to allow github to connect to it via ssh and run a git pull on the server's local repository whenever github detects that a push was made to the specified branch so that it will stay in sync with the source branch.&lt;/p&gt;

&lt;p&gt;Following the scheme below:&lt;/p&gt;

&lt;p&gt;local push &amp;gt; github ssh &amp;gt; server pull.&lt;/p&gt;
&lt;h1&gt;
  
  
  Preparing our web server &lt;a&gt;&lt;/a&gt;
&lt;/h1&gt;
&lt;h2&gt;
  
  
  Cloning the repo &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;We must locate the public_html folder of our project and clone our repo using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git clone &amp;lt;REPO_HTTPS_URL&amp;gt; ./
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;code&gt;./&lt;/code&gt;&lt;/strong&gt; It is to avoid the creation of the folder with the name of the repo and clone directly on our location (the folder must be empty).&lt;/p&gt;

&lt;p&gt;We will be asked for the github username and password, for the password we will have to create a &lt;a href="https://github.com/settings/tokens"&gt;personal access token&lt;/a&gt; on github (I will explain it later).&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating ssh access pair &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;We need to create a new ssh key pair for github ssh connection using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ ssh-keygen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will see the following message and it will ask us for a keyname, we can call it as 'github_ci'.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ Generating public/private rsa key pair.
$ Enter file in which to save the key (/root/.ssh/id_rsa): github_ci
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It will ask us for a password, leave it blank and our new key pair will be saved.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ Your identification has been saved in github_ci.
$ Your public key has been saved in github_ci.pub.
$ The key fingerprint is:
$ #####.... etc etc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Getting the content of our ssh key pair &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Now go to the root of your server and list the files using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd &amp;amp;&amp;amp; ls
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will see your new key pair:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ github_ci  github_ci.pub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open the public key:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ nano github_ci.pub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And copy the content and then paste it into:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ nano ~/.ssh/authorized_keys
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now go back to the root path of your server and copy your private key:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ nano github_ci
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Create github repo secrets &lt;a&gt;&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;We need to create some secret values in the github repository so that other participants don't have access to these values, but github actions can use them.&lt;/p&gt;

&lt;p&gt;In the github repository, go to &lt;strong&gt;Settings &amp;gt; Secrets&lt;/strong&gt; and click on "&lt;strong&gt;New repository secret&lt;/strong&gt;".&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cvhFpAGv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/slnyti2fddpvrkulgizi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cvhFpAGv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/slnyti2fddpvrkulgizi.png" alt="github secrets" width="880" height="417"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Create private ssh key secret &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;We will have to keep the previously copied private key as a secret of our repo.&lt;/p&gt;

&lt;p&gt;Name: KEY&lt;br&gt;
Value: previously copied private key&lt;/p&gt;

&lt;p&gt;Then click "&lt;strong&gt;Add secret&lt;/strong&gt;".&lt;/p&gt;
&lt;h2&gt;
  
  
  Create github access token secret &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;To be able to pull the repo from our server we need to create a &lt;a href="https://github.com/settings/tokens"&gt;personal access token&lt;/a&gt; on github. &lt;/p&gt;

&lt;p&gt;Go to your github account dropdown then &lt;strong&gt;Settings &amp;gt; Developer settings &amp;gt; Personal access tokens&lt;/strong&gt; and click on "&lt;strong&gt;Generate new token&lt;/strong&gt;".&lt;/p&gt;

&lt;p&gt;In the &lt;strong&gt;Note&lt;/strong&gt; field put the name of the repo followed by _CI.&lt;/p&gt;

&lt;p&gt;Expiration field set to &lt;strong&gt;No expiration&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Select scopes, select all except &lt;strong&gt;delete_repo&lt;/strong&gt; just for security ;) .&lt;/p&gt;

&lt;p&gt;Then click on "&lt;strong&gt;Generate token&lt;/strong&gt;".&lt;/p&gt;

&lt;p&gt;On the new page copy your new token then go to your repository secrets again and create a new secret called &lt;strong&gt;ACCESS_TOKEN&lt;/strong&gt; and paste your personal access token here. click on "&lt;strong&gt;Add secret&lt;/strong&gt;".&lt;/p&gt;
&lt;h1&gt;
  
  
  Add configuration files to the repo &lt;a&gt;&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Now we need to go to your local repository files and add a new config file for github action workflows&lt;/p&gt;

&lt;p&gt;Create The following directories/file on repo root:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.github &amp;gt; workflows &amp;gt; CI_PUSH.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DMBiRG6m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/62y4soz48s4y822t0583.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DMBiRG6m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/62y4soz48s4y822t0583.png" alt="Repo files" width="237" height="50"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And inside CI_PUSH.yml paste this github action code:&lt;br&gt;
&lt;/p&gt;

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

on:
  push:
    branches: [ &amp;lt;repo_branch&amp;gt; ]

jobs:
  Deploy-Action:
    name: CI-Deploy-Action
    runs-on: ubuntu-latest
    steps:
    - name: executing remote ssh commands using ssh key
      uses: appleboy/ssh-action@master
      with:
        host: &amp;lt;YOUR_SERVER_IP/URL&amp;gt;
        username: &amp;lt;YOUR_SERVER_USER&amp;gt;
        key: ${{ secrets.KEY }}
        port: &amp;lt;YOUR_SERVER_SSH_PORT&amp;gt;
        script: cd &amp;lt;SERVER_PROJECT_PUBLIC_HTML_FOLDER_PATH&amp;gt; &amp;amp;&amp;amp; git pull https://&amp;lt;github_username&amp;gt;:${{ secrets.ACCESS_TOKEN }}@github.com/&amp;lt;github_username&amp;gt;/&amp;lt;github_repo_name&amp;gt; &amp;lt;repo_branch&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Github will replace &lt;code&gt;${{ secrets.VALUE}}&lt;/code&gt; with the secrets we have previously defined in the repository.&lt;/p&gt;

&lt;p&gt;Just replace the data between &lt;code&gt;&amp;lt;&amp;gt;&lt;/code&gt; with yours and we'll have everything set up for testing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;&amp;lt;repo_branch&amp;gt;&lt;/code&gt;&lt;/strong&gt; identifies in which branch github should detect that a push has been made to execute the action and to which branch our server will pull.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;CI_PUSH.yml &amp;gt; jobs &amp;gt; Deploy-Action &amp;gt; steps &amp;gt; with &amp;gt; script&lt;/code&gt; Here we are specifying to github which command to execute on our server via ssh to pull the repo.&lt;/p&gt;

&lt;p&gt;Create some changes in your repository/branch and push then go to github &lt;strong&gt;Repo &amp;gt; Actions&lt;/strong&gt; tab and all your ci actions will be listed here.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ex5q9GFo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/afezx7j979eefzgtsnp1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ex5q9GFo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/afezx7j979eefzgtsnp1.png" alt="Github Actios List" width="880" height="242"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;CI made easy ;)&lt;/p&gt;

</description>
      <category>linux</category>
      <category>github</category>
      <category>html</category>
      <category>php</category>
    </item>
    <item>
      <title>Pure CSS Tooltip</title>
      <dc:creator>Renzo Zue</dc:creator>
      <pubDate>Mon, 22 Mar 2021 00:40:51 +0000</pubDate>
      <link>https://dev.to/r3zu3/pure-css-tooltip-1k3j</link>
      <guid>https://dev.to/r3zu3/pure-css-tooltip-1k3j</guid>
      <description>&lt;p&gt;ig &lt;a href="https://www.instagram.com/r_zue/" rel="noopener noreferrer"&gt;@r_zue&lt;/a&gt;&lt;br&gt;
twitter &lt;a href="https://twitter.com/re_zue" rel="noopener noreferrer"&gt;@re_zue&lt;/a&gt;&lt;br&gt;
website &lt;a href="https://zueprojects.dev" rel="noopener noreferrer"&gt;zueprojects.dev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I am currently working on the development of a CSS framework [&lt;a href="https://github.com/R3zu3/z.css" rel="noopener noreferrer"&gt;Z.CSS&lt;/a&gt;], one of the objectives is to make it as simple, functional and with the least use of js as possible.&lt;/p&gt;

&lt;p&gt;It is very common to use tooltips based on js, but in this approach I leave you the code and some examples to use the tooltips based on pure CSS that I implement for my framework.&lt;/p&gt;

&lt;p&gt;The content of the tooltip is defined in the element through the attribute&lt;/p&gt;

&lt;p&gt;&lt;code&gt;data-tooltip-text="Tooltip Left"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;which is referenced in the css as follows&lt;/p&gt;

&lt;p&gt;&lt;code&gt;content: attr(data-tooltip-text);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I hope it helps for something ;)&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/R3zu3/embed/XWprbEK?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h4&gt;
  
  
  Compatibility
&lt;/h4&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%2Fuploads%2Farticles%2Fekq5wmww0qachxo738q8.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%2Fuploads%2Farticles%2Fekq5wmww0qachxo738q8.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/attr()" rel="noopener noreferrer"&gt;MDN&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>html</category>
      <category>frontend</category>
    </item>
  </channel>
</rss>
