1

I'm really newbie in Docker and Mutagen and it doesn't clear for me how to describe storages properly. So I ask you to give me some help with it. I'm trying to rewrite docker-compose.yml to work with mutagen-compose. This is original docker-compose file:

storefront:
    build:
      context: ./saleor-storefront
      dockerfile: ./Dockerfile.dev
    restart: unless-stopped
    ports:
      - 3000:3000
    networks:
      - saleor-backend-tier
    depends_on:
      - api
    volumes:
      - ./saleor-storefront/:/app:cached
      - /app/node_modules/
    # Nginx is used to proxy SSR requests thru docker networking
    command: sh -c '(nginx &) && npm run start'

What I tried:

  storefront:
    build:
      context: ./saleor-storefront
      dockerfile: ./Dockerfile.dev
    ports:
      - 3000:3000
    restart: unless-stopped
    networks:
      - saleor-backend-tier
    depends_on:
      - api
    volumes:
      - storefront:/app
      - /app/node_modules/
    # Nginx is used to proxy SSR requests thru docker networking
    command: sh -c '(nginx &) && npm run start'

volumes:
  saleor-db:
    driver: local
  saleor-redis:
    driver: local
  saleor-media:
  storefront:

networks:
  saleor-backend-tier:
    driver: bridge

x-mutagen:
  sync:
    defaults:
      ignore:
        vcs: true
    saleor-media:
      alpha: "."
      beta: "volume://saleor-media"
      mode: "two-way-resolved"
    saleor-storefront:
      alpha: "./saleor-storefront"
      beta: "volume://storefront/app"
      mode: "two-way-resolved"

I get error for /app storage location from npm: saleor-platform-storefront-1 | npm ERR! enoent ENOENT: no such file or directory, open '/app/package.json'. File package.json exists in project's saleor-storefront directory itself and I decided it should be at mounted volume at /app directory. I think I made something basically wrong in the logic of map existing Docker's locations to mutagen-compose way. Thank you for any help.

RomanKovalev
  • 852
  • 3
  • 10
  • 29

1 Answers1

1

Got it by change beta:

x-mutagen:
  sync:
    defaults:
      ignore:
        vcs: true
    saleor-media:
      alpha: "."
      beta: "volume://saleor-media"
      mode: "two-way-resolved"
    storefront:
      alpha: "./saleor-storefront"
      beta: "volume://storefront"
      mode: "two-way-resolved"
    
RomanKovalev
  • 852
  • 3
  • 10
  • 29
  • for MacOS users when `docker-compose up` returns `Error: unknown command "compose" for "mutagen"` error as workaround you should run `mutagen-compose -f YOUR_DOCKER_COMPOSE.yml up'. The mutagen-compose can be installed via brew. – mrDinkelman Nov 23 '22 at 15:44