author avatar

soniya.rayabagi

Mon Jan 29 2024

how to troubleshoot the visibility of an AWS EC2 instance.
discovered that instances may not appear in the console if deployed in a different region , verified instance existence by providing the correct region in the AWS console.
example:


provider "aws" {
 region = "us-east-2"
}

author avatar

satya

Mon Jan 29 2024

if you are using ngrok to expose your localhost , you can serve that in a static domain.
Every time you start ngrok it will use the same domain name


ngrok http --domain=<your-domain>. <port>

author avatar

satya

Sat Jan 27 2024

setup tailwind css without using node.js
The below setup is for macOS arm64

Step1


curl -sLO 
chmod +x tailwindcss-macos-arm64
mv tailwindcss-macos-arm64 tailwindcss


Step2


./tailwindcss init // this will create tailwind.config.js file


Step3
Create input.css file and import the required tailwind base, components & utilities

Step4


./tailwindcss -i input.css -o output.css --watch // this will generate a output.css file, so make sure to link it in your root file


For production add the tailwind watcher command with --minify flag


./tailwindcss -i input.css -o output.css --minify

author avatar

hilda

Thu Jan 25 2024

ChatGPT 4.0 has a limit of 40 messages per 3 hours while using some of the custom GPTs like DALL·E
author avatar

soniya.rayabagi

Thu Jan 25 2024

touch filename : Used to create an empty file .
git remote : The command is used to manage remote repositories.
git reset HEAD~1 : Removes the most recent commit from the current branch without modifying the working directory.
git pull origin branch_name : Fetches changes from the specified branch (branch_name) on the origin remote repository.
author avatar

sujay

Thu Jan 25 2024

Activerecord validations & callbacks are not called when upsert_all or insert_all are used. They will be directly converted to raw sql queries and executed
author avatar

sachin.kabadi

Wed Jan 24 2024

To launch a Rails app on fly.io, you can follow these steps:

1. Make sure you have the flyctl command-line tool installed.

2. Open a terminal and navigate to the root directory of your Rails app.

3. Launch a new fly.io application by running the following command:
flyctl launch

This command will guide you through the process of setting up your fly.io application. You'll be prompted to provide a name for your app and
select the organization you want to associate it with. Refer below.


   Creating app in ~/list
   Scanning source code
   Detected a Rails app
   ? Choose an app name (leave blank to generate one): list
   ? Select Organization: John Smith (personal)
   ? Choose a region for deployment: Ashburn, Virginia (US) (iad)
   Created app list in organization personal
   Admin URL: 
   Hostname: list.fly.dev
   Set secrets on list: RAILS_MASTER_KEY
   ? Would you like to set up a Postgresql database now? Yes
   For pricing information visit: 
   ? Select configuration: Development - Single node, 1x shared CPU, 256MB RAM, 1GB disk
   Creating postgres cluster in organization personal

   . . .

   Postgres cluster list-db is now attached to namelist
   ? Would you like to set up an Upstash Redis database now? Yes
   ? Select an Upstash Redis plan Free: 100 MB Max Data Size

   Your Upstash Redis database namelist-redis is ready.

   . . .

         create  Dockerfile
         create  .dockerignore
         create  bin/docker-entrypoint
         create  config/dockerfile.yml
   Wrote config file fly.toml

   Your Rails app is prepared for deployment.

   Before proceeding, please review the posted Rails FAQ:
   .



4. Once the launch is complete, you can deploy your Rails app to fly.io by running the following command:
flyctl deploy

This command will build a Docker image of your Rails app and deploy it to fly.io. It may take a few minutes to complete the deployment process.

5. After the deployment is finished, you'll see a message indicating that your app has been deployed successfully. It will also display the URL
where your app is accessible.

You can use following cmd to open app.
fly apps open

That's it! Your Rails app is now running on fly.io. You can access it using the provided URL.

6. If you make any changes to your app, you can redeploy it by running following command again.
flyctl deploy
author avatar

sachin.kabadi

Wed Jan 24 2024

To install on macOS using Homebrew and authenticate with flyctl, you can follow these steps:

1. Open a terminal on your macOS machine.

2. Install Homebrew if you haven't already. Run the following command in the terminal:
/bin/bash -c "$(curl -fsSL )"

3. Once Homebrew is installed, you can use it to install flyctl. Run the following command in the terminal:
brew install superfly/tap/flyctl

4. After the installation is complete, you can authenticate with flyctl using the auth login command. Run the following command in the terminal:
flyctl auth login

This will open a browser window where you can log in with your account credentials. Once you log in, the authentication token will be saved on your machine.

5. After successful authentication, you can start using flyctl commands to manage your resources.

That's it! You have now installed on your macOS machine using Homebrew and authenticated with flyctl.
author avatar

sachin.kabadi

Wed Jan 24 2024

Install Tailwind CSS with Ruby on Rails

1. Create your project


  rails new my-project
  cd my-project


2. Install Tailwind CSS


  rails tailwindcss:install


This will generate tailwind.config.js file in the /config directory.

3. Configure your template paths
Add the paths of all your template files to your /config/tailwind.config.js file.


/** @type {import('tailwindcss').Config} */
module.exports = {
  content: [
    './public/*.html',
    './app/helpers/**/*.rb',
    './app/javascript/**/*.js',
    './app/views/**/*',
  ],
  theme: {
    extend: {},
  },
  plugins: [],
}


4. Add the Tailwind directives to your CSS
Add the @tailwind directives for each of Tailwind's layers to your application.tailwind.css file located in the ./app/assets/stylesheets directory.



  @tailwind base;
  @tailwind components;
  @tailwind utilities;


5. Start your build process


  ./bin/dev 


6. Start using Tailwind in your project
Start using Tailwind's utility classes to style your content.

/config/tailwind.config.js file


  const defaultTheme = require('tailwindcss/defaultTheme')

  module.exports = {
    content: [
      './public/*.html',
      './app/helpers/**/*.rb',
      './app/javascript/**/*.js',
      './app/views/**/*.{erb,haml,html,slim}'
    ],
    theme: {
      extend: {
        fontFamily: {
          helvetica: ['Helvetica', 'Arial', 'sans-serif'],
        },
      },
    },
    plugins: [
      require('@tailwindcss/forms'),
      require('@tailwindcss/aspect-ratio'),
      require('@tailwindcss/typography'),
      require('@tailwindcss/container-queries'),
    ]
  }


index.html.erb


<h1 class="container mx-auto mt-16 px-5 font-helvetica flex">
    Hello world!
</h1>


Reference official website for more information.
author avatar

soniya.rayabagi

Tue Jan 23 2024

* Ansible Provisioning :*
Example : Setting up Ansible Provisioning for Nginx Installation on Vagrant:

Step 1: Install Ansible on Your Machine :


sudo apt-get update
sudo apt-get install software-properties-common
sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update
sudo apt-get install ansible


Step 2: Go to your server's /etc/hosts file and add the hostname and the IP address of the host:


hostname    : vagrant 
hostname -I : 10.0.2.15.


Step 3: As Ansible works on the agentless architecture of using SSH to communicate with its hosts, set-up the ssh keys:


ssh-keygen 
cat ~/.ssh/id_rsa.pub
ssh-copy-id root@10.0.2.15.


Step 4: Add the Vagrant SSH Key inside authorized_keys:


sudo nano ~/.ssh/authorized_keys


Step 5: Configure Ansible Hosts , Edit the /etc/ansible/hosts file and add the hostname:


sudo nano /etc/ansible/hosts
vagrant 


Step 6: Verify Connectivity:


ansible -m ping all

output ---> 
vagrant | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "ping": "pong"


Step 7: Write Ansible Playbook for Nginx Installation:


vi nginx-playbook.yml


Step 8: Run the Ansible Playbook:


ansible-playbook nginx-playbook.yml


output :


PLAY [Install and configure Nginx] *************************************************************************************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************************************************************************************************
ok: [vagrant]

TASK [Update apt package cache] ****************************************************************************************************************************************************************************
changed: [vagrant]

TASK [Install Nginx] ***************************************************************************************************************************************************************************************
ok: [vagrant]

TASK [Start Nginx service] *********************************************************************************************************************************************************************************
ok: [vagrant]

PLAY RECAP *************************************************************************************************************************************************************************************************
vagrant                    : ok=4    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Showing 22 to 24 of 71 results