Running Rails Migrations in AWS ECS Using AWS CLI

AWS ECS (Elastic Container Service) is a powerful Amazon Web Service that allows you to deploy Docker containers on various infrastructure options, including EC2 instances, Fargate (serverless containers), or even self-hosted servers. Being deeply integrated with AWS, ECS offers a cost-effective and seamless solution for managing containers in the Amazon ecosystem.

This guide assumes you are familiar with ECS and already have a task definition set up for your Rails application. Additionally, it assumes you know how to find your subnet ID and security group ID, as these will be required when running containers in your specific environment.

Setup on Demand Tailscale Exit Node Using Terraform and DigitalOcean

Over the past two years since I began using Tailscale, it has become an invaluable tool. Tailscale has enabled me to achieve many tasks that previously required complex setups. One of the most significant achievements was being able to SSH into my home development machine directly from my phone šŸ˜„.

By connecting my phone to Tailscale and using JuiceSSH, an Android app for SSH access, I could SSH into my home machine, deploy applications, and run maintenance scriptsā€”all from my phone. Peaceful trips away from my desk.

Remote Development Made Simple

Tailscale has also made remote development seamless. By installing Tailscale on a laptop, I was able to use VS Code’s Remote Development feature to access my home development machine via SSH. This setup allowed me to work from any laptop without the need to install databases or development tools locally. Even a basic Chromebook or an ultra-light laptop turned into a powerful development workstation, as all the actual computing happened on my home machine over SSH.

I even took it a step further by installing code-server on my dev machine. This allowed me to access a full-fledged development environment from my samsung tablet via Tailscale.

What is Tailscale?

For those unfamiliar, Tailscale is a VPN software based on WireGuard. It allows you to create a secure network between your devices effortlessly. All you need to do is install Tailscale on your device, start the program, and your device joins the networkā€”no advanced configuration required. Itā€™s an easy-to-use, straightforward VPN solution.

By connecting my devices and home lab to this VPN, I gained the ability to access my computers remotely from anywhere.

Using an Exit Node for Secure Browsing

Tailscale allows you to set up one of your devices as an exit node. This means that when you’re using another device, you can route all your internet traffic through the exit node. For example, when Iā€™m traveling, I set up my home computer as an exit node, ensuring that my internet traffic behaves as if I’m accessing it from home. This not only secures my browsing but also obscures my activities from public networks like those at hotels, cafes, or Airbnbs, as all they see is traffic going to Tailscaleā€™s network, fully encrypted.

Note: Tailscale attempts to establish direct connections between devices. When thatā€™s not possible, it uses relay servers.

Change Action Mailer Settings From Rails Console

In Rails applications, ActionMailer is a powerful module used to send emails. Itā€™s essential to configure your ActionMailer settings correctly to ensure that your application can send emails reliably through your chosen SMTP server. Typically, these settings are configured in your environment files (e.g., config/environments/production.rb). However, there may be instances where you need to override these settings temporarily through the Rails consoleā€”for example, when testing a custom configuration or troubleshooting email delivery issues.

Test Scanner (scanner emulator) in SANE - Linux

2024 Hacktoberfest has begun, and I decided to dive into some open-source contributions! One project that caught my eye was the Scanner Server. It offers a web interface for using scanners, which seemed pretty interesting.

I was eager to contribute but quickly realized I didnā€™t have a scanner to test it with šŸ˜…. Fortunately, Linuxā€™s SANE (Scanner Access Now Easy) software comes to the rescue! It includes a feature that lets you select a test scanner model. With this, you always have a virtual scanner called ā€œtestā€ available. While it only scans a black image, it behaves just like a real scanner for all practical purposes.

Using Docker to export & import data from Amazon RDS

Docker is an efficient way to use command-line tools without needing to install them or their required libraries. Recently, I had a use case where I needed to take an SQL dump of a schema from a PostgreSQL database. The problem was that the PostgreSQL DB was version 16.3, while my local DB was only version 15. Using my local pg_dump to access the remote database resulted in a version incompatibility error. To fix this, I would either need to upgrade pg_dump or have both versions installed simultaneously on my machine. I didn’t want to do either. This is where Docker came to the rescue.