Home

Awesome

Docker Configuration for Magento 2

Deploy secure and flexible docker infrastructure for Magento 2 in a matter of seconds.

<img src="https://user-images.githubusercontent.com/1591200/117845471-7abda280-b278-11eb-8c88-db3fa307ae40.jpeg" width="200" height="140"> <img src="https://user-images.githubusercontent.com/1591200/139601566-f4a62101-1ead-462e-a360-6397437de5cb.png" width="175" height="145"> <img src="https://user-images.githubusercontent.com/1591200/118028531-158ead80-b35b-11eb-8957-636de16ada34.png" width="250" height="155"> <img src="https://user-images.githubusercontent.com/1591200/130320410-91749ce8-5af1-4802-af25-ffb36e7ded98.png" width="100" height="115">

<br />

:rocket: Deploy your project:

Disclaimer: By default, the latest versions of packages are configured, above those recommended by Magento 2

you can use any linux host or Docker Desktop
https://docs.docker.com/
https://docs.docker.com/engine/install/debian/

   curl -Lo init.sh https://raw.githubusercontent.com/magenx/Magento-2-docker-configuration/main/init.sh && . init.sh

or

  apt update && apt upgrade -y
  apt-get -y install ca-certificates software-properties-common screen ipset vim strace rsyslog git apache2-utils
  install -m 0755 -d /etc/apt/keyrings
  curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
  chmod a+r /etc/apt/keyrings/docker.asc
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  tee /etc/apt/sources.list.d/docker.list > /dev/null
  apt-get update
   apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  echo "alias doco='docker compose'" >> ~/.bash_profile
  . ~/.bash_profile
  mkdir /opt/magento && cd /opt/magento
  git clone https://github.com/magenx/Magento-2-docker-configuration.git .

https://docs.docker.com/compose/compose-file/compose-file-v3/#secrets

   bash passgen.sh
<br />

When mariadb is started for the first time, a new database with the specified name will be created and initialized with the provided configuration variables. Furthermore, it will execute files with extensions .sh, .sql, .sql.gz, .sql.xz and .sql.zst that are found in ./mariadb/
magento container using files from this repository - https://github.com/magenx/Magento-2-docker-demo , with custom env.php <br />

[ ! ] Check all data, adjust your settings, edit your variables

   doco build --no-cache php       
   doco up -d
   tail -f /var/log/syslog
<br />
  doco stop nginx  
  doco run -p 80:80 --rm certbot certonly \
  --email ${ADMIN_EMAIL} --agree-tos --no-eff-email --standalone -d ${DOMAIN} --staging  
  doco start nginx  

change your nginx configuration to uncomment tls/ssl
remove [--staging] flag to reissue live certificate

  doco run --rm certbot certonly \
  --email ${ADMIN_EMAIL} --agree-tos --no-eff-email --webroot -w ${WEB_ROOT_PATH} -d ${DOMAIN}  
  doco restart nginx
<br />
doco logs mariadb 2>&1 | grep GENERATED
magenx-mariadb   | 2021-11-16 08:48:17-05:00 [Note] [Entrypoint]: GENERATED ROOT PASSWORD: xxxxxxxx
<br />

magento entrypoint is n98-magerun2 script, looks like providing more commands and options

   doco run --rm composer update
   doco run --rm php -m
   doco run --rm magento module:status --enabled
   doco run --rm magento module:disable {module name}
<br />
   doco down
   
   Stopping magenx-cron          ... done
   Stopping magenx-nginx         ... done
   Stopping magenx-php           ... done
   Stopping magenx-magento       ... done
   Stopping magenx-opensearch    ... done
   Stopping magenx-rabbitmq      ... done
   Stopping magenx-varnish       ... done
   Stopping magenx-certbot       ... done
   Stopping magenx-nodejs        ... done
   Stopping magenx-phpmyadmin    ... done
   Stopping magenx-mariadb       ... done
   Stopping magenx-redis         ... done
<br />

:hammer_and_wrench: Stack components in use:

<br />