Coder Social home page Coder Social logo

calgoodman / devcontainer-rails Goto Github PK

View Code? Open in Web Editor NEW

This project forked from luizkowalski/devcontainer-rails

0.0 0.0 0.0 32 KB

๐Ÿ’Ž devcontainer configurations to run Ruby on Rails with PostgreSQL and Redis on GitHub Codespaces

Shell 43.78% Dockerfile 56.22%

devcontainer-rails's Introduction

Codespace on Rails

Why?

I've been trying to get some Ruby on Rails projects I have set up on Codespaces. After many tries, I've finally got it working (at least the way I wanted it to), so now I'm creating this repository to keep these changes and copy them to other projects whenever needed.

I mostly copied what was done here and fixed some things that were not working for me or that I didn't need.

How?

  1. Copy the .devcontainer folder to your project
  2. Customize
  3. Open the project in Codespaces
  4. No step 4 :)

What's in the box?

  • Ruby 3.3
  • PostgreSQL 15 (exposed locally on port 5433)
  • Redis 7
  • Node 20
  • SSH server
  • ZSH and Oh My Zsh

Customizations

There are a couple of things you can customize and a couple of things you should customize.

Could

You can choose different Ruby and Node versions by updating the devcontainer.json file. Currently, it will install Ruby 3.2.x and Node 20.x.x. You can also change the PostgreSQL username and password, although I don't think it matters too much.

You can also change the project's name under devcontainer.json and docker-compose.yml if you want to. I've left it as Your Project Name for now.

If you change the service name (defaults to app right now), remember to update the app section in docker-compose.yml. They have to match.

Should

You should, however, update your database.yml file if you use one. Here is what mine looks like:

default: &default
  adapter: postgresql
  encoding: unicode
  host: postgres # This is the name of the container in the docker-compose.yml file
  username: postgres # This is the default username for the postgres image
  password: postgres # This is the default password for the postgres image
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>

development:
  <<: *default
  database: app_development

test:
  <<: *default
  database: app_test

production:
  <<: *default
  url: <%= ENV["DATABASE_URL"] %>

Notice the host: postgres? That's the name of the container in the docker-compose.yml file. If you change it to db, you must update the database.yml file too.

How to ssh into the devcontainer?

ssh -p 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o GlobalKnownHostsFile=/dev/null vscode@localhost

The password is vscode, configured under boot.sh

devcontainer-rails's People

Contributors

luizkowalski avatar alexspark avatar

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.