Answer the question
In order to leave comments, you need to log in
How to deploy docker-compose on heroku?
Good time of the day. I have a question about deploying an application that is hosted on docker-compose
.
Docker-compose consists of several containers:
version: "3.7"
x-api-volumes: &api-volumes
- .:/app:cached
- ~/.ssh:/root/.ssh
- ~/.bash_history:/root/.bash_history
- bundle_cache:/bundle_cache
x-api-environment: &api-environment
- RAILS_PORT=8080
- RAILS_SECRET_KEY_BASE=secret_key_base
- DATABASE_HOST=db
- REDIS_URL=redis://redis:6379/0
- REDIS_PORT=6379
- DATABASE_USERNAME=postgres
- BUNDLE_PATH=/bundle_cache
- GEM_HOME=/bundle_cache
- GEM_PATH=/bundle_cache:/usr/local/bundle
networks:
api:
services:
api:
build:
context: .
dockerfile: Dockerfile.api
depends_on:
- db
- redis
volumes: *api-volumes
ports:
- 8080:8080
networks:
- api
environment: *api-environment
command: bash -c "bundle install && bundle exec rake db:create db:migrate && bundle exec puma -C config/puma.rb -e development"
redis:
image: redis:alpine
ports:
- "6379:6379"
networks:
- api
sidekiq:
depends_on:
- 'db'
- 'redis'
build: .
networks:
- api
command: bundle exec sidekiq
volumes:
- '.:/app'
env_file:
- '.env'
db:
image: postgres:10.3-alpine
networks:
- api
bundle_cache:
networks:
- api
image: busybox
volumes:
- bundle_cache:/bundle_cache
client:
networks:
- api
build:
context: client
dockerfile: Dockerfile.client
ports:
- "3000:3000"
depends_on:
- api
environment:
- NODE_ENV=development
- API_HOST=api
- API_PORT=8080
- CI=true
- CHOKIDAR_USEPOLLING=true
command: sh -c "yarn && yarn start"
volumes:
- ./client:/app:cached
- client:/app/build
nginx:
build: ./infrastructure/nginx
volumes:
- client:/app/dist
- ./public:/app/public
- ./infrastructure/nginx/nginx.conf:/etc/nginx/nginx.conf
- ./infrastructure/nginx/conf.d:/etc/nginx/conf.d
ports:
- "80:80"
networks:
- api
links:
- api
volumes:
bundle_cache:
client:
Answer the question
In order to leave comments, you need to log in
I solved the problem by simply buying a server on www.vultr.com Using
ssh, I went to the server console, cloned my turnip and raised docker-compose. Everything works, and many times easier than heroku. I took the simplest configuration for $5. :)
I have not worked with heroku, but as far as I understand, they only support docker containers.
Actually, you only need api (Rails). And maybe sidekiq.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question