A rough guide to installing Akeneo on platform.sh

Akeneo

Akeneo is an open source Product Information Management (PIM) system designed for retailers looking for efficient answers to their multichannel needs.

Platform.sh is a groundbreaking hosting and development tool for web applications. It extends a branch-merge workflow to infrastructure so that every branch can be tested as if it were in production, and scales for the largest sites.

This blog post marries these two solutions together.

  1. When setting up a new project on platform.sh, on the Where do you want to start? step select Import an existing site. Keep Importing your code pop-up temporarily open.
    This is this moment when you can decide to go the easy way and use the akeneo-on-platformsh-example git repository and totally ignore most of the following steps (except the last one, where you ssh to your platform and manually go through all Akeneo installation steps - this still needs to be done), or go through all of them yourself and perhaps find an even better solution?
  2. Download and extract Akeneo Standard Edition archive. Keep the content of pim-community-standard-v1.2.11-icecat directory (version number might differ), trash the rest.

    Init new git repository inside the pim-community-standard-v1.2.11-icecat directory, add platform as a remote, add all Akeneo files.*

  3. Download following platform.sh configuration files from https://github.com/platformsh/platformsh-examples/tree/symfony/standard-full:
    .platform.app.yaml
    .platform/routes.yaml
    .platform/services.yaml

    into their respective directories.*

    See Configuration platform doc for more information.

  4. Delete app/config/parameters.yml.dist. We won't be needing it. We won't be using Incenteev at all (see below). *
    We won't use it because at the moment that it runs the app/config directory is still empty (because we will have added a mount on it in some later step to make it writeable), and all config files stored in app/config.dist have not been yet copied over - so composer will complain.
  5. Remove app/config/parameters.yml from .gitignore. We want to have it in the repo. This will be our database configuration provider.*
  6. ssh into your platform and execute:
    php5 -r 'print_r(json_decode(base64_decode(getenv("PLATFORM_RELATIONSHIPS"))));'

    Edit app/config/parameters.yml and update all params to match displayed platform.sh database relationship details. Most probably you will need to do the following changes:
    - change database_host to database.internal
    - change database_name to main
    - remove values from database_user and database_password

    Add updated app/config/parameters.yml to git repository.*

  7. Edit composer.json:*
    • remove "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters" both from post-install-cmd and post-update-cmd scripts
    • replace incenteev-parameters in extra section with:
      "incenteev-parameters": {
        "keep-outdated": true
      },

    See Managing your ignored parameters with Composer for more info.

  8. Edit .platform.app.yaml and add apc runtime extension (required by Akeneo):*
    runtime:
        extensions:
          - apc
  9. Edit .platform.app.yaml and configure following additional directories as writeables in mounts section:*
    /app/archive
    /app/config
    /web/bundles
    /app/uploads/product
    /web/css
    /web/js
  10. Copy whole app/config directory to app/config.dist:*
    cp -r app/config app/config.dist
    This needs to be done because we have added a mount on app/config (to make it writeable), which shadows the original directory content - but we still need those files there, so we will just manually copy them from app/config.dist in the last step.
  11. If you haven't done it yet, commit and push everything.
    If you check the deployment log at this point (/var/log/deploy.log) you will see that the build failed because of missing /app/app/config/config_prod.yml (even though no errors were displayed after the push). This is ok, you will fix it in a moment.
  12. ssh to your platform, and manually go through all Akeneo installation steps:
    Why not to use default app/console pim:install --env=prod you might ask? Because at its first step Pim\Bundle\InstallerBundle\Command\InstallCommand::execute() will try to call cleanDirectory() on upload_dir (app/uploads/product) and archive_dir (app/archive), which will try to delete these directories and then recreate them (such a funny way of emptying them) - but their parents are not configured as writeable, so it will fail, causing the whole install process to silently fail as well.)
    • start with copying all original config files from app/config.dist to their proper directory (app/config):
      cp app/config.dist/* app/config/

      Once this is done, you can safely go through Akeneo installation steps.
    • requirement check should display several tables with lots of OKs:
      app/console pim:installer:check-requirements --env=prod
    • create (or re-create) the database (obvious warning, this will drop all existing data):
      app/console pim:installer:db --env=prod
    • copy all assents (css, js, bundles) into their respective directories:
      app/console pim:installer:assets --env=prod

  13. All should be done now - this is the step where you go to your platform project URL and admire the result!