Score:1

how to setup pimcore on vps server via docker compose yml

je flag

I am really exhausted to get pimcore running on my vps server.

I tried several OS like Unbuntu 18 / 20 or CentOS 7. I tried to install pimcore via composer. But there I always get some errors, when I tried to fix them, they lead to some more.

The best way for me is with the docker-compose.yml. I managed to install pimcore with that and I am able to run the containers described here : https://github.com/pimcore/skeleton/tree/10.2

After the installation of pimcore I pointed the vhost on my-project/public. There is the index.php Now I get this error

An exception occurred in driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for db failed: Name or service not known

I really tried to set up the db host in the docker-compose.yml and also in the .env file. But still, it did not work.

Now I stopped the container and was surprised that on my domain the error still exists, even without the running containers.

Do I need to tell my VPS that it has to take the docker-compose.yml database? Or are there any other things I need to do, to get pimcore running on my server via docker-compose? I just used the skeleton version provided from pimcore/github .

I really need your help.

this is my docker-compose.yml:

services:
    redis:
        image: redis:alpine
        command: [ redis-server, --maxmemory 128mb, --maxmemory-policy volatile-lru, --save "" ]

    db:
        image: mariadb:10.7
        working_dir: /application
        command: [mysqld, --character-set-server=utf8mb4, --collation-server=utf8mb4_unicode_ci, --innodb-file-per-table=1]
        volumes:
            - pimcore-database:/var/lib/mysql
        environment:
            - MYSQL_ROOT_PASSWORD=ROOT
            - MYSQL_DATABASE=db
            - MYSQL_USER=user
            - MYSQL_PASSWORD=pw

    nginx:
        image: nginx:stable-alpine
        ports:
            - "80:80"
        volumes:
            - .:/var/www/html:ro
            - ./.docker/nginx.conf:/etc/nginx/conf.d/default.conf:ro
        depends_on:
            - php

    php:
        user: '1000:1000' # set to your uid:gid
        image: pimcore/pimcore:php8.1-debug-latest
        environment:
            COMPOSER_HOME: /var/www/html
            PHP_IDE_CONFIG: serverName=localhost
        depends_on:
            - db
        volumes:
            - .:/var/www/html

    supervisord:
        user: '1000:1000' # set to your uid:gid
        image: pimcore/pimcore:php8.1-supervisord-latest
        depends_on:
            - db
        volumes:
            - .:/var/www/html
            - ./.docker/supervisord.conf:/etc/supervisor/conf.d/pimcore.conf:ro

volumes:
    pimcore-database:

and this is my config/config.yaml:

imports:
    - { resource: 'local/' }


pimcore:

# IMPORTANT Notice!
# Following there are only some examples listed, for a full list of possible options, please run the following command:
# ./bin/console debug:config pimcore
# you can also filter them by path, eg.
# ./bin/console debug:config pimcore assets
# or even more specific:
# ./bin/console debug:config pimcore assets.image


#### TRANSLATIONS
#    translations:
#        case_insensitive: true

#### FEATURE FLAGS
#    flags:
#        zend_date: true

#### CLASS OVERRIDES EXAMPLES
#    models:
#        class_overrides:
#            'Pimcore\Model\DataObject\News': 'App\Model\DataObject\News'
#            'Pimcore\Model\DataObject\News\Listing': 'App\Model\DataObject\News\Listing'
#            'Pimcore\Model\DataObject\Folder': 'App\Model\DataObject\Folder'
#            'Pimcore\Model\Asset\Folder': 'App\Model\Asset\Folder'
#            'Pimcore\Model\Asset\Image': 'App\Model\Asset\Image'
#            'Pimcore\Model\Document\Page': 'App\Model\Document\Page'
#            'Pimcore\Model\Document\Link': 'App\Model\Document\Link'
#            'Pimcore\Model\Document\Listing': 'App\Model\Document\Listing'


#### CUSTOM DOCUMENT EDITABLES
#    documents:
#        allow_trailing_slash: 'yes'
#        generate_preview: false
#        tags:
#            map:
#                markdown: \App\Model\Document\Tag\Markdown


#### CUSTOM OBJECT DATA TYPES
#    objects:
#        class_definitions:
#            data:
#                map:
#                  myDataType: \App\Model\DataObject\Data\MyDataType


#### ASSET CUSTOM SETTINGS
#    assets:
#        icc_rgb_profile: ''
#        icc_cmyk_profile: ''
#        versions:
#            use_hardlinks: false
#        image:
#            low_quality_image_preview:
#                enabled: false
#                generator: imagick
#            thumbnails:
#                webp_auto_support: false


#### SYSTEM SETTINGS

#    general:
#        timezone: Europe/Berlin
#        path_variable: ''
#        instance_identifier: ''
#    services:
#        google:
#            client_id: 738936983.apps.googleusercontent.com
#            email: [email protected]
#            simple_api_key: AIzaSyCo9Wj49hW2WgOju4iMYNTvdcBxmyQ8
#            browser_api_key: AIzaSyBJX16kWAmU1amzp2iKqAfumbcoQQ
#    full_page_cache:
#        enabled: false
#        lifetime: null
#        exclude_cookie: ''
#        exclude_patterns: ''
#    httpclient:
#        adapter: Socket # use 'Proxy' for custom proxy configuration
#        proxy_host: ''
#        proxy_port: ''
#        proxy_user: ''
#        proxy_pass: ''
#    email:
#        sender:
#            name: 'Pimcore Demo'
#            email: [email protected]
#        return:
#            name: ''
#            email: ''
#    newsletter:
#        use_specific: false # set true to use the following options for newsletter delivery
#        sender:
#            name: ''
#            email: ''
#        return:
#            name: ''
#            email: ''

#    applicationlog:
#        mail_notification:
#            send_log_summary: false
#            filter_priority: null
#            mail_receiver: ''
#        archive_treshold: '30'
#        archive_alternative_database: ''

#### SYMFONY OVERRIDES
framework:

#### DEFINE LOCATION OF MANIFEST WHEN WORKING WITH SYMFONY ENCORE
#    assets:
#        json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'

#### USE CUSTOM CACHE POOL
#    cache:
#        pools:
#            pimcore.cache.pool:
#                public: true
#                tags: true
#                default_lifetime: 31536000  # 1 year
#                adapter: pimcore.cache.adapter.redis_tag_aware
#                provider: 'redis://localhost' # Redis DNS, see: https://symfony.com/doc/current/components/cache/adapters/redis_adapter.html#configure-the-connection

#### USE SESSION HANDLER CONFIGURED IN php.ini
#    session:
#        handler_id: null

#### SYMFONY MAILER TRANSPORTS
#    mailer:
#        transports:
#            main: smtp://user:[email protected]:port
#            pimcore_newsletter: smtp://user:[email protected]:port

It is in config/local/database.yaml ?

# imports:
#     - { resource: 'local/' }

parameters:
    database_host: 'pimcoredb'
    database_port: 3306
    database_name: 'db'
    database_user: 'user'
    database_password: 'pw'

pimcore:
in flag
PHP can't find the address you provided for the database. Please provide your config file and your docker-compose.yml
in flag
where is your pimcore database configuration?
Score:0
in flag

Your database container is called db, but you configured pimcore to connect to a host named pimcoredb.

Change your db config to connect to db instead.

parameters:
  database_host: 'db'
Robert Seidel avatar
je flag
Thanks for your help but the same error occurs. Docker Containers are running well.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.