Installation with docker

Hello together,

i want to install Neos on my homeserver to develop a project locally. I’m wondering about what is the best practice process to do so. I was once developing Neos with version 3.0 but now lots of changes happend and i need to investigate again :slight_smile:

So basicially i’m trying to use the docker method with docker-compose.

I was using the following howto:

docker run -v .:/app -it --rm composer create-project neos/neos-base-distribution neos-example

to create an empty neos distribution and it created the given folder neos-example.

Afterwards i created the docker-compose.yaml and the Dockerfile.dev (you should add to the documentation, that this files have to be created inside the neos-example folder - otherwise one would assume that it is the folder before)

docker-compose.yaml:

# NEOS DEVELOPMENT ENVIRONMENT
#
# For instructions how to use docker-compose, see
# https://docs.neos.io/cms/installation-development-setup/docker-and-docker-compose-setup#docker-compose-cheat-sheet
version: '3.7'
services:
  # Neos CMS
  neos:
    build:
      context: .
      dockerfile: Dockerfile.dev
    environment:
      FLOW_CONTEXT: 'Development/Docker'
    volumes:
      - ./composer.json:/app/composer.json
      - ./composer.lock:/app/composer.lock
      - ./Configuration/:/app/Configuration/
      - ./DistributionPackages/:/app/DistributionPackages/
      # if you work on other packages, you need to add them here.

      # WARNING: you need to add all packages from Distribution packages here ONE BY ONE, see the notice below for explanation.
      - ./Packages/Sites/:/app/Packages/Sites/
    ports:
      - 8081:8081

  postgres:
    image: postgres:15
    restart: always
    environment:
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_DB=${POSTGRES_DB}
      - POSTGRES_NON_ROOT_USER=${POSTGRES_NON_ROOT_USER}
      - POSTGRES_NON_ROOT_PASSWORD=${POSTGRES_NON_ROOT_PASSWORD}
      - TZ="Europe/Berlin"
    ports:
      - '5432:5432'
    volumes:
      - db:/var/lib/postgresql/data
      #- ./init-data.sh:/docker-entrypoint-initdb.d/init-data.sh
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}']
      interval: 5s
      timeout: 5s
      retries: 10

volumes:
  db:

Diffs: I want to use postgreSQL, not mariadb. And i do have some ENV variable inside my .env file.

Dockerfile.dev:

FROM php:8.1-cli

RUN apt-get update \
    # install GraphicsMagick
	&& apt-get install -y \
		libgraphicsmagick1-dev graphicsmagick zlib1g-dev libicu-dev gcc g++ libpq-dev --no-install-recommends \
	&& pecl -vvv install gmagick-beta && docker-php-ext-enable gmagick \
    # pdo_pgsql
    && docker-php-ext-install pdo_pgsql \
    # redis
    && pecl install redis && docker-php-ext-enable redis \
	# intl
	&& docker-php-ext-configure intl && docker-php-ext-install intl \
    # cleanup
    && apt-get clean && rm -rf /var/lib/apt/lists/*


WORKDIR /app
EXPOSE 8081

# copy everything in the project into the container. This is what
# makes this image so fast!
COPY . /app

# start the dev server
CMD [ "./flow", "server:run", "--host", "0.0.0.0" ]

Diffs: I want to install the extention pdo_pgsql, instead of pdo_mysql because i’m using postgreSQL. Also i had to add libpq-dev to make the build happen.

After i tried to setup the DB-Connection, the following happend:

root@ff796f0020b7:/app# ./flow setup:database
DB Driver (pdo_mysql):
  [pdo_pgsql] PostgreSQL via PDO
 > pdo_pgsql
Host (127.0.0.1): postgres
Database (---): database_neos
Username (---): neos_cms_user
Password (---): <fancypasswordiscensored>

Database database_neos could not be created. Please check the permissions for user neos_cms_user. Exception: Database "database_neos" could not be created. Please check the permissions for user "neos_cms_user". DBAL Exception: "An exception occurred in driver: SQLSTATE[08006] [7] FATAL:  password authentication failed for user "neos_cms_user""
An exception occurred in driver: could not find driver

  Type: Doctrine\DBAL\Exception\DriverException
  File: Packages/Libraries/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriv
        er.php
  Line: 128

Nested exception:
could not find driver

  Type: Doctrine\DBAL\Driver\PDO\Exception
  File: Packages/Libraries/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php
  Line: 18

Nested exception:
could not find driver

  Type: PDOException
  File: Packages/Libraries/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php
  Line: 40
root@ff796f0020b7:/app#

Do you know what is missing? Maybe another driver within the dockerfile?

Thank you! :slight_smile:

I gave up and switched to MariaDB:

  # DB
  db:
    image: mariadb:10.11
    environment:
      MYSQL_ROOT_PASSWORD: 'db'
    volumes:
      - db:/var/lib/mysql
    ports:
      - 13306:3306

and pdo_mysql, so it worked and i can continue.