Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/luizkowalski/devcontainer-rails
💎 devcontainer configurations to run Ruby on Rails with PostgreSQL and Redis on GitHub Codespaces
https://github.com/luizkowalski/devcontainer-rails
codespace codespaces-friendly postgresql rails redis ruby ruby-on-rails vscode
Last synced: about 3 hours ago
JSON representation
💎 devcontainer configurations to run Ruby on Rails with PostgreSQL and Redis on GitHub Codespaces
- Host: GitHub
- URL: https://github.com/luizkowalski/devcontainer-rails
- Owner: luizkowalski
- Created: 2022-12-09T19:33:00.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-06T04:37:45.000Z (15 days ago)
- Last Synced: 2025-01-14T04:07:27.284Z (7 days ago)
- Topics: codespace, codespaces-friendly, postgresql, rails, redis, ruby, ruby-on-rails, vscode
- Language: Dockerfile
- Homepage:
- Size: 23.4 KB
- Stars: 81
- Watchers: 6
- Forks: 24
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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](https://github.com/microsoft/vscode-dev-containers/tree/main/containers/ruby-rails-postgres) 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.4.1
- PostgreSQL 16 (exposed locally on port 5433)
- Valkey 8
- Node LTS
- 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:
```yaml
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_developmenttest:
<<: *default
database: app_testproduction:
<<: *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 do I SSH into the codespace instance?
This configuration includes an SSH server. To access your codespace instance, you should install the `gh` CLI and run `gh codespace ssh`.