No Description

bach e6d42ad7b5 it's working 1 year ago
Docker e6d42ad7b5 it's working 1 year ago
d7 @ 868629cbb2 e6d42ad7b5 it's working 1 year ago
ressources 1a2f48f1a3 first docker draft 2 years ago
static 1a2f48f1a3 first docker draft 2 years ago
.env 1a2f48f1a3 first docker draft 2 years ago
.gitignore 1a2f48f1a3 first docker draft 2 years ago
.gitmodules e6d42ad7b5 it's working 1 year ago
LICENSE.txt 1a2f48f1a3 first docker draft 2 years ago
Makefile 1e42babd80 readme 2 years ago
README.md e6d42ad7b5 it's working 1 year ago
docker-compose.yml e6d42ad7b5 it's working 1 year ago

README.md

jeunesetengages.fr Docker Environement

jeunesetengages.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 origin https://figureslibres.io/gogs/bachir/docker-jeunesetengages.git

setup /sites/default/settings.php

cp -r ressources/default d7/sites/

get the sites/default/files folder

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

Mysql

Copy your-sql-dump.sql into ./ressources/jeunesetengages.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.jeunesetengages.fr
127.0.0.1	dev.phpmyadmin.d7.jeunesetengages.fr

apache

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

<Virtualhost *:80>
  ServerName dev.esadhar.fr
  ProxyPass / http://127.0.0.1:9880/
  ProxyPassReverse / http://127.0.0.1:9880/
  ProxyRequests Off
  ProxyPreserveHost On
  proxy_buffer_size          128k;
  proxy_buffers              4 256k;
  proxy_busy_buffers_size    256k;
</Virtualhost>
<Virtualhost *:80>
   ServerName dev.phpmyadmin.jeunesetengages.fr
   ProxyPass / http://127.0.0.1:9881/
   ProxyPassReverse / http://127.0.0.1:9881/
   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.jeunesetengages.fr;

  location / {
    proxy_pass http://127.0.0.1:9880;
    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.jeunesetengages.fr;
 
  location / {
    proxy_pass http://127.0.0.1:9881;
    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.jeunesetengages.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)

buildncnginx:
		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) nginx

buildncnginx_static:
		docker-compose -f docker-compose-static.yml 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) nginx_static

up:
		docker-compose up -d

up_static:
		docker-compose -f docker-compose-static.yml up -d

down_static:
		docker-compose -f docker-compose-static.yml down


restart_nginx:
		docker-compose restart nginx

restart_nginx_static:
		docker-compose -f docker-compose-static.yml restart nginx_static

# upbuild:
# 		docker-compose up -d --build

ps:
		docker-compose ps

logs:
		docker-compose logs -f

down:
		docker-compose down

exec_phpd7:
		docker exec -it jeunesetengages-phpd7-1 bash

exec_mysqld7:
		docker exec -it jeunesetengages-mysqld7-1 bash

exec_nginx:
		docker exec -it jeunesetengages-nginx-1 bash
exec_npm:
		docker exec -it jeunesetengages-npm-1 sh

dump_d7_db:
	docker exec jeunesetengages-mysqld7-1 sh -c 'exec mysqldump -uroot -pjeunesetengages jeunesetengages' > ./ressources/jeunesetengages_d7-$(DATE_NOW)-local.sql
    

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