Installation

This page assumes Oro Commerce 3.x is being used.

Prerequisites

  • Nginx
  • PHP FPM 7.1/7.2
  • MySQL 5.7

System Requirements

Setup

There is some specialised configuration that is used, ensure that the your config looks similar to the following. The config below is for a development environment, see the official documentation for production.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
server {
    server_name <your_domain_name> www.<your_domain_name>;
    root  /usr/share/nginx/html/oroapp/public;

    index index.php;

    gzip on;
    gzip_proxied any;
    gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
    gzip_vary on;

    location / {
        # try to serve file directly, fallback to index.php
        try_files $uri /index.php$is_args$args;
    }

    location ~ ^/(index|index_dev|config|install)\.php(/|$) {
        fastcgi_pass 127.0.0.1:9000;
        # or
        # fastcgi_pass unix:/var/run/php/php7-fpm.sock;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param HTTPS off;
        fastcgi_buffers 64 64k;
        fastcgi_buffer_size 128k;
    }

    location ~* ^[^(\.php)]+\.(jpg|jpeg|gif|png|ico|css|pdf|ppt|txt|bmp|rtf|js)$ {
        access_log off;
        expires 1h;
        add_header Cache-Control public;
    }

    error_log /var/log/nginx/<your_domain_name>_error.log;
    access_log /var/log/nginx/<your_domain_name>_access.log;
}

Ensure that MySQL is configured correctly and create a database to store application data. Only version 5.7 and above are supported.

1
CREATE DATABASE oro;

Install

Check out the code to the correct location, install dependencies with Composer and run the setup command.

1
2
3
git clone -b 3.0 https://github.com/oroinc/orocommerce-application.git oroapp
composer install --prefer-dist
php ./bin/console oro:install --env=prod --timeout=900

You will be prompted for different configuration options, such as the base URL and if to install sample data or not.

After installation

Job Queue

Once the installation is complete, we need to ensure that the queue is being consumed and processed correctly. We recommend using systemd to handle this as a standalone server.

/etc/systemd/system/oro-consumer.service

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
[Unit]
Description=Orocrm Job Consumer

[Service]
User=ec
ExecStart=/var/www/vhosts/oro-commerce/bin/console oro:message-queue:consume --env prod
Restart=always

[Install]
WantedBy=multi-user.target

1
2
3
systemctl daemon-reload
systemctl enable oro-consumer
systemctl start oro-consumer

Web sockets

Web sockets are handled using Ratchet, this is configured by Oro for us. Suggested SystemD config

/etc/systemd/system/oro-websocket.service

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
[Unit]
Description=Orocrm Websocket Server

[Service]
User=ec
ExecStart=/var/www/vhosts/oro-commerce/bin/console gos:websocket:server
Restart=always

[Install]
WantedBy=multi-user.target

1
2
3
systemctl daemon-reload
systemctl enable oro-websocket
systemctl start oro-websocket

Ensure you use the correct configuration is you are using HTTPs mode HTTPS Mode and Websockets

Crontab

1
*/1 * * * * php /var/www/vhosts/oro-commerce/bin/console oro:cron --env=prod > /dev/null

Resources

System Requirements Official Installation Documentation Setting up web sockets and queue with Supervisord