/homebrew-docker-compose-oroplatform

The Docker Compose based standalone environment

Primary LanguageShell

OroCommerce|OroCRM|OroPlatform Docker Environment

Supported Systems

  • MacOs (Intel, Apple Silicon)
  • Linux (AMD64, ARM64)
  • Windows via WSL2 (AMD64)

Pre-requirements

Docker

MacOs
Install Docker for Mac: https://docs.docker.com/desktop/mac/install/

Linux (Ubuntu and others)
Install Docker Engine: https://docs.docker.com/engine/install/ubuntu/
Install Docker Compose https://docs.docker.com/compose/install/compose-plugin/

Windows
Follow this guide: https://docs.docker.com/desktop/windows/wsl/

Homebrew (MacOs/Linux/Windows)

Install Homebrew by following guide https://docs.brew.sh/Installation

Configure Composer Credentials

You need to export following variable or add it to the .bashrc or .zshrc file

export COMPOSE_PROJECT_COMPOSER_AUTH='{
    "http-basic": {
        "repo.example.com": {
            "username": "xxxxxxxxxxxx",
            "password": "yyyyyyyyyyyy"
        }
    },
    "github-oauth": {
        "github.com": "xxxxxxxxxxxx"
    },
    "gitlab-token": {
        "example.org": "xxxxxxxxxxxx"
    }
}'

To get the command from local machine use following command:

echo "export COMPOSE_PROJECT_COMPOSER_AUTH='"$(cat $(php -d display_errors=0 $(which composer) config --no-interaction --global home 2>/dev/null)/auth.json)"'"

Installation

Install via homebrew by following command

brew install digitalspacestdio/docker-compose-oroplatform/docker-compose-oroplatform

Usage

  1. Clone the application source code
git clone --single-branch --branch 5.1.1 https://github.com/oroinc/orocommerce-application.git ~/orocommerce-application
  1. Navigate to the directory
cd ~/orocommerce-application
  1. Build docker images
docker-compose-oroplatform build
  1. Install composer dependencies
docker-compose-oroplatform composer install -o --no-interaction
  1. Optionally: Change the database driver in the config/parameters.yml (or .env-app) file.

example: ORO_DB_URL=postgres://application:application@database:5432/application?sslmode=disable&charset=utf8&serverVersion=13.7

  1. Install the application by following command
docker-compose-oroplatform bin/console --env=prod --timeout=1800 oro:install --language=en --formatting-code=en_US --organization-name='Acme Inc.' --user-name=admin --user-email=admin@example.com --user-firstname=John --user-lastname=Doe --user-password='$ecretPassw0rd' --application-url='http://localhost:30180/' --sample-data=y
  1. Optional: import database dump (supports *.sql and *.sql.gz files)
docker-compose-oroplatform import-database /path/to/dump.sql.gz
  1. Warmup cache
docker-compose-oroplatform bin/console cache:warmup
  1. Start the stack in the background mode
docker-compose-oroplatform up -d

Application should be available by following link: http://localhost:30180/

Shutdown the project stack

Stop containers

docker-compose-oroplatform down

Destroy containers and persistent data

docker-compose-oroplatform down -v

Extra tools

Connecting to the cli container

docker-compose-oroplatform bash

Generate compose config and run directly without this tool

docker-compose-oroplatform config > docker-compose.yml
docker compose up

Environment Variables

Can be stored in the .dockenv, .dockerenv or .env file in the project root

Custom Database Credentials

  • COMPOSE_PROJECT_DATABASE_USER="custom"
  • COMPOSE_PROJECT_DATABASE_PASSWORD="custom"
  • COMPOSE_PROJECT_DATABASE_NAME="custom"