Giter VIP home page Giter VIP logo

magento.docker's Introduction

cusspvz/magento

@GitHub @Docker Hub

a scalable Magento 2.0 image based on Alpine, PHP-FPM, NginX and MariaDB Galera Cluster

magento-docker

Launching

Ephemeral data

docker run -ti -p 80:80 cusspvz/magento

Persistent data

docker run -ti cusspvz/magento

NOTE: I've used volume names instead of absolute paths, but please change accordingly with your needs.

Clustered data

WHAAAT????

Yes, this image is scalable. You just need to pass down how can it reach other nodes and it will scale MariaDB.

docker run -ti --name magento1 cusspvz/magento
docker run -ti --name magento2 -l magento1:magento1 -e NODES=magento1 cusspvz/magento
docker run -ti --name magento3 -l magento1:magento1 -e NODES=magento1 cusspvz/magento

Environment Variables

Clustering configuration

NODES

Defaults to (Empty string)

This variable will allow this container to scale among other nodes and share the same data (from database and other assets)

You just need to pass down a list delimited by a comma (node1,node2,node3...) and it will automatically configure and scale.

NOTE: This only needs one active host, it will actually discover the other ones automatically. In case you use [rancher] or other orchestration tool that provides a DNS for all the nodes, you could simply pass it instead.

WARNING: Clustering will be disabled in case you decide to use an external database, meaning you will be responsable for handling all the data, including the shared media resources such as product images.

Mysql configuration

MYSQL_HOST

Defaults to localhost

If this value is different than localhost, internal mysql server WON'T be initialized! Do this only in case you want to take care of data and scaling manually.

MYSQL_PORT

Defaults to 3306

MYSQL_DATABASE

Defaults to magento

MYSQL_USER

Defaults to root

MYSQL_PASSWORD

Defaults to ThisShouldBeChangableLater

nice password, hehehe

Roadmap / TODO

  • Check benefits of including APC on the stack
  • Add support for Redis clustering once sharding is automatic
  • Add support for external Redis server

Contributing

Building the image

docker build -t magento .
docker run -ti -p 80:80 magento

Watch files and build

inotifywait -mr --timefmt '%d/%m/%y %H:%M' --format '%T %w %f' \
-e close_write $(pwd) | \
while read date time dir file; do
  docker build -t magento .

  docker kill magento
  docker rm magento
  docker run -ti \
    --name magento \
    -v magento_settings:/magento/app/etc
    -v magento_data:/magento/pub
    -v magento_mysql_data:/var/lib/mysql
    -p 80:80 \
    magento &
done

FAQ

Another magento image?

There are a few images that covers Magento 2, fewer on MariaDB and even fewer on Alpine.

The main purpose of this image is to deliver a ready to use image, just launch it and you're ready to go!

Wait, but what if I want my own MariaDB/MySQL to be a separated container?

Just launch your container with a different MYSQL_HOST.

Example
docker run -d --name=magento-mysql mysql;
docker run -d --name=magento \
    -e MYSQL_HOST=mysql-server
    -l magento-mysql:mysql-server \
    cusspvz/magento;

Why you did choose such stack?

Well, who doesn't want a Magento container to spend only about ~350MB of RAM? If you launch this stack separately you will face an ~1.8GB of RAM footprint.

Seems legit?

Then, while building it I've decided it should be completely scalable, so there it is.

You're god!!

Amén!

Just kidding, I'm not but if you really enjoyed this please spread the word. Show your love by sharing on Twitter and giving a star to this repo!

Licensing

GPL 3.0

Copyright

2016 - 'til Infinity Brought to you with <3 by José Moreira

magento.docker's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

magento.docker's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.