Sunday, July 28, 2024

Github Actions - CI/CD for React.js

 1. Install gh-pages npm package

Command: npm install gh-pages --save-dev

2. In package.json, add the homepage url

"homepage": "https://skyairwater.github.io/react-google-sheet-cms"

3. In package.json, under "scripts" section, add below line

"deploy": "gh-pages -d build"

4. Go to your repository in github and select "Actions"

5. Search for the workflow "node.js" and click configure button

6. In the editor, change the node-version to your value, eg:21.x

7. Click on "Commit changes" and it will add the node.js.yml file under .github folder in your branch

8. Pull changes to your local

9. Go to gh-pages npm package website https://www.npmjs.com/package/gh-pages and scroll all the way down

copy the below code to node.js.yml and align it properly

- name: Deploy with gh-pages
  run: |
    git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
    npx gh-pages -d build -u "github-actions-bot <support+actions@github.com>"
   env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

10. Go to github repository settings => actions => general and under Workflow Permissions, select "Read and Write Permissions" radio button

11. Go to github repository settings => pages
Under Build and Deployment section, select the source as "Deploy from a branch"
Select the branch as "gh-pages" and /root and click save button

Tuesday, March 26, 2024

AZ-104

  • Microsoft Azure is huge and it has hundreds of services underneath its umbrella
  • It's actually going to be quite difficult to comprehend every offering
  • It's very hard to imagine somebody as being an absolute expert in all of the areas of Azure
  • Most Azure services depend on one or more of the below core services    
  • Core Services
    • Virtual Machines
    • Virtual Networking
    • Storage
  • Azure CLI vs Powershell - to install on local machine, download them
    • Powershell commands are not case sensitive
    • If you have "windows powershell", it is old version
    • The latest one is "Powershell 7.4.1"
    • Open windows powershell and run the below command which will install powershell 7
    • winget install --id Microsoft.Powershell --source winget
    • Check if any Az modules are installed
      • Get-InstalledModule -Name Az -AllVersions | Select-Object -Property Name, Version
    • Install Az module
      •  Install-Module -Name Az -AllowClobber -Force

  • Azure cloud shell (available in web browser portal - no need to install anything on local machine)
    • Azure Cloud Shell requires an Azure file share to persist files

Monday, March 4, 2024

Seeing Apache2 page in your website?

 I host one of the non-profit website on Linode Ubuntu VM using nginx server. All of a sudden, I started seeing Apache2 Default page when I visit my website. Seems like the hosting provider installed Apache on my virtual machine by default during fresh install.

To fix this issue

  • Stop apache service - sudo /etc/init.d/apache2 stop
  • Restart nginx - sudo systemctl restart nginx
To check the status of nginx, use the command - systemctl status nginx.service

Github Actions - CI/CD for React.js

 1. Install gh-pages npm package Command:  npm install gh-pages --save-dev 2. In package.json, add the homepage url "homepage": &q...