No Description

Bachir Soussi Chiadmi 7c500f5113 updated readme 7 months ago
Docker 656045c122 docker is working for d7 7 months ago
public_html_d7 @ 6df6e927cb 656045c122 docker is working for d7 7 months ago
ressources 8af44c29c5 added default settings 7 months ago
.env 656045c122 docker is working for d7 7 months ago
.gitignore 656045c122 docker is working for d7 7 months ago
.gitmodules 656045c122 docker is working for d7 7 months ago
LICENSE.txt 656045c122 docker is working for d7 7 months ago
Makefile 656045c122 docker is working for d7 7 months ago
README.md 7c500f5113 updated readme 7 months ago
docker-compose.yml 656045c122 docker is working for d7 7 months ago

README.md

esadhar.fr Docker Environement

esadhar.fr powered by druapl 7 in docker environement (nginx, php:7-fpm+drush, phpmyadmin, redis)

Install docker

sudo pacman -S docker docker-compose docker-machine

Clone this repos

this will clone this repos (main docker environement) and the edlp drupal 8 source code (without sites/default folder)

git clone --recursive -o esadhar.net https://esadhar.net/gogs/bachir/docker-esadhar-fr.git

setup /sites/default/settings.php

cp -r ressources/default public_html_d7/sites/

get the sites/default/files folder

get the files from where you have it and rsync it to public_html_d7/sites/default/files/

Mysql

Copy your-sql-dump.sql into ./ressources/esadhar_d7.sql It will be automaticly imported into the mysql container db (only) on the first make up

Hosts and reverse proxy

add to your /etc/hosts :

127.0.0.1	dev.d7.esadhar.fr
127.0.0.1	dev.phpmyadmin.d7.esadhar.fr

apache

configure your apache vhosts to add a reverse proxy that will redirect the dev.d7.esadhar.fr to our container

<Virtualhost *:80>
  ServerName dev.esadhar.fr
  ProxyPass / http://127.0.0.1:8880/
  ProxyPassReverse / http://127.0.0.1:8880/
  ProxyRequests Off
  ProxyPreserveHost On
  proxy_buffer_size          128k;
  proxy_buffers              4 256k;
  proxy_busy_buffers_size    256k;
</Virtualhost>
<Virtualhost *:80>
   ServerName dev.phpmyadmin.esadhar.fr
   ProxyPass / http://127.0.0.1:8881/
   ProxyPassReverse / http://127.0.0.1:8881/
   ProxyRequests Off
   ProxyPreserveHost On
   proxy_buffer_size          128k;
   proxy_buffers              4 256k;
   proxy_busy_buffers_size    256k;
</Virtualhost>

nginx

server {
  listen 80;
  server_name dev.d7.esadhar.fr;

  location / {
    proxy_pass http://127.0.0.1:8880;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_buffer_size          128k;
    proxy_buffers              4 256k;
    proxy_busy_buffers_size    256k;
  }
}
server {
  listen 80;
  server_name dev.phpmyadmin.d7.esadhar.fr;
 
  location / {
    proxy_pass http://127.0.0.1:8881;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_buffer_size          128k;
    proxy_buffers              4 256k;
    proxy_busy_buffers_size    256k;
  }
}

Docker

build

only before the first run (may take some time)

make build

run

then each time you want to launch the app

make up

Be aware that a first up, since the db is empty, it will be populated with your file db.sql. It may take some time depending of your db size.

Visualize

You can now visit http://dev.d7.esadhar.fr on your browser

Coding

drush

you can access to drush by loging into the php container

make exec_phpd7

once inside the php container you can use drush as usual

gulp

Dev process needs gulp to run in:

  • public_html/sites/all/modules/custom/materio/
  • public_html/sites/all/themes/custom/materio/ if you have to modifie js or scss source code, you need to do in each of these 2 folder: sh npm install gulp

Makefile

do not use directly docker or docker-compose to run this instance use make instead like make up

build:
		docker-compose build --build-arg USER_UID=$(USER_UID) --build-arg USER_UNAME=$(USER_UNAME) --build-arg USER_GID=$(USER_GID) --build-arg USER_GNAME=$(USER_GNAME)

buildnc:
		docker-compose build --no-cache --build-arg USER_UID=$(USER_UID) --build-arg USER_UNAME=$(USER_UNAME) --build-arg USER_GID=$(USER_GID) --build-arg USER_GNAME=$(USER_GNAME)

up:
		docker-compose up -d

upbuild:
		docker-compose up -d --build

ps:
		docker-compose ps

logs:
		docker-compose logs -f

down:
		docker-compose down

exec_phpd7:
		docker exec -it esadharfr_phpd7_1 bash

exec_mysqld7:
		docker exec -it esadharfr_mysqld7_1 bash
    

sources

https://www.ostraining.com/blog/drupal/docker/

http://tech.osteel.me/posts/2017/01/15/how-to-use-docker-for-local-web-development-an-update.html

https://mmenozzi.github.io/2016/01/22/php-web-development-with-docker/

https://dzone.com/articles/continuous-drupal-maintaining-a-drupal-website-wit//

https://github.com/glaux/drupal8docker

https://www.jeffgeerling.com/blogs/jeff-geerling/drupal-8-redis-php-7-nginx-and

https://chromatichq.com/blog/configuring-redis-caching-drupal-8