diff --git a/.gitignore b/.gitignore index c228a97c263..2a6a4f31886 100755 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,8 @@ /src/* .DS_Store /.idea -/docker-compose.yml +src +db +server/proxy/logs/ +src/index.php +server/proxy/ssl/ diff --git a/.docker/bin/fix-permission b/Dockerfile/apache/.docker/bin/fix-permission similarity index 100% rename from .docker/bin/fix-permission rename to Dockerfile/apache/.docker/bin/fix-permission diff --git a/.docker/bin/install-magento2 b/Dockerfile/apache/.docker/bin/install-magento2 old mode 100755 new mode 100644 similarity index 100% rename from .docker/bin/install-magento2 rename to Dockerfile/apache/.docker/bin/install-magento2 diff --git a/.docker/bin/opcache b/Dockerfile/apache/.docker/bin/opcache old mode 100755 new mode 100644 similarity index 100% rename from .docker/bin/opcache rename to Dockerfile/apache/.docker/bin/opcache diff --git a/.docker/bin/redis-flush b/Dockerfile/apache/.docker/bin/redis-flush similarity index 100% rename from .docker/bin/redis-flush rename to Dockerfile/apache/.docker/bin/redis-flush diff --git a/.docker/bin/xdebug b/Dockerfile/apache/.docker/bin/xdebug old mode 100755 new mode 100644 similarity index 100% rename from .docker/bin/xdebug rename to Dockerfile/apache/.docker/bin/xdebug diff --git a/.docker/config/custom-xdebug.ini b/Dockerfile/apache/.docker/config/custom-xdebug.ini old mode 100755 new mode 100644 similarity index 100% rename from .docker/config/custom-xdebug.ini rename to Dockerfile/apache/.docker/config/custom-xdebug.ini diff --git a/.docker/config/magento.conf b/Dockerfile/apache/.docker/config/magento.conf old mode 100755 new mode 100644 similarity index 100% rename from .docker/config/magento.conf rename to Dockerfile/apache/.docker/config/magento.conf diff --git a/.docker/config/opcache.ini b/Dockerfile/apache/.docker/config/opcache.ini old mode 100755 new mode 100644 similarity index 100% rename from .docker/config/opcache.ini rename to Dockerfile/apache/.docker/config/opcache.ini diff --git a/.docker/config/php.ini b/Dockerfile/apache/.docker/config/php.ini old mode 100755 new mode 100644 similarity index 100% rename from .docker/config/php.ini rename to Dockerfile/apache/.docker/config/php.ini diff --git a/.docker/users/.bashrc b/Dockerfile/apache/.docker/users/.bashrc old mode 100755 new mode 100644 similarity index 100% rename from .docker/users/.bashrc rename to Dockerfile/apache/.docker/users/.bashrc diff --git a/.docker/users/env.sample.php b/Dockerfile/apache/.docker/users/env.sample.php old mode 100755 new mode 100644 similarity index 100% rename from .docker/users/env.sample.php rename to Dockerfile/apache/.docker/users/env.sample.php diff --git a/Dockerfile/apache/Dockerfile b/Dockerfile/apache/Dockerfile new file mode 100644 index 00000000000..e4108ae1913 --- /dev/null +++ b/Dockerfile/apache/Dockerfile @@ -0,0 +1,128 @@ +FROM php:7.2-apache + +MAINTAINER Rafael CorrΓͺa Gomes + +ENV XDEBUG_PORT 9000 + +# Install System Dependencies + +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + software-properties-common \ + && apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + libfreetype6-dev \ + libicu-dev \ + libssl-dev \ + libjpeg62-turbo-dev \ + libmcrypt-dev \ + libedit-dev \ + libedit2 \ + libxslt1-dev \ + apt-utils \ + gnupg \ + redis-tools \ + mariadb-client \ + git \ + vim \ + wget \ + curl \ + lynx \ + psmisc \ + unzip \ + tar \ + cron \ + bash-completion \ + libsodium-dev \ + && apt-get clean + +# Install Magento Dependencies + +RUN docker-php-ext-configure \ + gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/; \ + docker-php-ext-install \ + opcache \ + gd \ + bcmath \ + intl \ + mbstring \ + # mcrypt \ + pdo_mysql \ + soap \ + xsl \ + zip \ + sockets + +# Install oAuth + +RUN apt-get update \ + && apt-get install -y \ + libpcre3 \ + libpcre3-dev \ + # php-pear \ + && pecl install oauth \ + && echo "extension=oauth.so" > /usr/local/etc/php/conf.d/docker-php-ext-oauth.ini + +# Install Node, NVM, NPM and Grunt + +RUN curl -sL https://deb.nodesource.com/setup_11.x | bash - \ + && apt-get install -y nodejs build-essential \ + && curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | sh \ + && npm i -g grunt-cli yarn + +# Install Composer + +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer +RUN composer global require hirak/prestissimo + +# Install Code Sniffer + +RUN git clone https://github.com/magento/marketplace-eqp.git ~/.composer/vendor/magento/marketplace-eqp +RUN cd ~/.composer/vendor/magento/marketplace-eqp && composer install +RUN ln -s ~/.composer/vendor/magento/marketplace-eqp/vendor/bin/phpcs /usr/local/bin; + +ENV PATH="/var/www/.composer/vendor/bin/:${PATH}" + +# Install XDebug + +RUN yes | pecl install xdebug && \ + echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.iniOLD + +# Install Mhsendmail + +RUN DEBIAN_FRONTEND=noninteractive apt-get -y install golang-go \ + && mkdir /opt/go \ + && export GOPATH=/opt/go \ + && go get github.com/mailhog/mhsendmail + +# Install Magerun 2 + +RUN wget https://files.magerun.net/n98-magerun2.phar \ + && chmod +x ./n98-magerun2.phar \ + && mv ./n98-magerun2.phar /usr/local/bin/ + +# Configuring system + +ADD .docker/config/php.ini /usr/local/etc/php/php.ini +ADD .docker/config/magento.conf /etc/apache2/sites-available/magento.conf +ADD .docker/config/custom-xdebug.ini /usr/local/etc/php/conf.d/custom-xdebug.ini +COPY .docker/bin/* /usr/local/bin/ +COPY .docker/users/* /var/www/ +RUN chmod +x /usr/local/bin/* +RUN ln -s /etc/apache2/sites-available/magento.conf /etc/apache2/sites-enabled/magento.conf + +RUN curl -o /etc/bash_completion.d/m2install-bash-completion https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install-bash-completion +RUN curl -o /etc/bash_completion.d/n98-magerun2.phar.bash https://raw.githubusercontent.com/netz98/n98-magerun2/master/res/autocompletion/bash/n98-magerun2.phar.bash +RUN echo "source /etc/bash_completion" >> /root/.bashrc +RUN echo "source /etc/bash_completion" >> /var/www/.bashrc + +RUN chmod 777 -Rf /var/www /var/www/.* \ + && chown -Rf www-data:www-data /var/www /var/www/.* \ + && usermod -u 1000 www-data \ + && chsh -s /bin/bash www-data\ + && a2enmod rewrite \ + && a2enmod headers \ + && a2enmod ssl + +VOLUME /var/www/html +WORKDIR /var/www/html diff --git a/Dockerfile/pwa/.docker/bin/fix-permission b/Dockerfile/pwa/.docker/bin/fix-permission new file mode 100644 index 00000000000..6b0e7041813 --- /dev/null +++ b/Dockerfile/pwa/.docker/bin/fix-permission @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +chmod -R 777 /var/www/ +# find /var/www/html/ -type f -exec chmod 644 {} \; # 644 permission for files +# find /var/www/html/ -type d -exec chmod 755 {} \; # 755 permission for directory +# if [ -d /var/www/html/var/ ]; then +# find /var/www/html/var/ -type d -exec chmod 777 {} \; # 777 permission for var folder +# fi +# if [ -d /var/www/html/pub/ ]; then +# find /var/www/html/pub/ -type d -exec chmod 777 {} \; +# fi +# if [ -d /var/www/html/app/etc ]; then +# chmod 777 /var/www/html/app/etc +# chmod 644 /var/www/html/app/etc/*.xml +# fi +# chown -R :www-data /var/www/html/ +if [ -e "/var/www/html/bin/magento" ]; then + chmod u+x /var/www/html/bin/magento +fi diff --git a/Dockerfile/pwa/.docker/bin/install-magento2 b/Dockerfile/pwa/.docker/bin/install-magento2 new file mode 100644 index 00000000000..44d71e505ea --- /dev/null +++ b/Dockerfile/pwa/.docker/bin/install-magento2 @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +if [ $@ ]; then + composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition:$1 . ; +else + composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition . ; +fi +chmod u+w -R ./var ./vendor ./pub/static ./pub/media ./app/etc \ +&& chmod u+x ./bin/magento \ +&& php -f ./bin/magento setup:install --base-url=http://localhost/ \ + --db-host=db \ + --db-name=magento \ + --db-user=magento \ + --db-password=magento \ + --admin-firstname=Magento \ + --admin-lastname=Commerce \ + --admin-email=user@example.com \ + --admin-user=admin \ + --admin-password=admin123 \ + --language=en_US \ + --currency=USD \ + --timezone=America/Chicago \ + --use-rewrites=1 \ + --backend-frontname=admin \ + --use-sample-data \ +&& mv ./app/etc/env.php ./app/etc/env.original.php; +cp -rv /var/www/env.sample.php ./app/etc/env.php; +n98 cron:install; +php -f ./bin/magento indexer:set-mode schedule; +cp ~/.composer/auth.json var/composer_home/auth.json \ +&& php -f ./bin/magento sampledata:deploy \ +&& php -f ./bin/magento setup:upgrade \ +&& php -f ./bin/magento indexer:reindex \ +&& php -f ./bin/magento cache:flush; +mv package.json.sample package.json ; mv Gruntfile.js.sample Gruntfile.js; +npm i; +php -f ./bin/magento deploy:mode:set production \ +&& composer dump-autoload -o \ +&& clear && echo " +===================== πŸš€ Done πŸš€ =================== + + Magento 2 Installed successfully! + + 🌎 Admin: http://localhost/admin + πŸ‘€ User: admin + πŸ”‘ Password: admin123 + +===================== πŸš€ Done πŸš€ ===================" diff --git a/Dockerfile/pwa/.docker/bin/opcache b/Dockerfile/pwa/.docker/bin/opcache new file mode 100644 index 00000000000..c044f6684b1 --- /dev/null +++ b/Dockerfile/pwa/.docker/bin/opcache @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +if [ -s "/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini" ]; then + mv /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini /usr/local/etc/php/conf.d/docker-php-ext-opcache.iniOLD \ + && /etc/init.d/apache2 force-reload \ + && echo '========= OPCache was disabled =========' +else + mv /usr/local/etc/php/conf.d/docker-php-ext-opcache.iniOLD /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini \ + && /etc/init.d/apache2 force-reload \ + && echo '========= OPCache was enabled =========' +fi diff --git a/Dockerfile/pwa/.docker/bin/redis-flush b/Dockerfile/pwa/.docker/bin/redis-flush new file mode 100644 index 00000000000..21bb16cab32 --- /dev/null +++ b/Dockerfile/pwa/.docker/bin/redis-flush @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +redis-cli -h redis-session flushall +redis-cli -h redis flushall diff --git a/Dockerfile/pwa/.docker/bin/xdebug b/Dockerfile/pwa/.docker/bin/xdebug new file mode 100644 index 00000000000..e3ba5708280 --- /dev/null +++ b/Dockerfile/pwa/.docker/bin/xdebug @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +if [ -s "/usr/local/etc/php/conf.d/xdebug.ini" ]; then + mv /usr/local/etc/php/conf.d/xdebug.ini /usr/local/etc/php/conf.d/xdebug.iniOLD \ + && /etc/init.d/apache2 force-reload \ + && echo '========= XDebug was disabled =========' +else + mv /usr/local/etc/php/conf.d/xdebug.iniOLD /usr/local/etc/php/conf.d/xdebug.ini \ + && /etc/init.d/apache2 force-reload \ + && echo '========= XDebug was enabled =========' +fi diff --git a/Dockerfile/pwa/.docker/config/custom-xdebug.ini b/Dockerfile/pwa/.docker/config/custom-xdebug.ini new file mode 100644 index 00000000000..4b18dacdb94 --- /dev/null +++ b/Dockerfile/pwa/.docker/config/custom-xdebug.ini @@ -0,0 +1,11 @@ +xdebug.idekey="PHPSTORM" +xdebug.default_enable=1 +xdebug.remote_port=9000 +xdebug.remote_autostart=1 +xdebug.remote_enable=1 +xdebug.remote_handler=dbgp +xdebug.profiler_enable=0 +xdebug.profiler_output_dir="/var/www/html" +xdebug.remote_connect_back=1 +xdebug.cli_color=1 +xdebug.var_display_max_depth=10 diff --git a/Dockerfile/pwa/.docker/config/magento.conf b/Dockerfile/pwa/.docker/config/magento.conf new file mode 100644 index 00000000000..d661d4194ce --- /dev/null +++ b/Dockerfile/pwa/.docker/config/magento.conf @@ -0,0 +1,14 @@ + + ServerAdmin admin@yourdomain.com + DocumentRoot /var/www/html/ +# ServerName dev.local +# ServerAlias www.dev.local + + Options FollowSymLinks + AllowOverride All + Order allow,deny + allow from all + + ErrorLog /var/log/apache2/magento2-error_log + CustomLog /var/log/apache2/magento2-access_log common + diff --git a/Dockerfile/pwa/.docker/config/opcache.ini b/Dockerfile/pwa/.docker/config/opcache.ini new file mode 100644 index 00000000000..0fd46984224 --- /dev/null +++ b/Dockerfile/pwa/.docker/config/opcache.ini @@ -0,0 +1,10 @@ +opcache.enable = 1 +opcache.enable_cli = 1 +opcache.memory_consumption = 512M +opcache.max_accelerated_files = 100000 +opcache.validate_timestamps=0 +opcache.consistency_checks=0 +opcache.interned_strings_buffer=8 +opcache.fast_shutdown=1 +opcache.revalidate_freq = 0 +opcache.revalidate_path = 1 diff --git a/Dockerfile/pwa/.docker/config/php.ini b/Dockerfile/pwa/.docker/config/php.ini new file mode 100644 index 00000000000..45912edd0d8 --- /dev/null +++ b/Dockerfile/pwa/.docker/config/php.ini @@ -0,0 +1,9 @@ +memory_limit = 2048M +max_execution_time = 38000 +always_populate_raw_post_data = -1 +date.timezone = "UTC" +upload_max_filesize = 128M +zlib.output_compression = on +log_errors = On +display_errors = Off +sendmail_path = "/opt/go/bin/mhsendmail --smtp-addr='mailhog:1025'" diff --git a/Dockerfile/pwa/.docker/users/.bashrc b/Dockerfile/pwa/.docker/users/.bashrc new file mode 100644 index 00000000000..23e058b07ae --- /dev/null +++ b/Dockerfile/pwa/.docker/users/.bashrc @@ -0,0 +1,12 @@ +# Alias + +alias n98='n98-magerun2.phar' +alias magerun='n98-magerun2.phar' +alias mage='php -d memory_limit=-1 -f bin/magento' +alias magento='php -d memory_limit=-1 -f bin/magento' +alias node='nodejs' + +# NVM + +export NVM_DIR="/var/www/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm diff --git a/env.sample.php b/Dockerfile/pwa/.docker/users/env.sample.php old mode 100755 new mode 100644 similarity index 100% rename from env.sample.php rename to Dockerfile/pwa/.docker/users/env.sample.php diff --git a/Dockerfile b/Dockerfile/pwa/Dockerfile old mode 100755 new mode 100644 similarity index 95% rename from Dockerfile rename to Dockerfile/pwa/Dockerfile index 21425761e4e..6fdfe5289a9 --- a/Dockerfile +++ b/Dockerfile/pwa/Dockerfile @@ -1,4 +1,4 @@ -FROM php:7.1-apache +FROM php:7.2-apache MAINTAINER Rafael CorrΓͺa Gomes @@ -22,7 +22,7 @@ RUN apt-get update \ apt-utils \ gnupg \ redis-tools \ - mysql-client \ + mariadb-client \ git \ vim \ wget \ @@ -33,6 +33,7 @@ RUN apt-get update \ tar \ cron \ bash-completion \ + libsodium-dev \ && apt-get clean # Install Magento Dependencies @@ -45,11 +46,12 @@ RUN docker-php-ext-configure \ bcmath \ intl \ mbstring \ - mcrypt \ + # mcrypt \ pdo_mysql \ soap \ xsl \ - zip + zip \ + sockets # Install oAuth @@ -63,7 +65,7 @@ RUN apt-get update \ # Install Node, NVM, NPM and Grunt -RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - \ +RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \ && apt-get install -y nodejs build-essential \ && curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | sh \ && npm i -g grunt-cli yarn diff --git a/chikatana b/chikatana new file mode 100755 index 00000000000..8bcd860153c --- /dev/null +++ b/chikatana @@ -0,0 +1,190 @@ +#!/usr/bin/python +import sys +import os +import colorama +from colorama import Fore, Style + +if sys.argv[0] != "./chikatana": + print("Comando no valido.") + exit(0) + +def printHelp(): + print("Chikatana Command Line:") + +if len(sys.argv) == 1: + printHelp() + exit(0) + +if sys.argv[1] == "init": + os.system("docker-compose up -d") + exit(0) + +if sys.argv[1] == "up": + os.system("docker-compose up -d") + exit(0) + +if sys.argv[1] == "down": + os.system("docker-compose down") + exit(0) + +if sys.argv[1] == "restart": + os.system("docker-compose down && docker-compose up -d") + exit(0) + + + +################################################################################### +# # +# DOCKER COMMANDS # +# # +################################################################################### + +if sys.argv[1] == "docker": + if len(sys.argv) == 3: + if sys.argv[2] == "ps": + os.system("docker-compose ps") + exit(0) + + # Mensaje para indicar que el comando no fue encontrado + print("El comando docker no encontrado") + elif len(sys.argv) > 3: + if sys.argv[2] == "magento": + if sys.argv[3] == "build": + os.system("cd Dockerfile/apache && docker build --rm --no-cache -t palomino/magento:apache .") + exit(0) + + # Mensaje para indicar que el comando no fue encontrado + print("El comando docker no encontrado") + else: + # Mensaje para indicar que el comando no se puede ejecutar + print("El comando docker esta incompleto") + exit(0) + + + + +################################################################################### +# # +# MAGENTO COMMANDS # +# # +################################################################################### + +if sys.argv[1] == "magento": + if len(sys.argv) == 2: + os.system("docker-compose exec -u www-data apache bash") + exit(0) + elif len(sys.argv) >= 3: + if sys.argv[2] == "composer": + os.system("docker-compose exec -u www-data apache composer install") + exit(0) + elif sys.argv[2] == "upgrade": + os.system("docker-compose exec -u www-data apache php bin/magento setup:upgrade") + exit(0) + + + + ########################################################################### + # CACHE COMMANDS # + ########################################################################### + + elif sys.argv[2] == "cache": + if len(sys.argv) == 3: + print(Fore.BLUE + "Clear Cahe ..." + Style.RESET_ALL) + os.system("docker-compose exec -u www-data apache php bin/magento cache:clean") + print(Fore.GREEN + "Hecho." + Style.RESET_ALL) + exit(0) + elif sys.argv[3] == "status": + os.system("docker-compose exec -u www-data apache php bin/magento cache:status") + exit(0) + elif sys.argv[3] == "enable": + print(Fore.BLUE + "Enable Cahe ..." + Style.RESET_ALL) + os.system("docker-compose exec -u www-data apache php bin/magento cache:enable") + print(Fore.BLUE + "Disable Cahe Modules ..." + Style.RESET_ALL) + os.system("docker-compose exec -u www-data apache php bin/magento cache:disable collections eav full_page layout") + print(Fore.GREEN + "Hecho." + Style.RESET_ALL) + exit(0) + elif sys.argv[3] == "disable": + print(Fore.BLUE + "Disable Cahe ..." + Style.RESET_ALL) + os.system("docker-compose exec -u www-data apache php bin/magento cache:disable") + print(Fore.GREEN + "Hecho." + Style.RESET_ALL) + exit(0) + elif sys.argv[3] == "clear": + print(Fore.BLUE + "Clear Cahe ..." + Style.RESET_ALL) + os.system("docker-compose exec -u www-data apache php bin/magento cache:clean") + # print(Fore.BLUE + "Cambiando permisos ..." + Style.RESET_ALL) + # os.system("docker-compose exec -u www-data apache chown -R www-data:www-data generated pub var") + print(Fore.GREEN + "Hecho." + Style.RESET_ALL) + exit(0) + else: + print("El comando de magento esta incompleto") + + + + ########################################################################### + # TEMPLATE HINTS COMMANDS # + ########################################################################### + + elif sys.argv[2] == "template-hints": + if len(sys.argv) == 4 and sys.argv[3] == "enable": + print(Fore.BLUE + "Enable template hints ..." + Style.RESET_ALL) + os.system("docker-compose exec -u www-data apache php bin/magento dev:template-hints:enable") + else: + print(Fore.BLUE + "Disable template hints ..." + Style.RESET_ALL) + os.system("docker-compose exec -u www-data apache php bin/magento dev:template-hints:disable") + + print(Fore.BLUE + "Clear Cahe ..." + Style.RESET_ALL) + os.system("docker-compose exec -u www-data apache php bin/magento cache:clean") + print(Fore.GREEN + "Hecho." + Style.RESET_ALL) + exit(0) + + + + ########################################################################### + # STYLES COMMANDS # + ########################################################################### + + elif sys.argv[2] == "styles": + print(Fore.BLUE + "Compilando Estilos ..." + Style.RESET_ALL) + os.system("docker-compose exec -u www-data apache grunt clean exec:biz less:biz;") + print(Fore.BLUE + "Borrando Cahe ..." + Style.RESET_ALL) + os.system("docker-compose exec -u www-data apache php bin/magento cache:clean") + print(Fore.GREEN + "Hecho." + Style.RESET_ALL) + exit(0) + + + + ########################################################################### + # STYLES COMMANDS # + ########################################################################### + + elif sys.argv[2] == "static-content": + print(Fore.BLUE + "Deploy static content ..." + Style.RESET_ALL) + os.system("docker-compose exec -u www-data apache php bin/magento setup:static-content:deploy es_MX -f") + print(Fore.GREEN + "Hecho." + Style.RESET_ALL) + exit(0) + + + ########################################################################### + # OTHERS COMMANDS # + ########################################################################### + + elif sys.argv[2] == "create": + if sys.argv[3] == "admin-user": + print(Fore.BLUE + "Creando Palomino admin ..." + Style.RESET_ALL) + os.system("docker-compose exec -u www-data apache php bin/magento admin:user:create --admin-user='palomino' --admin-password='Law200110513' --admin-email='palomino@wolfsellers.com' --admin-firstname='palomino' --admin-lastname='palomino'") + else: + print("No se encontro el commando a ejecutar.") + exit(0) + + + # Mensaje para indicar que el comando no fue encontrado + print("El comando docker no encontrado") + elif len(sys.argv) > 3: + # if sys.argv[2] == "build": + + # Mensaje para indicar que el comando no fue encontrado + print("El comando docker no encontrado") + else: + # Mensaje para indicar que el comando no se puede ejecutar + print("El comando de magento esta incompleto") + exit(0) diff --git a/composer b/composer deleted file mode 100755 index 4cae6d306e9..00000000000 --- a/composer +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -docker-compose exec --user www-data apache composer $@ diff --git a/docker-compose.elasticsearch.yml b/docker-compose.elasticsearch.yml index 68f6659a9eb..6ed47c631fe 100644 --- a/docker-compose.elasticsearch.yml +++ b/docker-compose.elasticsearch.yml @@ -11,7 +11,7 @@ services: soft: -1 hard: -1 volumes: - - ./elasticsearchdata:/usr/share/elasticsearch/data + - ./server/elasticsearch:/usr/share/elasticsearch/data ports: - 9200:9200 networks: diff --git a/docker-compose.yml b/docker-compose.yml index 8bcea16a724..77b733c2ca3 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,79 +1,105 @@ version: '2' services: - apache: - image: rafaelcgstz/magento2 - # build: . - ports: - - "80:80" # web - - "9001:9000" # xdebug - # - "35729:35729" # live reload - volumes: - - ./src:/var/www/html - - ~/.composer:/var/www/.composer - - ~/.npm:/var/www/.npm - # - ~/.nvm:/var/www/.nvm - environment: - XDEBUG_CONFIG: "remote_host=localhost" - PHP_IDE_CONFIG: "serverName=Docker" - depends_on: - - db - links: - - db - networks: - - -network + pwa: + image: palomino/magento:pwa + ports: + - "8082:80" # web + volumes: + - ./pwa:/var/www/html + - ~/.composer:/var/www/.composer + - ~/.npm:/var/www/.npm + - ~/.ssh:/root/.ssh + environment: + XDEBUG_CONFIG: "remote_host=ananda.ckt" + PHP_IDE_CONFIG: "serverName=Docker" + depends_on: + - db + links: + - db + networks: + - magento-network - db: - image: mariadb - ports: - - 3300:3306 - environment: - - MYSQL_ROOT_PASSWORD=root - - MYSQL_DATABASE=magento - - MYSQL_USER=magento - - MYSQL_PASSWORD=magento - volumes: - - dbdata:/var/lib/mysql - networks: - - -network + apache: + image: palomino/magento:apache + # build: . + ports: + - "80:80" # web + - "443:443" + - "9001:9000" # xdebug + # - "35729:35729" # live reload + volumes: + - ./src:/var/www/html + - ~/.composer:/var/www/.composer + - ~/.npm:/var/www/.npm + - ~/.ssh:/root/.ssh + - ./server/proxy/ssl:/etc/apache2/ssl + - ./server/proxy/vhost:/etc/apache2/sites-enabled + - ./server/proxy/logs:/var/www/ananda.ckt/logs + - ./env/magento/magento-vars.php:/app/magento-vars.php + - ./env/magento/php.ini:/usr/local/etc/php/php.ini + # - ~/.nvm:/var/www/.nvm + environment: + XDEBUG_CONFIG: "remote_host=ananda.ckt" + PHP_IDE_CONFIG: "serverName=Docker" + depends_on: + - db + links: + - db + networks: + - magento-network - phpmyadmin: - image: phpmyadmin/phpmyadmin - environment: - - PMA_HOST=db - - PMA_USER=root - - PMA_PASSWORD=root - - MYSQL_ROOT_PASSWORD=root - ports: - - 8080:80 - networks: - - -network + db: + image: mariadb + ports: + - 3300:3306 + environment: + - MYSQL_ROOT_PASSWORD=root + - MYSQL_DATABASE=magento + - MYSQL_USER=magento + - MYSQL_PASSWORD=magento + volumes: + - dbdata:/var/lib/mysql + networks: + - magento-network - redis: - image: redis - ports: - - 6379 - networks: - - -network + phpmyadmin: + image: phpmyadmin/phpmyadmin + environment: + - PMA_HOST=db + - PMA_USER=root + - PMA_PASSWORD=root + - MYSQL_ROOT_PASSWORD=root + ports: + - 8080:80 + networks: + - magento-network - redis-session: - image: redis - ports: - - 6379 - networks: - - -network + redis: + image: redis + ports: + - 6379 + networks: + - magento-network - mailhog: - image: mailhog/mailhog - ports: - - 1025:1025 - - 8025:8025 - networks: - - -network + redis-session: + image: redis + ports: + - 6379 + networks: + - magento-network + + mailhog: + image: mailhog/mailhog + ports: + - 1025:1025 + - 8025:8025 + networks: + - magento-network networks: - -network: - driver: bridge + magento-network: + driver: bridge volumes: - dbdata: - driver: local + dbdata: + driver: local diff --git a/env/magento/env.sample.php b/env/magento/env.sample.php new file mode 100644 index 00000000000..eee1069ddac --- /dev/null +++ b/env/magento/env.sample.php @@ -0,0 +1,125 @@ + + array( + 'frontName' => 'admin', + ), + 'crypt' => + array( + 'key' => '5e56dc6d8f24f711bb4f289cca1beda9', + ), + 'session' => + array( + 'save' => 'redis', + 'redis' => + array( + + 'host' => 'redis-session', + 'port' => '6379', + 'password' => '', + 'timeout' => '2.5', + 'persistent_identifier' => '', + 'database' => '2', + 'compression_threshold' => '2048', + 'compression_library' => 'gzip', + 'log_level' => '1', + 'max_concurrency' => '6', + 'break_after_frontend' => '5', + 'break_after_adminhtml' => '30', + 'first_lifetime' => '600', + 'bot_first_lifetime' => '60', + 'bot_lifetime' => '7200', + 'disable_locking' => '0', + 'min_lifetime' => '60', + 'max_lifetime' => '2592000' + ) + ), + 'db' => + array( + 'table_prefix' => '', + 'connection' => + array( + 'default' => + array( + 'host' => 'db', + 'dbname' => 'magento', + 'username' => 'magento', + 'password' => 'magento', + 'active' => '1', + ), + ), + ), + 'resource' => + array( + 'default_setup' => + array( + 'connection' => 'default', + ), + ), + 'x-frame-options' => 'SAMEORIGIN', + 'MAGE_MODE' => 'production', + 'cache_types' => + array( + 'config' => 1, + 'layout' => 1, + 'block_html' => 1, + 'collections' => 1, + 'reflection' => 1, + 'db_ddl' => 1, + 'eav' => 1, + 'customer_notification' => 1, + 'full_page' => 0, + 'config_integration' => 1, + 'config_integration_api' => 1, + 'translate' => 1, + 'config_webservice' => 1, + 'compiled_config' => 1, + ), + 'install' => + array( + 'date' => 'Thu, 05 Jan 2017 22:49:50 +0000', + ), + 'cache' => + array( + 'frontend' => + array( + 'default' => + array( + 'backend' => 'Cm_Cache_Backend_Redis', + 'backend_options' => + array( + 'server' => 'redis', + 'port' => '6379', + 'persistent' => '', + 'database' => '0', + 'password' => '', + 'force_standalone' => '0', + 'connect_retries' => '1', + 'read_timeout' => '10', + 'automatic_cleaning_factor' => '0', + 'compress_data' => '1', + 'compress_tags' => '1', + 'compress_threshold' => '20480', + 'compression_lib' => 'gzip', + 'use_lua' => '0', + ), + ), + 'page_cache' => + array( + 'backend' => 'Cm_Cache_Backend_Redis', + 'backend_options' => + array( + 'server' => 'redis', + 'port' => '6379', + 'persistent' => '', + 'database' => '1', + 'password' => '', + 'force_standalone' => '0', + 'connect_retries' => '1', + 'lifetimelimit' => '57600', + 'compress_data' => '0', + ), + ), + ), + ), +); diff --git a/env/magento/magento-vars.php b/env/magento/magento-vars.php new file mode 100644 index 00000000000..803950e2645 --- /dev/null +++ b/env/magento/magento-vars.php @@ -0,0 +1,14 @@ + + SSLEngine on + SSLCertificateFile /etc/apache2/ssl/ssl.crt + SSLCertificateKeyFile /etc/apache2/ssl/ssl.key + ServerAdmin webmaster@wolfsellers.com + ServerName ananda.ckt + ServerAlias www.ananda.ckt + DocumentRoot /var/www/html/ + ErrorLog /var/www/ananda.ckt/logs/ananda_error.log + LogLevel warn + CustomLog /var/www/ananda.ckt/logs/ananda_access.log combined + \ No newline at end of file diff --git a/server/proxy/vhost/default.conf.old b/server/proxy/vhost/default.conf.old new file mode 100644 index 00000000000..4559b82fb21 --- /dev/null +++ b/server/proxy/vhost/default.conf.old @@ -0,0 +1,44 @@ +server { + listen 80; + server_name localhost; + + #charset koi8-r; + #access_log /var/log/nginx/host.access.log main; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + + # proxy the PHP scripts to Apache listening on 127.0.0.1:80 + # + #location ~ \.php$ { + # proxy_pass http://127.0.0.1; + #} + + # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 + # + #location ~ \.php$ { + # root html; + # fastcgi_pass 127.0.0.1:9000; + # fastcgi_index index.php; + # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; + # include fastcgi_params; + #} + + # deny access to .htaccess files, if Apache's document root + # concurs with nginx's one + # + #location ~ /\.ht { + # deny all; + #} +} diff --git a/shell b/shell deleted file mode 100755 index 82604205286..00000000000 --- a/shell +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash -if [ -z "$1" ] - then - docker-compose exec --user www-data apache bash -else - docker-compose exec --user $@ apache bash -fi diff --git a/start b/start deleted file mode 100755 index 4028d114d6f..00000000000 --- a/start +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash -docker-compose up -d && \ -version=$(git describe --tags $(git rev-list --tags --max-count=1)) -echo " -===================== πŸš€ Done πŸš€ =================== - - Created by Rafael CorrΓͺa Gomes - v.$version - Access your new links: - - 🌎 Web server: http://localhost/ - βš™οΈ PHPMyAdmin: http://localhost:8080 - βœ‰οΈ Local emails: http://localhost:8025 - -===================== πŸš€ Done πŸš€ ===================" diff --git a/stop b/stop deleted file mode 100755 index 01b38aed708..00000000000 --- a/stop +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -docker-compose stop diff --git a/xdebug b/xdebug deleted file mode 100755 index 383716b81af..00000000000 --- a/xdebug +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -docker-compose exec --user root apache xdebug