I recently Dockerized a Rails app, and I’m having trouble deploying it to Render. I read that Render doesn’t support Docker-Compose.
I’d appreciate it if someone can explain how to convert a Docker-Compose file into a Render.yaml file.
I had a lot of trouble setting up Docker-Compose (still new to it) and I have no idea how to approach converting it in the first place.
This is entirely untested but should give you some clues,
Dockerfile.anycable:
FROM anycable/anycable-go:1.2
ENV ANYCABLE_RPC_HOST=$RENDER_SERVICE_NAME:50051
render.yaml
databases:
- name: db # Render PG14
databaseName: db
user: dbuser
postgresMajorVersion: 14
services:
- type: redis # Render Redis
name: anycable-redis
ipAllowList: []
- type: web
name: ws
env: docker
dockerfilePath: ./Dockerfile.anycable
envVars:
- key: ANYCABLE_HOST
value: "0.0.0.0"
- key: ANYCABLE_REDIS_URL
fromService:
type: redis
name: redis
property: connectionString
- key: ANYCABLE_HOST
fromService:
type: web
name: anycable
envVarKey: RENDER_SERVICE_NAME #internal address of anycable used in Dockerfile to set ANYCABLE_RPC_HOST
value: anycable:50051 # need to reference anycable service
- key : ANYCABLE_DEBUG
value: 1
- type: web
name: web
env: ruby
buildCommand: ...
startCommand: "bundle exec rails s"
envVars:
- key: DATABASE_HOST
fromDatabase:
type: database
name: db
envVarKey: RENDER_SERVICE_NAME
- key: ANYCABLE_REDIS_URL
fromService:
type: redis
name: anycable-redis
property: connectionString
- type: web
name: anycable
env: ruby
buildCommand: ...
startCommand: bundle exec anycable
envVars:
- key: ANYCABLE_REDIS_URL
fromService:
type: redis
name: anycable-redis
property: connectionString
- key: ANYCABLE_RPC_HOST
value: "0.0.0.0:50051"
- key: ANYCABLE_DEBUG
value: 1
- key: PORT
value: 50051
the ws service would deploy as a docker container, using the Dockerfile which uses the Anycable image and sets the required environment variable.
The web and anycable services will deploy the code that is in your repo, you’ll need to set a buildcommand which for most Rails is bundle install; bundle exec rake assets:precompile.
Hopefully this enough to get you started in the right direction.
Thank you for getting back to me and for converting the Compose to a Render file.
It clears up so many questions, as I’m able to make direct comparisons and see the purpose of each line.
I do have one more question. There is no way to run Render.yaml file locally, am I correct? Like how you’d be able to do with the docker-compose file.
Thanks again for your help. I need to get an app deployed within the week. This pointed me in the right direction.