How To Use A Basic Staging Environment with Akeneo 4 and 5

Hypernode offers a staging environment so it can be used as a sandbox for your Akeneo PIM project. Please keep in mind that your staging environment for Akeneo shares resources (disk, CPU, memory) with your production environment. It’s also possible to order a development plan instead, so your production environment will not be affected.

Create a vhost

Create a vhost for your staging environment.

hypernode-manage-vhosts staging.example.hypernode.io --force-https --https --type akeneo4

Split the Nginx Configuration for Production and Staging

Edit the ~/nginx/staging.example.hypernode.io/server.akeneo4.conf and change to:

root /data/web/akeneo_staging;
include /etc/nginx/handlers.conf;

location * {
    try_files $request_filename $uri;
}

location / {
    if (!-f $request_filename) {
        rewrite ^(.*)$ /index.php/ break;
        echo_exec @phpfpm;
    }
}
location ~ \.php$ {
    echo_exec @phpfpm;
}

Duplicate the akeneo_pim database to staging_akeneo_pim

mysql -e 'CREATE DATABASE staging_akeneo_pim;'
mysqldump akeneo_pim | mysql staging_akeneo_pim

Change the Parameters for the Staging Akeneo

Edit ~/akeneo-staging/akeneo/pim-community-standard/.env and change the following:

  • change database_name from akeneo_pim to staging_akeneo_pim

  • update the Elasticsearch index names by adding a staging prefix for example: akeneo_pim_product_and_product_model > staging_akeneo_pim_product_and_product_model

Don’t forget configs like the temp upload directory, please update accordingly.

Reindex Elasticsearch

bin/console akeneo:elasticsearch:reset-indexes
bin/console pim:product:index --all
bin/console pim:product-model:index --all

Configure a Cronjob for Staging

* * * * * flock -n ~/.daemon-staging.lock -c 'php /data/web/akeneo-staging/akeneo/pim-community-standard/bin/console akeneo:batch:job-queue-consumer-daemon --env=prod'

Tada! The staging is now up and running on https://staging.example.hypernode.io