Skip to content

Docker compose/Doctrine error with skeleton #1365

Open
@chadwcarlson

Description

@chadwcarlson

Creating a new project from the skeleton, there is an error when running docker compose up -d for the first time to make migrations.

Steps to reproduce:

# Create a new project 
symfony new symfony_project --upsun
cd symfony_project

# Add bundles relevant to the demo we're producing
symfony composer require doctrine/annotations \
  doctrine/doctrine-bundle \
  doctrine/doctrine-migrations-bundle \
  doctrine/orm nelmio/cors-bundle \
  symfony/doctrine-bridge \
  symfony/html-sanitizer \
  symfony/http-client \
  symfony/intl symfony/monolog-bundle \
  symfony/security-bundle \
  symfony/serializer \
  symfony/twig-bundle \
  symfony/asset-mapper \
  symfony/asset \
  symfony/twig-pack

symfony composer require --dev doctrine/doctrine-fixtures-bundle symfony/maker-bundle

# Create a new entity
symfony console make:entity

Then,

$ docker compose up -d
yaml: line 5: did not find expected tag URI

A quick Google search showed this was in the !ChangeMe! value for POSTGRES_PASSWORD generated.

Updating the generated compose.yaml file to include quotes on POSTGRES_PASSWORD fixes this:

services:
###> doctrine/doctrine-bundle ###
  database:
    image: postgres:${POSTGRES_VERSION:-16}-alpine
    environment:
      POSTGRES_DB: ${POSTGRES_DB:-app}
      # You should definitely change the password in production
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-"!ChangeMe!"}
      POSTGRES_USER: ${POSTGRES_USER:-app}
    healthcheck:
      test: ["CMD", "pg_isready", "-d", "${POSTGRES_DB:-app}", "-U", "${POSTGRES_USER:-app}"]
      timeout: 5s
      retries: 5
      start_period: 60s
    volumes:
      - database_data:/var/lib/postgresql/data:rw
      # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
      # - ./docker/db/data:/var/lib/postgresql/data:rw
###< doctrine/doctrine-bundle ###

volumes:
###> doctrine/doctrine-bundle ###
  database_data:
###< doctrine/doctrine-bundle ###
$ docker compose up -d     
[+] Running 16/16
 ⠿ database Pulled                                                                                                                                                                                      12.0s
   ⠿ da9db072f522 Pull complete                                                                                                                                                                          0.8s
   ⠿ 1f9ff5ead5be Pull complete                                                                                                                                                                          0.9s
   ⠿ 7795ec6b4e69 Pull complete                                                                                                                                                                          1.1s
   ⠿ b767ae82bd20 Pull complete                                                                                                                                                                          1.2s
   ⠿ a5ca9f1cbb88 Pull complete                                                                                                                                                                          1.4s
   ⠿ f573ba0dbe7b Pull complete                                                                                                                                                                          9.6s
   ⠿ ec60fa6141a6 Pull complete                                                                                                                                                                          9.7s
   ⠿ 1aba07e7c88f Pull complete                                                                                                                                                                          9.8s
   ⠿ 49b4e8d2f73d Pull complete                                                                                                                                                                          9.9s
   ⠿ b61746059f1b Pull complete                                                                                                                                                                         10.0s
   ⠿ b5a14dc5a5d2 Pull complete                                                                                                                                                                         10.1s
 ⠿ blackfire Pulled                                                                                                                                                                                      3.4s
   ⠿ 3656ac9ae2c8 Pull complete                                                                                                                                                                          1.1s
   ⠿ e5f5d6e3f530 Pull complete                                                                                                                                                                          1.2s
   ⠿ 5d2d099b5710 Pull complete                                                                                                                                                                          1.7s
[+] Running 4/4
 ⠿ Network symfonycon-vienna-2024_default         Created                                                                                                                                                0.1s
 ⠿ Volume "symfonycon-vienna-2024_database_data"  Created                                                                                                                                                0.0s
 ⠿ Container symfonycon-vienna-2024_database_1    Started                                                                                                                                                1.2s
 ⠿ Container symfonycon-vienna-2024_blackfire_1   Started                                                                                                                                                1.2s

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions