Coder Social home page Coder Social logo

tzumby / rails-on-kubernetes Goto Github PK

View Code? Open in Web Editor NEW
168.0 7.0 41.0 117 KB

Sample Rails application deployed with Kubernetes

Home Page: https://www.monkeyvault.net/rails-on-kubernetes-part-2/

Ruby 79.84% JavaScript 2.50% HTML 16.01% Shell 0.69% Dockerfile 0.92% SCSS 0.04%

rails-on-kubernetes's Introduction

Running this in development mode

You will need to install Docker Compose for this. Here's how you build the Docker images:

docker-compose build

To run the application:

docker-compose up

Then access it at http://localhost:3000.

Kubernetes

Secrets

Create the necessary secrets:

kubectl create secret generic db-user-pass --from-literal=password=mysecretpass
kubectl create secret generic db-user --from-literal=username=postgres
kubectl create secret generic secret-key-base --from-literal=secret-key-base=50dae16d7d1403e175ceb2461605b527cf87a5b18479740508395cb3f1947b12b63bad049d7d1545af4dcafa17a329be4d29c18bd63b421515e37b43ea43df64

Postgres

Create the volumes:

kubectl create -f kube/volumes/postgres_volumes.yaml

Create the Service and Deployment

kubectl create -f kube/services/postgres_svc.yaml
kubectl create -f kube/deployments/postgres_deploy.yaml

Redis

Create the Service

kubectl create -f kube/services/redis_svc.yaml
kubectl create -f kube/deployments/redis_deploy.yaml

Rails

You will have to build and push the Rails image. Make sure you update the lib/tasks/docker.rake with your own username.

bundle exec rake docker:push_image

First run the setup Kube job to create the database and run migrations:

kubectl create -f kube/jobs/setup.yaml

Create the Rails Service

kubectl create -f kube/services/rails_svc.yaml

And the Deployment

kubectl create -f kube/deployments/rails_deploy.yaml

Ingress

Finally create the Ingress resource:

kubectl create -f kube/ingresses/ingress.yaml

Details

For an in-depth step by step guide check out my blog post at: Rails on kubernetes - Part 2

rails-on-kubernetes's People

Contributors

dependabot[bot] avatar martijn avatar ptran32 avatar rahuldhole avatar t-tiger avatar taylormonacelli avatar tzumby avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

rails-on-kubernetes's Issues

Need to update ruby version and bundler

Docker build shows the error followed by a need to install compatible bundler -v '1.17.2' to Gemfile.lock

nokogiri-1.14.3-x86_64-linux requires ruby version >= 2.7, < 3.3.dev, which is
incompatible with the current version, ruby 2.6.4p104
The command '/bin/sh -c bundle install' returned a non-zero code: 5
ERROR: Service 'setup' failed to build : Build failed

ENVs

I noticed that the setup seems to include production ENVs in the docker-compose.yml file. What is the recommended way to handle the ENVs in your setup?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.