Skip to content

Instantly share code, notes, and snippets.

@dobrinov
dobrinov / README.md
Last active April 25, 2023 07:27
Ruby on Rails VPS provisioning handbook

User

sudo useradd -D -s /bin/bash # This makes bash the default useradd shell
useradd app -m
usermod -aG sudo app

Add public key to authorized_keys

@dobrinov
dobrinov / HOWTO.md
Last active April 18, 2023 20:13
Webpack + Rails (wihthout Webpacker)

Webpack + Rails (wihthout Webpacker)

This document describes everything needed to integrate Webpack with a Rails project. The Webpack configuration here could be simplified even more if React & Typescript support is not needed.

lib/webpack/asset.rb

module Webpack
  module Asset
    extend self
@dobrinov
dobrinov / README.md
Last active January 15, 2018 22:12
Applying zero downtime Elasticsearch index mapping changes (Ruby on Rails)

This gist assums that you are running a Ruby on Rails project and you are using the elasticsearch-rails gem to operate with your Elasticsearch cluster.

This script is using the Elasticsearch Index Aliases and Reindex API to provide a way for applying zero downtime index mapping changes (adding, deleting or modifying a field).

How it works?

Let's say that you have an Article model which by default references an articles index in Elasticsearch. And lets assume that articles is an alias to a timestamped index articles_20180101000001.

Running the script will:

  1. Create a new timestamped index articles_20180101000002