eZ Platform Discussions

eZ Launchpad - Deploy on platformsh error


#1

Bonjour,

I use eZ Launchpad and platform.sh.
I have a problem deploying my application on platform.sh.
Maybe the problem is my platform.sh conf and the eZ community can’t help it. But I think it’s very related.

Then I allow myself to share my problem with you.

I followed the install procedure for platform sh.
https://fr-1.platform.sh/projects/xxxxxxxxx/environments/master/setup
In the configuration of my project I chose “project with existing code”.

I configured my .platform.app.yaml, routes.yaml and services.yaml files (They are preconfigured by ezlunchpad)

$ ~/ez platformsh:setup

Then I added the platform.sh repository

git remote add platform xxxxxxxx@git.fr-1.platform.sh:xxxxxxxx.git
git push -u platform master

But during the push git push -u platform master :

E: Error parsing configuration files:
    - applications./provisioning/dev.disk: Required
    - applications./provisioning/dev.type: Required

Merci pour vorte aide.


#2

.platform/routes.yaml

"https://{default}/":
    type: upstream
    upstream: "app:http"
    cache:
        # As this does not support Vary, and purging, we can't use this as Sf Proxy drop in.
        # However it is possible to enable this for anonymous traffic when backend sends expiry headers.
        enabled: false

"https://www.{default}/":
    type: redirect
    to: "https://{default}/"

.platform/services.yaml

mysqldb:
    type: mysql:10.2
    disk: 2048
    configuration:
        schemas:
            - main
        endpoints:
            user:
                default_schema: main
                privileges:
                    main: admin
rediscache:
    type: 'redis:3.2'
redissession:
    type: 'redis:3.2'

.platform.app.yaml

name: app

type: php:7.1
build:
    flavor: "none"

relationships:
    database: "mysqldb:user"
    cache: "rediscache:redis"
    sessions: 'redissession:redis'

web:
    locations:
        "/":
            root: "ezplatform/web"
            passthru: "/app.php"
            expires: 600

disk: 2048 #2048 = 2G

mounts:
    "/ezplatform/var/cache": "shared:files/cache"
    "/ezplatform/var/logs": "shared:files/logs"
    "/ezplatform/web/var": "shared:files/files"

hooks:
    build: |
        set -e
        cd ezplatform
        composer install --no-dev --prefer-dist --no-progress --no-interaction --optimize-autoloader
        rm web/app_dev.php
        php -d memory_limit=-1 -d max_execution_time=3600 bin/console assetic:dump

    deploy: |
        set -e
        if [ ! -f ezplatform/web/var/.platform.installed ]; then
            MYSQL_OPTIONS=`php provisioning/platformsh/getmysqlcredentials.php`
            zcat data/ezplatform.sql.gz | mysql $MYSQL_OPTIONS
            tar xvzf data/storage.tar.gz -C ezplatform/web/
            touch ezplatform/web/var/.platform.installed
        fi
        cd ezplatform
        rm -Rf var/cache/$SYMFONY_ENV
        bin/console cache:pool:clear cache.redis
        bin/console cache:clear

runtime:
    extensions:
        - xsl
        - imagick
        - readline
        - msgpack
        - redis

variables:
    php:
        memory_limit: 256M
    env:
        SYMFONY_ENV: prod

My provisioning/dev folder

ls -a provisioning/dev/
.  ..  db  docker-compose-osx.yml  docker-compose.yml  docker-sync.yml  engine  nginx  .platform.app.yaml  solr  varnish


#3

@Plopix Is it in your field?


#4

I had an extra conf file…
./provisioning/dev/.platform.app.yaml

Thanks to Lucas from the platformsh team!


Now I have a pb with composer authentication for ez-ee. I hope to come back here with the full description of this new pb and the solution soon :wink:

https://docs.platform.sh/tutorials/composer-auth.html#authenticated-composer-repositories


#5

Is this config file was let by yourself or somehow eZ Launchpad let/put it there? @remy_php

About the authentication you can also do that:

"config": {
    "http-basic": {
        "updates.ez.no": {
            "username": "xxx",
            "password": "yyy"
        }
    }
}

#6

It’s a file I created when I was taking questions about setting up cronjobs. Question I’m postponing until later for now.


#7

Ça marche !

It’s working!

The deployment has come to an end.

But when I go to the site:

Fatal error: Uncaught PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘main.ezcontentobject_tree’ doesn’t exist

In my .platform.app.yaml file, I got this :

    deploy: |
        if [ ! -f ezplatform/web/var/.platform.installed ]; then
            MYSQL_OPTIONS=`php provisioning/platformsh/getmysqlcredentials.php`
            zcat data/ezplatform.sql.gz | mysql $MYSQL_OPTIONS
            touch ezplatform/web/var/.platform.installed
        fi

And I do have a data/ezplatform.sql.gz file with a database definition for eZ. (However, I don’t know when it dates…)


#8

I had put the data/ezplatform.sql.gz file in my .ignore

But even putting it back and redeploying it doesn’t fix the pb.

So I simply reset an empty database by connecting in ssh to the platformsh instance

php -d memory_limit=-1 bin/console ezplatform:install studio-clean

#9

That’s Platform.sh organization I would say. If your database has been cleaned up/dropped then you need to import it again.

The purpose of ez dumpdata is to dump the sql and the storage in data/. Then when using platform.sh we need a flag to know if the deploy needs to import the database or not (ie: is it the first time? or not?)

If the file ezplatform/web/var/.platform.installed is not present the import will happen other it won’t.

Then if you remove that file (which is shared over builds) you can trigger a reimport.

Hope it is clear