Using Docker

Usage

This documentation is used to guide developers to set up their UC Marketplace local development using docker for both Marketplace V2 and V4 effortlessly and efficiently.


Prerequisites

Operating systems:

  1. Linux x86-64 such as RedHat Enterprise Linux (RHEL), CentOS, Ubuntu, Debian, and similar
  2. MacOs 10.15 or newer

Memory Requirement:
At least 2GB RAM Available

Hard Drive:
SSD is preferred over HDD

Docker Set Up

Turn off any services running on ports 15672, 9200, 9300, 3306, 8025, 5672, 80, 443


Version Tested

  • UC Marketplace V2.4.2
  • UC Marketplace V2.2.11

Setting up a new Project

# Create an empty directory
mkdir omnyfy-project-name && cd $_

# Change .composer permission
# You don't need to run this command if you did once for previous projects
mkdir ~/.composer && sudo chown -R $USER:$USER ~/.composer

# Download the Docker Compose template - This is for version 2.2 - 2.4.2
curl -s https://raw.githubusercontent.com/bid-d/mageno-qarbi/master/lib/template | bash

# This is for version 2.4.6:
curl -s https://raw.githubusercontent.com/bid-d/docker-magento-qarbi/omnyfy-2.4.6/lib/template | bash

# Put marketplace-latest.zip file downloaded in this project
mv ~/Downloads/marketplace-latest.zip .

# Run script to setup automatically
# domain will be magento2.local by default if left empty
bin/omnyfy domain

/


Update Existing Project

# cd to your existing projcet
cd omnyfy-project-name

# Remove the old marketplace-latest.zip file and put the new one in it
rm marketplace-latest.zip && cp ~/Downloads/marketplace-latest.zip .

# Run script to setup automatically again
# domain will be magento2.local by default if left empty
bin/omnyfy domain

DevTools

Setup Xdebug with CLI command


Setup Xdebug with the browser


Adminer and Mailhog

Access your adminer at localhost:8088
default user: magento / magento
default db: magentodb

Access your mailhog at localhost:8025

Cronjobs

  1. Uncomment the cron service in the docker-compose.yml file
  2. Run bin/start to start up the cron
     cron:
        image: biddd/php-fpm:7.4-fpm-7
        user: root
        command: /usr/local/bin/cronstart
        tty: true
        links:
          - db
        volumes: *appvolumes
    If you don’t need the cron while developing, it would be a good idea to turn it off since it may negatively impact the performance. This can be done by commenting on the cron service in the docker-compose.yml file
    # cron:
      #  image: biddd/php-fpm:7.4-fpm-7
      #  user: root
      #  command: /usr/local/bin/cronstart
      #  tty: true
      #  links:
      #    - db
      #  volumes: *appvolumes

  1. Run bin/start again to stop the cron service

Custom CLI Command Lines

bin/bash: Drop into the bash prompt of your Docker container. The phpfpm container should be mainly used to access the filesystem within Docker.

bin/cache-clean: Access the cache-clean CLI. Note the watcher is automatically started at startup in bin/start. Ex. bin/cache-clean config full_page

bin/cli: Run any CLI command without going into the bash prompt. Ex. bin/cli ls

bin/clinotty: Run any CLI command with no TTY. Ex. bin/clinotty chmod u+x bin/magento

bin/cliq: The same as bin/cli, but pipes all output to /dev/null. Useful for a quiet CLI, or implementing long-running processes.

bin/composer: Run the composer binary. Ex. bin/composer install

bin/copyfromcontainer: Copy folders or files from container to host. Ex. bin/copyfromcontainer vendor

bin/copytocontainer: Copy folders or files from host to container. Ex. bin/copytocontainer --all

bin/dev-urn-catalog-generate: Generate URN's for PHPStorm and remap paths to local host. Restart PHPStorm after running this command.

bin/devconsole: Alias for bin/n98-magerun2 dev:console

bin/devtools-cli-check: Check & install the CLI devtools if missing from system.

bin/download: Download specific Magento version from Composer to /var/www/html directory within the container. Ex. bin/download 2.4.2 community

bin/fixowns: This will fix filesystem ownerships within the container.

bin/fixperms: This will fix filesystem permissions within the container.

bin/grunt: Run the grunt binary. Ex. bin/grunt exec

bin/magento: Run the Magento CLI. Ex: bin/magento cache:flush

bin/mysql: Run the MySQL CLI with database config from env/db.env. Ex. bin/mysql -e "EXPLAIN core_config_data" orbin/mysql < backups/magento.sql

bin/mysqldump: Backup the Magento database. Ex. bin/mysqldump > backups/magento.sql

bin/n98-magerun2: Access the n98-magerun2 CLI. Ex: bin/n98-magerun2 dev:console

bin/node: Run the node binary. Ex. bin/node --version

bin/npm: Run the npm binary. Ex. bin/npm install

bin/pwa-studio: (BETA) Start the PWA Studio server. Note that Chrome will throw SSL cert errors and not allow you to view the site, but Firefox will.

bin/redis: Run a command from the redis container. Ex. bin/redis redis-cli monitor

bin/remove: Remove all containers.

bin/removeall: Remove all containers, networks, volumes, and images.

bin/removevolumes: Remove all volumes.

bin/restart: Stop and then start all containers.

bin/root: Run any CLI command as root without going into the bash prompt. Ex bin/root apt-get install nano

bin/rootnotty: Run any CLI command as root with no TTY. Ex bin/rootnotty chown -R app:app /var/www/html

bin/setup: Run the Magento setup process to install Magento from the source code, with optional domain name. Defaults to magento.test. Ex. bin/setup magento.test

bin/setup-composer-auth: Setup authentication credentials for Composer.

bin/setup-grunt: Install and configure Grunt JavaScript task runner to compile .less files

bin/setup-pwa-studio: (BETA) Install PWA Studio (requires NodeJS and Yarn to be installed on the host machine). Pass in your base site domain, otherwise the default master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud will be used. Ex: bin/setup-pwa-studio magento.test

bin/setup-ssl: Generate an SSL certificate for one or more domains. Ex. bin/setup-ssl magento.test foo.test

bin/setup-ssl-ca: Generate a certificate authority and copy it to the host.

bin/start: Start all containers, good practice to use this instead of docker-compose up -d, as it may contain additional helpers.

bin/status: Check the container status.

bin/stop: Stop all containers.

bin/update: Update your project to the most recent version of docker-magento.

bin/xdebug: Disable or enable Xdebug. Accepts params disable (default) or enable. Ex. bin/xdebug enable