Доброе время суток. Есть вопрос по поводу деплоя приложения, которое размещено на
docker-compose
.
Состоит docker-compose из нескольких контейнеров:
- client (React app)
- api (Rails)
- nginx
- redis
- sidekiq
- postgresql
Хочу задеплоить собственно целиком приложение. Суть вопроса - как же деплоить на heroku именно docker-compose приложение, а не просто docker? Т.к в доке пишут что следует убрать PostgreSQL и Redis из докера: "
The python application depends on Postgres and Redis, which you do not push to Heroku. Instead, use Heroku add-ons in production.".
Ниже привожу docker-compose файл:
docker-compose
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:
Как мне кажется (
возможно не правильно) легче всего было бы просто сделать пулл с репозитория, установить docker и docker-compose на севрере, поднять docker-compose up. Что в таком случае делать?