Fueling Curiosity, One Insight at a Time
At Codemancers, we believe every day is an opportunity to grow. This section is where our team shares bite-sized discoveries, technical breakthroughs and fascinating nuggets of wisdom we've stumbled upon in our work.
Jan 29, 2024
To check if an instance is running using Terraform, you can use the following command:
This command displays the current state of your infrastructure as recorded by Terraform. It will show information about the resources that Terraform has created, including details about the EC2 instance, such as its ID, IP address, and other attributes.
terraform show
This command displays the current state of your infrastructure as recorded by Terraform. It will show information about the resources that Terraform has created, including details about the EC2 instance, such as its ID, IP address, and other attributes.
nisanth
Jan 29, 2024
If we want to create an instance in different regions within the same Terraform file, we need to use provider aliases. In Terraform, a single file typically contains one default provider configuration for ‘aws.’ To work with multiple regions, we use provider aliases.
Instead of having two separate provider blocks, we add aliases to them. For example:
This way, we can create instances in different regions using a single Terraform file, and each instance is associated with its respective region through the use of provider aliases
Instead of having two separate provider blocks, we add aliases to them. For example:
hcl
provider "aws" {
alias = "us-east-2"
region = "us-east-2"
}
resource "aws_instance" "example" {
provider = aws.us-east-2
ami = "ami-id"
instance_type = "t2.micro"
}
provider "aws" {
alias = "us-east-1"
region = "us-east-1"
}
resource "aws_instance" "example1" {
provider = aws.us-east-1
ami = "ami-id"
instance_type = "t2.micro"
}
This way, we can create instances in different regions using a single Terraform file, and each instance is associated with its respective region through the use of provider aliases
nisanth
Jan 29, 2024
how to troubleshoot the visibility of an
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:
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"
}
soniya.rayabagi
Jan 29, 2024
if you are using
Every time you start ngrok it will use the same domain name
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>.https://ngrok-free.app|ngrok-free.app <port>
satya
Jan 27, 2024
setup tailwind css without using node.js
The below setup is for macOS arm64
Step1
Step2
Step3
Create input.css file and import the required tailwind base, components & utilities
Step4
For production add the tailwind watcher command with
The below setup is for macOS arm64
Step1
curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-macos-arm64
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
satya
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
hilda
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.soniya.rayabagi
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 executedsujay
Jan 24, 2024
To launch a Rails app on https://fly.io|fly.io, you can follow these steps:
1. Make sure you have the
2. Open a terminal and navigate to the root directory of your Rails app.
3. Launch a new https://fly.io|fly.io application by running the following command:
This command will guide you through the process of setting up your https://fly.io|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.
4. Once the launch is complete, you can deploy your Rails app to https://fly.io|fly.io by running the following command:
This command will build a Docker image of your Rails app and deploy it to https://fly.io|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.
That's it! Your Rails app is now running on https://fly.io|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.
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 https://fly.io|fly.io application by running the following command:
flyctl launch
This command will guide you through the process of setting up your https://fly.io|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: https://fly.io/apps/list
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: https://fly.io/docs/about/pricing/#postgresql-clu
? 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:
https://fly.io/docs/rails/getting-started/dockerfiles/.
4. Once the launch is complete, you can deploy your Rails app to https://fly.io|fly.io by running the following command:
flyctl deploy
This command will build a Docker image of your Rails app and deploy it to https://fly.io|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 https://fly.io|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
Sachin Kabadi
System Analyst
Jan 24, 2024
To install
1. Open a terminal on your macOS machine.
2. Install Homebrew if you haven't already. Run the following command in the terminal:
3. Once Homebrew is installed, you can use it to install
4. After the installation is complete, you can authenticate with
This will open a browser window where you can log in with your
5. After successful authentication, you can start using
That's it! You have now installed
https://fly.io|fly.io
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 https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
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
https://fly.io|fly.io
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 https://fly.io|fly.io
resources.That's it! You have now installed
https://fly.io|fly.io
on your macOS machine using Homebrew and authenticated with flyctl
.Sachin Kabadi
System Analyst
Showing 28 to 30 of 77 results
Ready to Build Something Amazing?
Codemancers can bring your vision to life and help you achieve your goals
- Address
2nd Floor, Zee Plaza,
No. 1678, 27th Main Rd,
Sector 2, HSR Layout,
Bengaluru, Karnataka 560102 - Contact
hello@codemancers.com
+91-9731601276