How can we help you today?

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

Created by: Reggy Almeida

Modified on: Thu, 27 May, 2021 at 4:04 PM


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.

TABLE OF CONTENTS

Create a vhost

Create a vhost for your staging environment.

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

Split the Nnginx 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;
}
cd ~
mkdir akeneo-staging
cp -R akeneo akeneo-staging
ln -s ~/akeneo-staging/akeneo/pim-community-standard/public akeneo_staging

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

R
Reggy is the author of this solution article.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.