No Description

bach bcae7fd04d readme 2 years ago
Docker 8eaa2a1143 first docker draft 2 years ago
ressources 8eaa2a1143 first docker draft 2 years ago
static 8eaa2a1143 first docker draft 2 years ago
.env 8eaa2a1143 first docker draft 2 years ago
.gitignore 8eaa2a1143 first docker draft 2 years ago
.gitmodules 8eaa2a1143 first docker draft 2 years ago
LICENSE.txt 8eaa2a1143 first docker draft 2 years ago
Makefile 8eaa2a1143 first docker draft 2 years ago
README.md bcae7fd04d readme 2 years ago
docker-compose.yml 8eaa2a1143 first docker draft 2 years ago

README.md

clameurs-lawebserie.fr Docker Environement

clameurs-lawebserie.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 clameurs drupal 7 source code (without sites/default folder)

git clone --recursive -o origin https://figureslibres.io/gogs/bachir/docker-clameurs

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/clameurs.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.clameurs.fr
127.0.0.1	dev.phpmyadmin.d7.clameurs.fr

apache

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

<Virtualhost *:80>
  ServerName dev.clameur.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.clameurs.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.clameurs.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.clameurs.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.clameurs.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


## Makefile

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

```makefile
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 clameurs-phpd7-1 bash

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

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

dump_d7_db:
	docker exec clameurs-mysqld7-1 sh -c 'exec mysqldump -uroot -pperfart perfart' > ./ressources/perfart_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