rails/docked

Can more services like Postgres and/or Redis be added?

yorsant opened this issue ยท 5 comments

I have seen these two other alternatives to creating a Rails app using Docker.

I like the simplicity of docked, but it is not very helpful once your app needs Postgres, Redis, or any other external requirement.

Are you planning to extend docked?

I believe you have to use docker-compose for that necessity. This is an example:

version: '3.4'
services:
  web:
    image: "ghcr.io/rails/cli:latest"
    command: /bin/bash -c "rm -f /tmp/server.pid && bundle exec rails server -b 0.0.0.0 -P /tmp/server.pid"
    env_file: .env
    ports:
      - 3000:3000
    depends_on:
      - db
      - redis
    volumes:
      - .:/rails
      - ruby-bundle-cache:/bundle
    tty: true
    stdin_open: true

  redis:
    image: "redis:7-alpine"
    ports:
      - 6379
    volumes:
    - ./tmp/redis_data:/var/lib/redis/data

  db:
    image: postgres
    restart: always
    ports:
      - 5432:5432
    volumes:
      - ./tmp/postgres_data:/var/lib/postgresql/data

volumes:
  ruby-bundle-cache:
    external: true

This is a post with the entire explanation.

It would be nice to add some instructions to the readme.

Hi, @yorsant if you have any additional questions let me know. Regarding the instructions, if you are at the root of your rails project you have to create a file called docker-compose.yml with the information above. After that, you have to execute the following command to start rails: docker-compose up. Don't forget to add a .env file with the Redis and Postgres credentials.

Setting up Rails for the first time with all the dependencies necessary can be daunting for beginners.

The README outlines that docked is intended for beginners and as such I think it should stick to default options and dependencies that you get when running rails new.

Providing a dockerised Rails development environment that covers most cases and fits everyone's needs is nearly impossible without sacrificing this simplicity.

dhh commented

What @durierem said.