- Table of Contents
- Used technologies:
- Docker Installation
- Running unit tests
- Running Drush, Composer
- Running Drupal Console
- Gulp
- Backups
- PHP
- Drupal 8
- Drupal Commerce 2.x
- Docker
- Solr
- ES6
- Babel
- Gulp
- SASS
- ESlint
- Clone repo
git clone [email protected]:lionheart1022/Ecommerce-drupal.git
- Go to the project root folder, copy environment-specific YAML file to
docker-compose.override.yml
and rundocker-compose up
cd diamondcbd_commerce && cp docker-compose.override.local.yml docker-compose.override.yml && docker-compose up -d --build
- 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
- Run
composer install
:
docker-compose exec php composer install
- 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:
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
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.
Execute a shell:
docker-compose exec php sh
Run via ../vendor/bin/drupal
../vendor/bin/drupal
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-compose logs -f gulp
- watch gulp service log.docker-compose restart gulp
- restart gulp service.docker-compose exec gulp recompile
- recompile all themes.
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.
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);
}
};
There is a backups
container in Docker running only in Live environment which backups data to S3 periodically.
Simply run:
docker-compose exec backups flock -w 10 /tmp/backup.lock -c /opt/bin/make_backup
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