Home > Software design >  Can I deploy a containerized ElasticSearch on Heroku with a web app?
Can I deploy a containerized ElasticSearch on Heroku with a web app?

Time:12-02

I have a toy MVP application that I'd like to deploy on Heroku. There's an ElasticSearch dependency expressed in a docker-compose file. The smallest ES add-on for Heroku is $67/month which is more than I want to spend for an MVP. I'm trying to figure out how to deploy it alongside the web app in a containerized fashion. All the guides I saw for multiple processes have a Dockerfile, not a docker-compose. Can I express this in a heroku.yml configuration?

Here is my Dockerfile:

version: '3.6'
services:
  web:
    image: denoland/deno:latest
    container_name: my_app
    build: .
    ports:
      - 3001:3001
    environment:
     - DENO_ENV=local
     - ES_HOST=elasticsearch
     - DENO_PORT=3001
     - ELASTIC_URL=http://elasticsearch:9200
    volumes: 
      - .:/usr/src/app
    command: deno run --allow-net --allow-read --allow-env src/main.ts
    links: 
      - elasticsearch
    depends_on:
      - elasticsearch
    networks:
      - es-net
  elasticsearch:
    container_name: es-container
    image: docker.elastic.co/elasticsearch/elasticsearch:8.5.2
    volumes:
      - esdata:/usr/share/elasticsearch/data
    environment:
      - xpack.security.enabled=false
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - discovery.type=single-node
    logging:
      driver: none
    ports:
      - 9300:9300
      - 9200:9200
    networks:
      - es-net
volumes:
  esdata:
networks:
  es-net:
    driver: bridge

CodePudding user response:

Not unless you want to pay for private spaces, and even then I don't think that it would work properly. Heroku's Docker support does not include volume mounts.

Internal routing is only available for apps in private spaces.

  • Related