All Projects → lewagon → Rails K8s Demo

lewagon / Rails K8s Demo

Easy Rails on Kubernetes approach for Digital Ocean and a classic Rails stack: Puma, Redis, Sidekiq, Postgres, Action Cable, Webpacker. Helm 3 in production and docker-compose + dip (https://github.com/bibendi/dip) in development. Issues and PRs welcome.

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Rails K8s Demo

serverless-rack
Serverless plugin to deploy Ruby Rack applications (Sinatra/Rails/Padrino/Cuba etc.) and bundle gems
Stars: ✭ 58 (-80.41%)
Mutual labels:  ruby-on-rails
open-flights
OpenFlights - A CRUD app example built with ruby on rails and react.js using webpacker
Stars: ✭ 105 (-64.53%)
Mutual labels:  ruby-on-rails
Elasticsearch Rails
Elasticsearch integrations for ActiveModel/Record and Ruby on Rails
Stars: ✭ 2,896 (+878.38%)
Mutual labels:  ruby-on-rails
activeadmin medium editor
Medium Editor for ActiveAdmin
Stars: ✭ 26 (-91.22%)
Mutual labels:  ruby-on-rails
Transit-Talk
Building tools that improve overall transit user experience by connecting riders to each other, and to the agencies that serve them.
Stars: ✭ 22 (-92.57%)
Mutual labels:  ruby-on-rails
webrtc-hotwire-rails
A video chat app demonstration using Hotwire and Ruby on Rails
Stars: ✭ 38 (-87.16%)
Mutual labels:  ruby-on-rails
showhn.paperboy.digital
Autogenerated weekly newsletter of 'Show HackerNews' projects
Stars: ✭ 13 (-95.61%)
Mutual labels:  ruby-on-rails
Kickoff tailwind
A rapid Rails 6 application template for personal use bundled with Tailwind CSS
Stars: ✭ 287 (-3.04%)
Mutual labels:  ruby-on-rails
thisisfine
T̶̘̊h̷̙͘į̸̀ș̷͌ ̴̳̀r̴̬̕e̷̬͐p̵͍̚o̵̧̎s̶̗͂i̷͚̿t̷̟͝õ̴͙ř̵̘y̷̛̪ ̴̮͌i̶͊͜s̴̠̊ ̴̼͗f̶͘͜i̵̮͊n̴̨̊e̶̖̍!̷̝͋ ̴̨͛T̷̐͜h̷̺̔e̶̩̍r̸̰͒é̶̥ ̸̻̇ȉ̶͍s̵̡̍ ̴̛̫n̶̼̓ọ̷̀t̸̊ͅh̵̙͑ĩ̶͚n̵͙̋g̴̫̃ ̸̼͊w̷̘̿r̶̩̓o̷̠͝n̷͉͌g̶̞͒ ̷̛̼ọ̸̓v̶͍̈́e̵̺͑r̸̻̄ ̴̲̀h̸̉ͅé̶͙r̷̻̾e̷̠͛.̸̨̌
Stars: ✭ 18 (-93.92%)
Mutual labels:  ruby-on-rails
Rwdtow
Ruby Web Dev: The Other Way. Personal best practices guide.
Stars: ✭ 267 (-9.8%)
Mutual labels:  ruby-on-rails
Airbnb-V1
Source code of Airbnb Version 1 (2015). For new Airbnb Version 2 (2017) and learn how to use, check the link below:
Stars: ✭ 19 (-93.58%)
Mutual labels:  ruby-on-rails
activeadmin active resource
Active Admin + Active Resource: to use a REST API in place of a local database as data source
Stars: ✭ 20 (-93.24%)
Mutual labels:  ruby-on-rails
bamboofox-website
☕ Bamboofox CTF training platform
Stars: ✭ 21 (-92.91%)
Mutual labels:  ruby-on-rails
plug rails cookie session store
Rails compatible Plug session store
Stars: ✭ 93 (-68.58%)
Mutual labels:  ruby-on-rails
Database validations
Database validations for ActiveRecord
Stars: ✭ 274 (-7.43%)
Mutual labels:  ruby-on-rails
delayed-web
A rails engine that provides a simple web interface for exposing the Delayed::Job queue.
Stars: ✭ 71 (-76.01%)
Mutual labels:  ruby-on-rails
ruby-study-group
Grupo de estudos de Ruby no Training Center
Stars: ✭ 28 (-90.54%)
Mutual labels:  ruby-on-rails
Workarea
Workarea is an enterprise-grade Ruby on Rails commerce platform
Stars: ✭ 290 (-2.03%)
Mutual labels:  ruby-on-rails
Everydayrails Rspec 2017
Sample source for the 2017 edition of Everyday Rails Testing with RSpec.
Stars: ✭ 280 (-5.41%)
Mutual labels:  ruby-on-rails
Madmin
A robust Admin Interface for Ruby on Rails apps
Stars: ✭ 268 (-9.46%)
Mutual labels:  ruby-on-rails

Le Wagon x Digital Ocean Rails-on-Kubernetes demo

🚧 This setup is a work in progress 🚧

An attempt at creating a standardized Docker/Kubernetes-Helm/GitHub Actions setup for use with Rails projects. A version of this setup (that is little bit further ahead) is now used in production for services available to Le Wagon teachers, students, and alumni.

Demo application

A standard Action Cable chat application (Rails 6 + Stimulus) that uses twitter-text gem to extract free-formed URLs out of text and generate Open Graph previews for links. The dependency was chosen consciously, as it requires an external system library to function (libidn11), which makes it a perfect case for Docker.

It requires Sidekiq, Redis, and PostgreSQL to run, which represents the standard deployment stack of production Rails apps.

The demo application at https://demo.lewagon.co

Goals

  • Create a sensible approach to running fairly complex Rails projects in development with Docker
  • Generate reproducible and customizable configuration for production
  • Store everything related to deployments in the same repo as application code. Rely on GitHub one-way encrtypred secrets to store sensitive data like database connection strings.
  • Cater to a "classic Rails stack": Rails, Puma, Sidekiq, Redis, PostgreSQL, Webpacker, Action Cable
  • Allow for only a certain amount of complexity: enough to fit inside a head of a single full-stack developer who may end up maintaining the projects.
  • Hide ugly details of Kubernetes management by relying on 1 environment/1 cluster approach and letting Digital Ocean manage the master node.
  • Deploy with git push origin master or a PR merge on GitHub
  • Use any external Postgres database
  • Provide the easy migration from "Heroku way of doing things", once the application is past the MVP and needs to scale for a reasonable cost.

Current status

By constantly migrating legacy applications to this setup and starting new ones with the same setup in mind we make sure that all common production bugs will be squashed before we can fully automate the generation of charts and configuration.

Running locally

We use dip by Misha Merkushin at Evil Martians to achieve a "classic CLI" feel while working with Docker under the hood.

  • gem install dip
  • dip provision to build all necessary images and setup the local DB
  • dip up -d to run all services in the background: app, rails, sidekiq, webpacker (runs webpack-dev-server for JS live reload), postgres, redis. Go to localhost:3000 🎉
  • dip rails c to visit console.
  • dip down to stop the music and go home.

If you need to change project dependencies—run dip bundle and/or dip yarn after any changes to Gemfile or package.json.

Check out dip.yml for other common shortcuts.

Alternatively, you can launch dip rails s, dip sidekiq, and dip webpacker in respective tabs. This will allow for easier debugging with byebug (no need to attach to running Docker processes).

Many-tabs workflow

Running in production

  • Provision a cluster from Digital Ocean Managed Kubernetes, install Nginx Ingress Controller, create DNS A record, set up jetstack/certmanager for SSL. Expect futher explanation of those steps once the setup is out of internal testing.
  • Install Helm 3 on your machine. Run make upgrade-dev from project repo to deploy the release into the cluster.
  • Once you verified that the deployment from local machine works — feel free to fork the repo and set up the following secrets:

Secrets to be set

⚠️ You don't have to use Quay as Docker image backend, in that case you can alter Makefile push commands to your own image hosting provider.

  • After you're done—a push to master will trigger a GitHub Action for deployment. See deploy.yaml for details.

🙏 Suggestions and PRs are welcome!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].