Giter VIP home page Giter VIP logo

ecommerce-drupal's Introduction

Table of Contents

Used technologies:

  • PHP
  • Drupal 8
  • Drupal Commerce 2.x
  • Docker
  • Solr
  • ES6
  • Babel
  • Gulp
  • SASS
  • ESlint

Docker Installation

  1. Clone repo
git clone [email protected]:lionheart1022/Ecommerce-drupal.git
  1. Go to the project root folder, copy environment-specific YAML file to docker-compose.override.yml and run docker-compose up
cd diamondcbd_commerce && cp docker-compose.override.local.yml docker-compose.override.yml && docker-compose up -d --build
  1. Solr core is not created automatically. To do so and reindex, run:
docker-compose exec solr make core=diamond_commerce -f /usr/local/bin/actions.mk
docker-compose exec php drush sapi-c
docker-compose exec php drush sapi-i
  1. Run composer install:
docker-compose exec php composer install
  1. Adjust your traefik.yml file. You will most like end up with something like this:
version: '2'

services:
  traefik:
    image: traefik
    restart: unless-stopped
    command: -c /dev/null --web --docker --logLevel=DEBUG
    networks:
      - diamondcbdcommerce
    ports:
      - '80:80'
      - '8080:8080'
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

networks:
  diamondcbdcommerce:
    external:
      name: diamondcbdcommerce_default

Then, restart traefik container.

More info may be found at Docker4Drupal docs.

The website will be available at the following URLs:

Running unit tests

Execute a shell:

docker-compose exec php sh

cd to the root dir of the code (that's important!) and run PHPUnit:

cd ..
./vendor/bin/phpunit  web/modules/custom

Running Drush, Composer

Just make sure to run your commands in the php container, like this:

docker-compose exec php composer install
docker-compose exec php drush updb

You don't have to install or run anything locally.

Running Drupal Console

Execute a shell:

docker-compose exec php sh

Run via ../vendor/bin/drupal

../vendor/bin/drupal

Gulp

By default, the gulp watcher started in mbio theme. To change the theme, you need to change ENV variable in gulp service, inside docker-compose.yml file GULP_THEME: cpl_base -> GULP_THEME: [theme] and run

docker-compose up -d --build

For get gulp log you could run

docker-compose -f gulp

and for reload gulp service if you needed

docker-compose restart gulp

Docker commands

  • docker-compose logs -f gulp - watch gulp service log.
  • docker-compose restart gulp - restart gulp service.
  • docker-compose exec gulp recompile - recompile all themes.

Gulp tasks

  • gulp test - task for check is gulp working.
  • gulp compile - task for compile styles and scripts.
  • gulp compile:styles - task for compile styles.
  • gulp compile:scripts - task for compile scripts.
  • gulp assets:fonts - task for create font from svg icons.
  • gulp scripts:lint - task for lint js files.
  • gulp watch - for start watching project directory to scripts or styles changes.
  • gulp serve - for start project and browsersync.

Gulp automatically handle new/removed files, and you don't need to restart watch task manually.

Files structure

JS

For build JS files you need to create (if folder not exist) behavior folder inside theme js, folder, and place your files there. You don't need to make one file with many behaviors, separate your behaviors to files, and gulp automatically build one file with all files scripts.

For example file with name test.js

console.log('Hello World!', context);

will be compile to

Drupal.behaviors[{themeName}Test] = { 
    attach: function attach(context, settings) { 
        console.log('Hello World!', context);
    }
};

Backups

There is a backups container in Docker running only in Live environment which backups data to S3 periodically.

Running manual backup

Simply run:

docker-compose exec backups flock -w 10 /tmp/backup.lock -c /opt/bin/make_backup

Dumping database

You may want to dump your database at some point. To do so, run:

docker-compose exec php sh
../vendor/bin/drush sql-dump --structure-tables-list=cache,cache_*,watchdog |gzip > /tmp/dump.sql.gz
exit
docker cp `docker-compose ps -q php`:/tmp/dump.sql.gz /tmp/dump.sql.gz

ecommerce-drupal's People

Contributors

lionheart1022 avatar

Watchers

 avatar

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.