Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker compose file still points to mongo volume when initializing "website" template with postgres #8876

Closed
ozzythecoder opened this issue Oct 26, 2024 · 3 comments

Comments

@ozzythecoder
Copy link

Describe the Bug

When running a fresh install with npm create-payload-app@beta, and selecting the "website" template and postgres database, the generated docker-compose.yaml still lists mongo as a service and dependency, rather than postgres. This causes docker compose up to run a crashing instance.

# docker-compose.yaml
version: '3'

services:
  payload:
    image: node:18-alpine
    ports:
      - '3000:3000'
    volumes:
      - .:/home/node/app
      - node_modules:/home/node/app/node_modules
    working_dir: /home/node/app/
    command: sh -c "yarn install && yarn dev"
    depends_on:
      - mongo
    env_file:
      - .env

  mongo:
    image: mongo:latest
    ports:
      - '27017:27017'
    command:
      - --storageEngine=wiredTiger
    volumes:
      - data:/data/db
    logging:
      driver: none

volumes:
  data:
  node_modules:

Would recommend including this section from the "blank" template:

    depends_on:
      - mongo
      # - postgres

  # .......

  # Uncomment the following to use postgres
  # postgres:
  #   restart: always
  #   image: postgres:latest
  #   volumes:
  #     - pgdata:/var/lib/postgresql/data
  #   ports:
  #     - "5432:5432"

Another option is to include different compose files, but I understand that's probably not super high priority right now. 😅

Link to the code that reproduces this issue

https://github.com/ozzythecoder/docker-mongo-issue-repro

Reproduction Steps

  • Run npm create-payload-app@beta
  • Select "website" template
  • Select "Postgres" database
  • Run docker compose up

Which area(s) are affected? (Select all that apply)

area: templates

Environment Info

Binaries:
Node: 22.10.0
npm: 10.9.0
Yarn: N/A
pnpm: 9.12.2
Relevant Packages:
payload: 3.0.0-beta.119
next: 15.0.0
@payloadcms/db-postgres: 3.0.0-beta.119
@payloadcms/email-nodemailer: 3.0.0-beta.119
@payloadcms/graphql: 3.0.0-beta.119
@payloadcms/live-preview: 3.0.0-beta.119
@payloadcms/live-preview-react: 3.0.0-beta.119
@payloadcms/next/utilities: 3.0.0-beta.119
@payloadcms/payload-cloud: 3.0.0-beta.119
@payloadcms/plugin-form-builder: 3.0.0-beta.119
@payloadcms/plugin-nested-docs: 3.0.0-beta.119
@payloadcms/plugin-redirects: 3.0.0-beta.119
@payloadcms/plugin-search: 3.0.0-beta.119
@payloadcms/plugin-seo: 3.0.0-beta.119
@payloadcms/richtext-lexical: 3.0.0-beta.119
@payloadcms/translations: 3.0.0-beta.119
@payloadcms/ui/shared: 3.0.0-beta.119
react: 19.0.0-rc-65a56d0e-20241020
react-dom: 19.0.0-rc-65a56d0e-20241020
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.0.0: Tue Sep 24 23:37:25 PDT 2024; root:xnu-11215.1.12~1/RELEASE_ARM64_T6030
Available memory (MB): 18432
Available CPU cores: 12

@ozzythecoder ozzythecoder added status: needs-triage Possible bug which hasn't been reproduced yet v3 labels Oct 26, 2024
@akhrarovsaid
Copy link
Contributor

Hey @ozzythecoder,

Yeah, this was brought up in the Discord some time ago. I think the answer here was that this is simply an example/sample Docker compose file to be used for dev and testing. The devs are aware of this issue and will likely come out with a fix such that the file will accommodate your chosen database at some point, although it is not a priority right now. See Discord thread here.

@denolfe
Copy link
Member

denolfe commented Oct 28, 2024

Hey @ozzythecoder , we may look at modifying these properly in a programmatic fashion in the future, but for now, having the relevant details commented is all we'll offer.

@denolfe denolfe closed this as completed Oct 28, 2024
@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Oct 28, 2024
Copy link
Contributor

This issue has been automatically locked.
Please open a new issue if this issue persists with any additional detail.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants