Migrate Heroku Postgres Database to AWS RDS - the Complete Guide

Blog posts

How to Optimize MEV Arbitrage Smart Contract with Yul and Huff

Minimizing gas usage directly impacts the profitability of your MEV bot. In this blog post, we will start with a straightforward but nonoptimal approach for swapping two UniswapV2 pairs and gradually improve it. We will start with Solidity-level fixes and later descend into the lower layers of the Ethereum EVM with Yul and Huff assembly languages.

How to Simulate MEV Arbitrage with REVM, Anvil and Alloy

EVM simulation engine is a core component of any competitive MEV strategy. In this tutorial, I'll describe how to use Anvil and its lower-level counterpart REVM to detect UniswapV3 MEV arbitrage opportunities. We will implement a working proof of concept using alloy-rs (a successor to ethers-rs). I'll also discuss techniques for improving the performance and scalability of REVM-based simulations.

How learning Rust changed my Ruby Workflow

For the last few months, I've been working semi-full-time on my first Rust project. After the first painful weeks of struggling against The Compiler, I feel I'm now spoiled by Rust development experience. In this blog post, I'll describe improvements to my Ruby workflow that originate from what I've seen in the Rust ecosystem.

How to Improve Rails Caching with Brotli Compression

Caching is an effective way to speed up the performance of Rails applications. However, the costs of an in-memory cache database could become significant for larger-scale projects. In this blog post, I'll describe optimizing the Rails caching mechanism using the Brotli compression algorithm instead of the default Gzip. I'll also discuss a more advanced technique of using in-memory cache for extreme performance bottlenecks.

Five Easy to Miss Performance Fixes for Rails Apps

Improving the performance of a Rails application can be a challenging and time-consuming task. However, there are some config tweaks that are often overlooked but can make a significant difference in response times. In this tutorial, I will focus on a few quick & easy fixes that can have an immediate impact on the speed of your Rails app.

How to Freeze ETH and ERC20 Tokens using Smart Contract

I’m still the kind of person that buys $500 worth of Dogecoin, and one day later, panic sells with a 30% loss. That's why, I’ve developed Ethereum smart contracts that make speculating on cryptocurrencies less stressful. Locker smart contracts allow me to freeze crypto assets and only release them when enough time has passed or the price has reached a predefined value. This approach sacrifices liquidity for peace of mind, and for me, that’s a perfect tradeoff! In this article, I’ll describe this project and the risks associated with using it or basically any Smart Contract.

How to Find, Debug and Fix N+1 Queries in Rails

Fixing N+1 issues is often the lowest-hanging fruit in optimizing a Rails app performance. However, for non-trivial cases choosing a correct fix could be challenging. Incorrectly applied eager loading does not work or even worsens response times. In this blog post, I describe tools and techniques I use to simplify resolving N+1 issues.

How to Subscribe to YouTube Channels Without an Account

I'm extremely cautious with YouTube. I've lost countless hours because of their flawless recommendation algorithms. In one of my previous posts, I describe how to cripple recommendations UI and start using YouTube more deliberately. I also prefer to use YouTube without logging in, but it makes following my favorite channels difficult. So in this tutorial, I describe how to over-engineer your way to subscribing to YouTube channels without having an account.

Easy to Overlook Way to Break Eager Loading in Rails Apps

In theory, configuring eager loading to avoid N+1 issues is straightforward. Chaining includes method is usually enough to ensure that all the relations data is fetched efficiently. However, this rule breaks for some easy-to-overlook edge cases. In this blog post, I'll describe how to eager load ActiveRecord relations using custom SQL ORDER BY sorting.

How to Monitor and Fix PostgreSQL Database Locks in Rails

PostgreSQL database locks usually work seamlessly until they don't. Before your Rails app dataset and traffic reach a certain scale, you're unlikely to face any locks-related issues. But if your app suddenly slows down to a crawl, deadlocks likely are to blame. In this blog post, I'll describe how to monitor database locks and propose best practices to prevent them from causing issues.

Easy to Miss Way to Optimize ActiveRecord SQL Memory Usage in Rails

By default, Rails ActiveRecord executes most of the SQL queries in a non-optimal way. In this blog post, I'll describe how to fix this issue to speed up bottlenecks and reduce memory usage.

Rails Quick Tip - Use Private Debugging Aliases

I don't like to type much. Even minor improvements in your debugging workflow are likely to accumulate into huge keystrokes savings over time. In this blog post, I'll describe a simple way to add debugging shortcuts to the project without modifying the codebase shared with other team members.

The In-depth Guide to Caching ActiveRecord SQL Queries in Rails

Caching might seem a perfect solution to speed up slow database queries. However, caching in Rails apps can be easily misused, leading to poor maintainability or even slower performance than without it. In this blog post, I'll discuss the common pitfalls of caching SQL queries in Rails apps. I'll also describe my toolkit for assessing the cacheability of database queries and techniques for reducing the cost of caching infrastructure.

Simple View Presenter Pattern in Rails without using Gems

What's the size of user.rb file in your current project? The default Rails way model-view-controller architecture often leads to a bloated model layer. Presenter pattern is one of the more straightforward ways to slim down your Rails models. It also helps to reduce the logic in the view layer and makes testing easier. In this blog post, I'll describe how to implement a presenter pattern without including additional gem dependencies.

5 Easy to Miss Security Best Practices for Web Apps

Worrying about your app's quantum resistance is a perfectly legitimate concern. But, in this blog post, I'll take a step back and describe and few simple but easy-to-overlook security tips. In many cases, a single line of config can protect your web application from a range of attacks.

How to Create ERC20 Meme Token and Bootstrap Uniswap Liquidity

I've recently learned that taking investment advice from Hard Rock Nick is not always lucrative... In this blog post, I'll describe a step-by-step process for releasing an ERC20 meme token on the Ethereum network. By creating a token, you can better understand the inner workings of crypto scam schemes. And distinguish potentially genuine projects from outright scams. Additionally, we'll make our token tradeable by bootstrapping liquidity on permissionless AMM Uniswap contracts. I'll also demonstrate how to manipulate the initial capitalization so that you can instantly become a crypto millionaire.

How to Run ETH 2.0 Geth Full Node on AWS EC2 with Nginx, SSL and WSS after the Merge

A full Ethereum node is often necessary for development purposes or if you don't want to rely on 3rd parties like Infura for blockchain access. Compared to the Ethereum killers, running a full ETH node is relatively affordable and requires only a basic dev ops skillset. In this blog post, I'll describe a step-by-step process to setup a full Geth node on AWS EC2. We'll discuss hardware costs and configure HTTPS NGNIX proxy for using Metamask wallet with your proprietary node. This tutorial covers Geth version 1.10.26, so it applies to ETH 2.0 protocol version after the Merge. I won't delve into details but focus on the necessary minimum to get your node up and running quickly.

Intro to Thread-Safety in Ruby on Rails

Ensuring thread safety is critical if you want to build a performant Rails app. Unfortunately, threading-related bugs are often sneaky and only manifest in highly concurrent production environments. In this blog post, we'll discuss code examples that are not thread-safe. I'll also describe a toolkit for debugging and discuss possible solutions. Developing an eye for spotting these errors before shipping to production can save you a lot of headaches.

The In-depth Guide to ActiveRecord load_async in Rails 7

Rails 7 introduces ActiveRecord load_async method that runs SQL queries asynchronously in the background thread. This seemingly simple change of just adding a single new method that takes no arguments has profound implications for database layer interactions. In this tutorial, we'll deep dive into the intricacies of this new load async API. We'll discuss lazy-loaded queries, Ruby threading model, blocking IO, database pool vs. max connections limit, and performance impact of concurrent database clients. I'll also try to suggest scenarios where introducing async SQL queries could have the most benefit without sacrificing the stability of your Rails app.

Ruby Quick Tip - Use Deep Fetch for Nested Hash Values

Hashes are the most common data structures in Ruby and Rails apps. In this tutorial, I'll describe a simple tip that makes working with hash values less prone to errors. It also improves code readability and provides a unified way of handling data structure issues.

Rails Quick Tip - Display Current Environment in Console Prompt

Am I the only programmer who once or twice messed up production by thinking it was development? In this short tutorial, I'll describe a simple way to reduce the risk of mixing up your current working Rails environment.

Easy to Miss Way to Irreversibly Lose AWS S3 Data

Many web apps use AWS S3 buckets for storing static assets like PDFs and images. Unfortunately, the default config makes it just too easy to irreversibly lose all the data. For many projects, it would probably mean that all the team can pack their bags and go home. Read on if you want to find out how you can accidentally or maliciously obliterate S3 production data. We'll also learn how to safeguard your project from these tragic scenarios using replication backups to a secondary AWS bastion account.

Five Easy to Miss PostgreSQL Query Performance Bottlenecks

PostgreSQL query planner is full of surprises, so a common-sense approach to writing performant queries is sometimes misleading. In this blog post, I'll describe examples of optimizing seemingly obvious queries with the help of EXPLAIN ANALYZE and Postgres metadata analysis.

How to Spend Less Time on YouTube

Maybe I'm paranoid. But, I think there's a lot of smart people out there dedicating their life's work to make others keep watching videos. Since YouTube's incomprehensible decision to remove dislikes count it's become even easier to waste time on worthless content. In this blog post, I'll describe a simple trick that helped me start using YouTube in a more deliberate and focused manner.

Using Dynamic Config Variables in Ruby on Rails Apps

Config variables should never be embedded directly in the codebase. It is a common practice to extract them into a separate configuration layer. A standard approach for Ruby on Rails apps is to use static ENV variables that can only be changed via a release process. In this blog post, I'll describe the use cases for using dynamic config variables that can be modified on the fly. I'll also share a simple way to start using them in your app without including additional gem dependencies.

Hunting for Rare NFTs in the Ethereum Dark Forest

Ethereum mempool, a.k.a Dark Forest, is where most transactions are submitted before inclusion in the public blockchain. By analyzing its contents, you can react to pending transactions ahead of other bots and users. In this blog post, I'll describe how you can leverage mempool analysis to snipe rare NFT tokens before the gas wars break out.

My Recipe for Optimizing Performance of Rails Applications

Rails performance audits and tuning have been my main occupation and source of income for over a year now. In this blog post, I'll share a few secrets of my trade. Read on if you want to learn how I approach optimizing an unknown codebase, what tools I use, and which fixes are usually most impactful. You can treat this post as a generalized roadmap for your DIY performance audit with multiple links to more in-depth resources.

5 Productivity Tips for Lazy Ethereum Blockchain Developers

Working with Ethereum blockchain is vastly different from any tech stack that I've encountered before. In this blog post, I'll describe a set of tools and techniques that I wish I knew when I started building my first Solidity project. We'll discuss how to use the Mainnet without paying gas fees, apply advanced debugging to local transactions and steal all the Vitalik's Ether.

asdf and Docker for Managing Local Development Dependencies

Have you ever updated a database for one project just to discover that you accidentally broke another? Ensuring the isolation between your local dependencies can save you hours of rolling back a breaking update or resolving intertwined dependencies. In this blog post, I describe how you can manage your local development stacks using Docker containers and asdf.

Building Permanent and Uncensorable Blog with Ethereum ENS and IPFS

The internet nowadays is ephemeral. Layers upon layers of trusted 3rd parties are necessary to distribute content online. It requires ongoing maintenance and is susceptible to censorship or hostile takedowns. In this blog post, I describe the steps I took to host my blog in a trustless, permanent, and censorship-resistant way using the IPFS network and Ethereum blockchain.

Deploying My First Ethereum Smart Contract for Fun and Profit

I'm the kind of person that buys $500 worth of Dogecoin, and one day later, panic sells with a 30% loss. Recently, I've deployed my first Ethereum smart contract to help optimize this buy high, sell low investment strategy. Read on if you want to learn about my first steps in the ETH and blockchain ecosystem.

How to Monitor Sidekiq Process Uptime in Rails Apps

Things usually work until they don't. Sidekiq background job process can explode, quietly turn off, or get stuck for a variety of reasons. Random network errors, misconfigured email clients, shortage of RAM, or disk space on Redis to name a few. Adding a correct monitoring infrastructure can save you a lot of headaches and angry calls from customers. In this blog post, I'll describe a simple way to monitor the uptime and responsiveness of Sidekiq processes in Rails apps.

PostgreSQL EXPLAIN ANALYZE for Web Developers Part 1 - Indexes

Interpreting the output of SQL EXPLAIN ANALYZE might seem like dark magic at first. I'm starting a series of blog posts where I'll be well... explaining it based on common use cases from web applications. Read on if you've ever wanted to start using EXPLAIN ANALYZE for debugging slow PostgreSQL queries but did not manage to wrap your head around it. In the first part, we'll discuss how the PostgreSQL query planner decides whether to use an index.

4 Non-standard Ways to Fix N+1 SQL Queries in Rails

I'm not sure if the world needed another post about N+1 queries in Ruby on Rails. To make up for the cliche topic, I'll describe less common solutions to this problem. Read on if you want to learn how to reduce the number of cascading N+1 SQL queries without using includes or additional table join operations.

How to Improve GDPR Compliance for Web Apps using AWS

Your app must comply with GDPR (General Data Protection Regulation) even if you are not located in the EU. It is enough that you have European users. In this blog post, I'll describe eight ways to improve the GDPR compliance for your web app. Implementing the following techniques by itself will not make your app GDPR compliant. However, if you don't have them in place, it means that there's a severe loophole in your app's security and compliance.

How Blogging Changed My Programming Career

This is my 50th post published on this blog. To celebrate, I'll go all meta and describe the ins and outs of my blogger's career. Read on if you ever wanted to start writing but never got around to actually hitting the publish button. This post aims to encourage you that blogging can be loads of fun and open up a whole range of opportunities for your career.

How to Avoid the Most Dangerous Word in Software Development

J-U-S-T. Those four characters can be significantly detrimental to a software development process. In this blog post, I’ll describe how the “just keyword” can affect team’s communication and how to avoid misusing it on Slack.

UUID Primary Key in Elixir Phoenix with PostgreSQL and Ecto

UUID also known as GUID is an alternative primary key type for SQL databases. It offers some non-obvious advantages compared to standard integer-based keys. Phoenix provides reliable support for working with UUID using its Ecto PostgreSQL adapter. In this tutorial, we will dive deep into UUIDs with all their cons and pros.

Why it's Critical to add Secondary Backups for AWD RDS Database

AWS RDS is a cloud relational database. It's suitable for both early-stage startups and Web-Scale companies. One catch is that it’s possible to irreversibly loose all your data if you're using it. In this blog post, I'll describe why the default backup system offered by RDS is insecure and how to improve it.

How to Free Disk Space on MacBook used for Development

Installing or updating an app (ahem, ahem XCode...) on macOS is sometimes surprisingly difficult because of missing disk space. In this blog post, I'll describe various ways to quickly and safely clean vast amounts of storage on a Mac Book used for web development.

Low Hanging Fruits in Frontend Performance Optimization

In this blog post, I describe the often-overlooked techniques that can significantly improve your web app's overall performance. These tips apply to all the web technologies like Ruby on Rails, NodeJS, Python Django, or Elixir Phoenix. It does not matter if you render an HTML or serve an API consumed by the JavaScript SPA framework. It all comes down to transferring bytes over the HTTP protocol. Frontend performance optimization is all about making this process as efficient as possible.

How to Setup Pi-hole on a Local Computer without Raspberry Pi

Pi-hole is an excellent tool for blocking advertisements and trackers in your local network. The typical setup is to install it on a separate Raspberry Pi and proxy your network traffic through it. If you don't have a Raspberry Pi or don't want to do a more involving setup, you can run Pi-hole on your local computer in a Docker container. Let me explain how to do it in this quick tutorial.

Why You Should Migrate your Heroku Postgres Database to AWS RDS

Heroku PostgreSQL addon is excellent for a quick start setup of a new project. Once your web app matures, then migrating to an alternative database engine like Amazon RDS should be considered. In this blog post, I'll describe the benefits and drawbacks of using AWS RDS instead of the default Heroku addon. I'll also compare the pricing, available features, performance characteristics and explain why projects that care about EU GDRP compliance should avoid using the Heroku database.

Tuning PostgreSQL Query Performance with PG Extras

PostgreSQL database queries are a common performance bottleneck for web apps. Before you resort to more complex optimization techniques like caching or read replicas, you should double-check if your database engine does not need tuning and queries are not underperforming. In this blog post, I present a step by step guide on using PG Extras library to spot and resolve common PostgreSQL database performance issues.

How to Improve ActiveRecord Query Performance with Subquery Caching

Slow database queries are a common performance bottleneck for Ruby on Rails apps. Simplifying a complex query is often not possible due to the underlying business logic. Instead, you can extract parts of a query, cache and reuse them to improve performance. In this tutorial, I'll describe a range of techniques on how to do it.

Postgres Indexes for ActiveRecord Join Tables in Rails Apps

Join tables are a common citizen in Ruby on Rails apps. Their use case is to provide many to many relation between database models. Adding correct Postgres indexes on join tables is not obvious. I've noticed that some tutorials, Stack Overflow posts, and even Rails itself provide incorrect advice on how to do it. In this tutorial, we'll look into how compound Postgresql indexes work and how to correctly use them with join tables.

Brotli and Gzip Compression for Assets and JSON API in Rails

HTTP content compression has a significant impact on the client-side performance of a web app. In this blog post, I'll describe different methods for compressing dynamic and static content in Ruby on Rails apps using Gzip and Brotli algorithms.

Secure EC2 SSH Access for Dynamic IP with Ephemeral Security Groups

Leaving inbound EC2 SSH ports open greatly increases the risk of unauthorized entities running commands on the server. In the perfect world, each developer with access rights would use only a single static IP address. You could whitelist it in an AWS security group in addition to using standard SSH keys based authentication.

How I Fight my Internet and Mobile Addiction

Mindlessly checking social networks, watching YouTube, and permanently distracted by push notifications. Have you been there? In my least technical post so far, I'm going to share a couple of tips on tackling the internet and smartphone addiction.

4 Ruby on Rails Mistakes that could Kill Your Production Servers

In this tutorial, I’ll describe a couple of non-obvious Ruby on Rails mistakes that could bring down your production system. They are so sneaky that they could get past the review process of even more experienced developers. Please don't ask me how I know them.

Concurrency for HTTP Requests in Ruby and Rails

Ruby MRI does not support parallel CPU bound operations due to the dependency on non-thread safe C extensions. Input/Output operations like HTTP requests, are still a perfectly valid use case for spinning up multiple threads. Read on to learn what tools are available for requests concurrency in Ruby with all their cons and pros.

Inheritance and Abstract Class Pattern for Ruby on Rails Controllers

Inheritance is often frowned upon, because of the banana and jungle metaphor. In some scenarios, it can be a viable alternative to modules composition for sharing behavior. In this tutorial, I will describe a practical use case where using abstract base class pattern plays well with Ruby on Rails controllers layer.

UUID Primary Key in Rails 6 with PostgreSQL and Active Record

UUID also known as GUID is an alternative primary key type for SQL databases. It offers some non-obvious advantages compared to standard integer-based keys. Rails 6 release fresh out of beta introduces a new feature in ActiveRecord that makes working with UUID primary keys more straightforward. In this tutorial, we will dive deep into UUIDs with all their cons and pros.

Getting Started with AWS S3 IAM Policies Security Config for Rails Apps

Storing files on S3 is for many developers, the first contact with AWS cloud. Unfortunately, the quick and easy configuration can be insecure. If you are uploading files to an S3 bucket but never configured a custom AWS IAM policy it's possible that there's a security issue in your app. In this tutorial, I will describe what IAM policies are and how to securely configure them when working with S3 in the Rails apps.

The Road to $10,000 Profit from my Side Project Slack Bot

My side project Slack app Abot has recently reached a milestone of $10,000 total profit. In this blog post, I describe how the project has changed during the last year and what I am doing to grow and promote it. I also share some details about the usage stats and revenue.

A Simple Way to Encrypt Data in Rails without Gem

Storing sensitive data in plaintext can seriously harm your internet business if an attacker gets hold of the database. Encrypting data is also a GDPR friendly best practice. In this blog post I describe a simple way to securely encrypt, store and decrypt data using built in Ruby on Rails helpers instead of external dependencies.

How to Backup Heroku Postgres Database to an Encrypted AWS S3 Bucket

Heroku offers a robust backups system for it's Postgres database plugin. Unfortunately, you can irreversibly lose all your data and backups just by typing a single command. It might seem improbable, but still, I would rather not bet my startup's existence on a single faulty bash line. In this tutorial, I will describe how to set up a proprietary redundant Heroku PostgreSQL backups system to a secure AWS S3 bucket.

Best SEO Tips & Tools for Blogging Programmers in 2020

I've noticed that many programming blogs I read don't implement certain simple SEO techniques, and bloggers could be missing valuable traffic opportunities. I will describe a couple of search engine optimization tips which can improve your technical blog's SEO ranking and search results position in 2020. I will cover topics like Google's Featured Snippets, best rendering speed tips and social media meta tags.

Continuous Integration and Deployment for Rails using CircleCI

Continuous integration and delivery pipeline can have a significant impact on the dev team's productivity and stability of production releases. In this tutorial, I describe how to automate testing, security checks, and deployments for Ruby on Rails apps using CircleCI. I cover a basic CI setup as well as more advanced features like concurrent specs, dependencies caching, NodeJS/Webpack setup, Heroku deployments, and GitHub integration.

Rails ActiveRecord PostgreSQL Foreign Keys and Data Integrity

Most Ruby developers work with Rails and Active Record for PostgreSQL database interactions. It provides a ton of magic and is simple to start with. Data integrity problems start creeping up once the code base and database structure gets older. In this blog post, I will describe a couple of techniques for ensuring data integrity and validation in Ruby on Rails web apps. We'll cover adding foreign keys, database level validations and more.

Screencast - Sublime Text Mouse-Free Development Advanced Productivity Tips

Sublime Text is my editor of choice for developing Ruby on Rails and JavaScript web apps. In this screencast, I present a couple of more advanced productivity tips and configs that let you minimize the usage of mouse during development.

Active Admin Gem Tips and Performance Tuning for Rails Apps

Active Admin gem is a popular tool for building admin interfaces in Ruby on Rails apps. In this tutorial, I will describe a couple of less obvious tips and performance tuning techniques.

Optimize Dokku Deployment Speed for Ruby on Rails with Dockerfile

Dokku lets you setup Rails hosting infrastructure on a simple VPS without much dev ops experience. Although it is easy to get started, a default config might result in very slow and unreliable deployments. In this blog post, I will describe how I've improved my Dokku based Ruby on Rails (NodeJS with Yarn and Webpack) application deployment speed by over 400% using a Docker image Dockerfile.

Screencast - Showcase of Focus Board, Visual Web Scraper Prototype

In this screencast, I present a prototype of my new side project. It is a simple tool that allows you to visually scrape interesting parts of different websites to create your personal internet dashboard. I want to probe the interest before releasing a public MVP version.

Remove AMP and don’t Affect SEO Rating, Organic Traffic, Performance

I've used to recommend supporting Google AMP pages as a reliable way to increase site SEO rating, organic traffic and performance. Recently I've removed AMP from my website. In this blog post, I will describe how it affected my blog and a couple of more advanced web performance optimization techniques I am using instead of a proprietary standard like Accelerated Mobile Pages.

Setup ELK for NGINX logs with Elasticsearch, Logstash, and Kibana

ELK Elastic stack is a popular open-source solution for analyzing weblogs. In this tutorial, I describe how to setup Elasticsearch, Logstash and Kibana on a barebones VPS to analyze NGINX access logs. I don't dwell on details but instead focus on things you need to get up and running with ELK-powered log analysis quickly.

Screencast - How to Write and Promote a Programming Blog Post

In this screencast, I explain how to write, release and promote a programming blog post on various social platforms even if you don't have an audience yet. I present my typical routine and tools I use when submitting a new post.

Hosting Static Site on Dokku with Free Cloudflare CDN and SSL

Dokku is dev ops for dummies and a simple way to deploy websites on a barebones VPS. In this tutorial I will describe how to use it to host a static site, and setup global assets caching with free Cloudflare CDN and SSL certificate.

Adding GDPR Compliance to My Rails App and Technical Blog

New data privacy GDPR EU regulations are going live in less than two weeks. In this blog post, I will describe actions I took to add GDPR compliance to my Ruby on Rails SAAS app and this blog itself.

Screencast - My Ruby on Rails IDE editor Workflow, Productivity Tips and Tools

In this screencast, I implement an improvement to subscription payments handling in my side project Abot. I show my typical Ruby on Rails IDE workflow, productivity tools, and techniques.

Quick Tip - Boost Your Productivity with Ruby on Rails Console Aliases

Recently I've started using a productivity technique which saves me a lot of unnecessary typing when working with Rails apps. In might seem trivial but I still wanted to share it because it makes my everyday work easier.

Direct, Secure Rails Client-side File Uploads to AWS S3 Buckets

Many Ruby on Rails apps use Amazon AWS S3 buckets for storing assets. When dealing with files uploaded by front-end web or mobile clients there are many factors you should consider to make the whole process secure and performant. In this blog post, I will describe common pitfalls and an optimal solution when it comes to handling client-side file uploads.

How to Migrate a Ruby on Rails App from Heroku to Dokku

Dokku is dev ops for dummies and a cheaper alternative to Heroku. Recently I've migrated a couple of my projects to it. In this blog post, I will describe how to setup and migrate a Rails app to Dokku with PostgreSQL, Sidekiq, Redis and Let's Encrypt or Cloudflare for free SSL.

How Getting Featured by Hacker News Affected my Passive Income

Two weeks ago my blog post made it to the top of Hacker News. Around 30k people read about my side project Slack bot that day. In this blog post I will describe how it affected the project and my other passive monetization and marketing strategies.

How I've Built a Profitable Slack App as a Side Project in Rails

I've built a Slack anonymous messaging bot in Ruby on Rails and it is profitable. In this blog post I will describe what I did and tools I used to create, promote and monetize a simple SAAS product.

Track Down and Fix Slow ActiveRecord SQL Query Performance in Rails

Scaling issues are great because it means that you have traffic on your website. Before you decide that 'Rails doesn't scale!' and start a rewrite to a tech stack with potentially more performance, maybe you should double check queries that your PostgreSQL database executes. Below I describe some tools and techniques you can use to track down, diagnose and optimize slow Active Record SQL query execution.

Practical Differences between Working in Ruby and iOS

Developing iOS mobile apps and server-based Ruby applications is different on many levels. In this blog post, I will present a high-level overview of different aspects of day-to-day working in these technologies.

Serious SEO Mistake of Many Startups and Software Houses

Many software houses and startups are blogging regularly. A simple blog implementation detail can seriously hurt company's SEO rating and in consequence business. Read on if you are interested what’s the problem and how it can be fixed.

Stop Blogging on Medium if You Care about SEO

Medium is an extremely popular blogging platform for both newcomers and expert tech-savvy bloggers. I've noticed the serious SEO related issue with using it as your main blogging tool. Read on if you are curious how Medium hurts your internet brand and what's the alternative. We'll discuss how nofollow and dofollow links work and what kind of links Medium uses.

Ruby on Rails Simple Service Objects and Testing in Isolation

Service Objects are not a silver bullet but they can take you a long way in modeling your Ruby on Rails app's domain logic. In this blog post, I will describe how I usually work with service object pattern in a structured way. I will also cover a simple testing in isolation with mocked services layer.

Optimize Rails Performance with Redis Caching and Rack Middleware

According to (a bit exaggerated) Pareto principle, 5% of your Rails app endpoints could account for 95% of performance issues. In this blog post I will describe how I improved a performance of my Rails application’s bottleneck endpoint by over 500% using a simple Redis caching technique and a custom Rack middleware.

Simple SSL Proxy for Insecure Browser Content with Ruby or NGINX

SSL protection is becoming de facto standard in web and mobile development. One potential problem is that website could be served via a secure SSL connection and still displayed as insecure by most of the modern browsers. It's enough that at least one of its resources is served without SSL. In this blog post, I will explain how to setup a simple Ruby and NGINX server to work as an SSL proxy for insecure content and describe some basic streaming techniques.

Multiple Domains with Free Wildcard SSL from Cloudflare

Domain names you own could be your most expensive to do list. What’s more a domain without a valid SSL will show up in all modern browsers as an insecure content. In this tutorial, I will explain how to minimize the cost of owning multiple wildcard SSL-protected domains using Cloudflare and set them up with Github Pages, Heroku or NGINX.

Reduce Rails Memory Usage, Fix Leaks, R14 and Save Money on Heroku

In theory, you can run both Rails web server and Sidekiq process on one 512mb Heroku dyno. For side projects with small traffic, saving $7/month always comes in handy. Unfortunately when trying to fit two Ruby processes on one dyno you can run into memory issues, leaks and R14 quota exceeded errors. In this post, I will explain how you can limit memory usage in Rails apps.

Productive Laziness - Optimize your Shell Workflow

I would like to share a simple productivity tip that probably helped me save thousands of keystrokes so far. I’ve been using this technique for a while now to maximize my laziness (productivity) during work and so, recently I wrapped it up in an easy to use Ruby Gem.