11# [ full stack nginx Drupal for everyone with docker compose] ( https://github.com/damalis/full-stack-nginx-drupal-for-everyone-with-docker-compose )
22
3- If You want to build a website with Drupal at short time;
3+ If You want to build a website with Drupal at short time;
44
55#### Full stack Nginx Drupal:
6- <p align="left"> <a href="https://drupal.org/" target="_blank" rel="noreferrer"> <img src="https://raw.githubusercontent.com/docker-library/docs/e405066455691ca2429eb8094777f12d2dad8f91/drupal/logo.svg?sanitize=true" alt="Drupal" height="40" width="40"/> </a> <a href="https://www.docker.com/" target="_blank" rel="noreferrer"> <img src="https://raw.githubusercontent.com/github/explore/80688e429a7d4ef2fca1e82350fe8e3517d3494d/topics/docker/docker.png" alt="docker" width="40" height="40" width="40"/> </a> <a href="https://mariadb.org/" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/5877084?s=200&v=4" alt="mariadb" height="50" width="50"/> </a> <a href="https://www.nginx.com" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/1412239?s=200&v=4" alt="nginx" height="40" width="40"/> </a> <a href="https://www.php.net" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/25158?s=200&v=4" alt="php" height="40" width="40"/> </a> <a href="https://redis.io" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/1529926?s=200&v=4" alt="redis" height="40" width="40"/> </a> <a href="https://www.varnish-software.com/" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/577014?s=200&v=4" alt="varnish" height="40" width="40"/> </a> <a href="#" target="_blank" rel="noreferrer"> <img src="https://raw.githubusercontent.com/github/explore/80688e429a7d4ef2fca1e82350fe8e3517d3494d/topics/bash/bash.png" alt="Bash" height="50" width="50" /> </a>
7- <a href =" https://www.phpmyadmin.net/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/1351977?s=200&v=4 " alt =" phpmyadmin " height =" 40 " width =" 40 " /> </a >  ;  ;  ; <a href =" https://letsencrypt.org/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/17889013?s=200&v=4 " alt =" letsencrypt " height =" 40 " width =" 40 " /> </a >  ;  ;  ; <a href =" https://www.portainer.io/?hsLang=en " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/22225832?s=200&v=4 " alt =" portainer " height =" 40 " width =" 40 " /> </a >  ;  ;  ; <a href =" https://www.offen.dev/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/47735043?s=200&v=4 " alt =" backup " height =" 35 " width =" 35 " /> </a > </p >
6+ <p align =" left " > <a href =" https://drupal.org/ " target =" _blank " rel =" noreferrer " > <img src =" https://raw.githubusercontent.com/docker-library/docs/e405066455691ca2429eb8094777f12d2dad8f91/drupal/logo.svg?sanitize=true " alt =" Drupal " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
7+ <a href =" https://docs.docker.com/compose/ " target =" _blank " rel =" noreferrer " > <img src =" https://raw.githubusercontent.com/docker/compose/v2/logo.png " alt =" docker compose " width =" 40 " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
8+ <a href =" https://mariadb.org/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/5877084?s=200&v=4 " alt =" mariadb " height =" 50 " width =" 50 " /> </a >  ;  ;  ;
9+ <a href =" https://dev.mysql.com/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/2452804?s=200&v=4 " alt =" mysql " height =" 50 " width =" 50 " /> </a >  ;  ;  ;
10+ <a href =" https://www.nginx.com " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/1412239?s=200&v=4 " alt =" nginx " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
11+ <a href =" https://www.php.net " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/25158?s=200&v=4 " alt =" php " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
12+ <a href =" https://redis.io " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/1529926?s=200&v=4 " alt =" redis " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
13+ <a href =" https://www.varnish-software.com/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/577014?s=200&v=4 " alt =" varnish " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
14+ <a href =" # " target =" _blank " rel =" noreferrer " > <img src =" https://raw.githubusercontent.com/github/explore/80688e429a7d4ef2fca1e82350fe8e3517d3494d/topics/bash/bash.png " alt =" Bash " height =" 50 " width =" 50 " /> </a >  ;  ;  ;
15+ <a href =" https://www.phpmyadmin.net/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/1351977?s=200&v=4 " alt =" phpmyadmin " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
16+ <a href =" https://certbot.eff.org/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/17889013?s=200&v=4 " alt =" certbot " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
17+ <a href =" https://letsencrypt.org/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/9289019?s=200&v=4 " alt =" letsencrypt " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
18+ <a href =" https://www.portainer.io/?hsLang=en " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/22225832?s=200&v=4 " alt =" portainer " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
19+ <a href =" https://www.offen.dev/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/47735043?s=200&v=4 " alt =" backup " height =" 35 " width =" 35 " /> </a > </p >
820
921Plus, manage docker containers with Portainer.
1022
23+ #### Supported CPU architectures:
24+ <p align =" left " > arm64/aarch64, x86-64 </p >
25+
26+ #### Supported Linux Package Manage Systems:
27+ <p align =" left " > apk, dnf, yum, apt/apt-get, zypper </p >
28+
29+ #### Supported Linux Operation Systems:
30+ <p align =" left " > <a href =" https://alpinelinux.org/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/7600810?s=200&v=4 " alt =" alpine linux " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
31+ <a href =" https://fedoraproject.org/ " target =" _blank " rel =" noreferrer " > <img src =" https://raw.githubusercontent.com/github/explore/e6b1e7f0fb8d0bf920bd719c7289243138bdc1b4/topics/fedora/fedora.png " alt =" fedora " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
32+ <a href =" https://www.centos.org/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/79192?s=200&v=4 " alt =" centos " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
33+ <a href =" https://www.debian.org/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/1854028?s=200&v=4 " alt =" debian " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
34+ <a href =" https://ubuntu.com/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/4604537?s=200&v=4 " alt =" ubuntu " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
35+ <a href =" https://www.raspberrypi.com/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/1294177?s=200&v=4 " alt =" ubuntu " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
36+ <a href =" https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/33972111?s=200&v=4 " alt =" redhat on s390x (IBM Z) " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
37+ <a href =" https://www.suse.com/products/server/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/623819?s=200&v=4 " alt =" opensuse on s390x (IBM Z) " height =" 40 " width =" 40 " /> </a > </p >
38+
39+ ##### Note: Fedora 37, 39 and alpine linux x86-64 compatible, could not try sles IBM Z s390x, rhel IBM Z s390x and raspberrypi.
40+
1141#### With this project you can quickly run the following:
1242
13- - [ Drupal] ( https://hub.docker.com/_/drupal ) - [ php-fpm] ( https://hub.docker.com/_/php?tab=tags&page=1&name=fpm )
43+ - [ Drupal] ( https://hub.docker.com/_/drupal ) - [ php-fpm] ( https://hub.docker.com/_/php )
1444- [ webserver (nginx)] ( https://hub.docker.com/_/nginx )
1545- [ certbot (letsencrypt)] ( https://hub.docker.com/r/certbot/certbot )
1646- [ phpMyAdmin] ( https://hub.docker.com/r/phpmyadmin/phpmyadmin/ )
17- - [ database ] ( https://hub.docker.com/_/mariadb )
47+ - [ databaseMariadb ] ( https://hub.docker.com/_/mariadb ) [ databaseMysql ] ( https://hub.docker.com/_/mysql )
1848- [ redis] ( https://hub.docker.com/_/redis )
1949- [ varnish] ( https://hub.docker.com/_/varnish )
2050- [ backup] ( https://hub.docker.com/r/offen/docker-volume-backup )
@@ -44,7 +74,7 @@ Create rules to open ports to the internet, or to a specific IPv4 address or ran
4474 - [Redis](#redis)
4575 - [Varnish](#varnish)
4676 - [phpMyAdmin](#phpmyadmin)
47- - [backup](#backup)
77+ - [backup](#backup)
4878
4979## Automatic
5080
@@ -71,7 +101,7 @@ Make sure you have the latest versions of **Docker** and **Docker Compose** inst
71101- [ How install docker] ( https://docs.docker.com/engine/install/ )
72102- [ How install docker compose] ( https://docs.docker.com/compose/install/ )
73103
74- Clone this repository or copy the files from this repository into a new folder. In the ** docker-compose.yml ** file you may change the database from MariaDB to MySQL.
104+ Clone this repository or copy the files from this repository into a new folder.
75105
76106Make sure to [ add your user to the ` docker ` group] ( https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user ) .
77107
@@ -80,6 +110,7 @@ Make sure to [add your user to the `docker` group](https://docs.docker.com/insta
80110### Configuration
81111
82112download with
113+
83114```
84115git clone https://github.com/damalis/full-stack-nginx-drupal-for-everyone-with-docker-compose.git
85116```
@@ -96,26 +127,36 @@ Copy the example environment into `.env`
96127cp env.example .env
97128```
98129
99- Edit the ` .env ` file to change values of ``` LOCAL_TIMEZONE ``` , ``` DOMAIN_NAME ``` , ``` DIRECTORY_PATH ``` , ``` LETSENCRYPT_EMAIL ``` , ``` DB_USER ``` , ``` DB_PASSWORD ``` , ``` DB_NAME ``` , ``` MYSQL_ROOT_PASSWORD ``` , ``` PMA_CONTROLUSER ``` , ``` PMA_CONTROLPASS ``` , ``` PMA_HTPASSWD_USERNAME ``` and ``` PMA_HTPASSWD_PASSWORD ``` .
130+ Edit the ` .env ` file to change values of ``` LOCAL_TIMEZONE ``` , ``` DOMAIN_NAME ``` , ``` DIRECTORY_PATH ``` , ``` LETSENCRYPT_EMAIL ``` , ``` DB_USER ``` , ``` DB_PASSWORD ``` , ``` DB_NAME ``` , ``` MYSQL_ROOT_PASSWORD ``` , ``` DATABASE_IMAGE_NAME ``` , ``` DATABASE_CONT_NAME ``` , ``` DATABASE_PACKAGE_MANAGER ``` , ``` DATABASE_AUTHENTICATION_PLUGIN ``` , ``` DATABASE_ADMIN_COMMANDLINE ``` , ``` PMA_CONTROLUSER ``` , ``` PMA_CONTROLPASS ``` , ``` PMA_HTPASSWD_USERNAME ``` , ``` PMA_HTPASSWD_PASSWORD ``` and ``` VARNISH_VERSION ``` .
100131
101132LOCAL_TIMEZONE=[ to see local timezones] ( https://docs.diladele.com/docker/timezones.html )
102133
103- DIRECTORY_PATH=``` pwd ``` at command line
134+ DIRECTORY_PATH=``` pwd ``` at command line\
135+ DATABASE_IMAGE_NAME=``` mariadb ``` or ``` mysql ``` \
136+ DATABASE_CONT_NAME=``` mariadb ``` , ``` mysql ``` or ``` custom name ``` \
137+ DATABASE_PACKAGE_MANAGER=``` apt-get update && apt-get install -y gettext-base ``` for mariadb, ``` microdnf install -y gettext ``` for mysql\
138+ DATABASE_AUTHENTICATION_PLUGIN=``` mysql_native_password ``` for mariadb, ``` caching_sha2_password ``` for mysql\
139+ DATABASE_ADMIN_COMMANDLINE=``` mariadb-admin ``` for mariadb, ``` mysqladmin ``` for mysql\
140+ VARNISH_VERSION=``` latest ``` for centos version 9+ and fedora, ``` stable ``` for the others
104141
105142and
106143
107144```
108145cp ./phpmyadmin/apache2/sites-available/default-ssl.sample.conf ./phpmyadmin/apache2/sites-available/default-ssl.conf
109146```
110-
111147change example.com to your domain name in ``` ./phpmyadmin/apache2/sites-available/default-ssl.conf ``` file.
112148
149+ ```
150+ cp ./database/phpmyadmin/sql/create_tables.sql.template.example ./database/phpmyadmin/sql/create_tables.sql.template
151+ ```
152+ change pma_controluser, db_authentication_plugin and db_authentication_password in ``` ./database/phpmyadmin/sql/create_tables.sql.template ``` file.
153+
113154### Installation
114155
115156Firstly: will create external volume
116157
117158```
118- docker volume create --driver local --opt type=none --opt device=${DIRECTORY_PATH }/certbot --opt o=bind certbot-etc
159+ docker volume create --driver local --opt type=none --opt device=${PWD }/certbot --opt o=bind certbot-etc
119160```
120161
121162```
@@ -137,6 +178,7 @@ For convenience you may add a new entry into your hosts file.
137178```
138179docker compose -f portainer-docker-compose.yml -p portainer up -d
139180```
181+
140182manage docker with [ Portainer] ( https://www.portainer.io/ ) is the definitive container management tool for Docker, Docker Swarm with it's highly intuitive GUI and API.
141183
142184You can also visit ` https://example.com:9001 ` to access portainer after starting the containers.
@@ -175,7 +217,8 @@ To stop and remove all the containers use the `down` command:
175217docker compose down
176218```
177219
178- to remove portainer and the other containers
220+ to remove portainer and the other containers:
221+
179222```
180223docker rm -f $(docker ps -a -q)
181224```
@@ -186,13 +229,26 @@ Use `-v` if you need to remove the database volume which is used to persist the
186229docker compose down -v
187230```
188231
189- to remove external certbot-etc and portainer and the other volumes
232+ to remove external certbot-etc and portainer and the other volumes:
190233
191234```
192235docker volume rm $(docker volume ls -q)
193236```
194237
195- to remove portainer and the other images
238+ Delete all images, containers, volumes, and networks that are not associated with a container (dangling):
239+
240+ ```
241+ docker system prune
242+ ```
243+
244+ To additionally remove any stopped containers and all unused images (not just dangling ones), add the -a flag to the command:
245+
246+ ```
247+ docker system prune -a
248+ ```
249+
250+ to remove portainer and the other images:
251+
196252```
197253docker rmi $(docker image ls -q)
198254```
@@ -219,6 +275,8 @@ You should see the "Drupal installation" page in your browser. If not, please ch
219275https://example.com
220276```
221277
278+ if you should see the "The website encountered an unexpected error. Please try again later." in your browser, run ``` drush cache:rebuild ``` in drupal container.
279+
222280add or remove code in the ./php-fpm/php/conf.d/security.ini file for custom php.ini configurations
223281
224282[ https://www.php.net/manual/en/configuration.file.php ] ( https://www.php.net/manual/en/configuration.file.php )
@@ -246,19 +304,63 @@ ADVANCED OPTIONS -> Host: database
246304
247305[ https://mariadb.com/kb/en/configuring-mariadb-with-option-files/ ] ( https://mariadb.com/kb/en/configuring-mariadb-with-option-files/ )
248306
307+ [ https://dev.mysql.com/doc/refman/8.3/en/ ] ( https://dev.mysql.com/doc/refman/8.3/en/ )
308+
249309#### Redis
250310
251- if there isn't these lines, Edit Drupal settings file: ./drupal/sites/default/settings.php and add these lines at the bottom of the file:
311+ at page https://example.com/admin/modules , filter: redis and check then install.
312+
313+ if there isn't these lines, Edit Drupal settings file: ``` ./drupal/sites/default/settings.php ``` and add these lines at the bottom of the file:
252314
253315```
316+ $settings['redis.connection']['interface'] = 'PhpRedis';
317+ // Host ip address.
254318$settings['redis.connection']['host'] = 'redis';
255- $settings['redis.connection']['port'] = 6379;
319+
256320$settings['cache']['default'] = 'cache.backend.redis';
257- $settings['redis.connection']['base'] = 8;
321+ // Redis port.
322+ $settings['redis.connection']['port'] = '6379';
323+ $settings['redis.connection']['base'] = 12;
324+ // Password of redis updated in php.ini file.
325+ // $settings['redis.connection']['password'] = "password";
326+ $settings['cache']['bins']['bootstrap'] = 'cache.backend.chainedfast';
327+ $settings['cache']['bins']['discovery'] = 'cache.backend.chainedfast';
328+ $settings['cache']['bins']['config'] = 'cache.backend.chainedfast';
329+ ```
330+
331+ Create ``` ./drupal/sites/default/files/services.yml ``` inisde default folder and add the below code in it.
332+
333+ ```
334+ services:
335+ # Cache tag checksum backend. Used by redis and most other cache backend
336+ # to deal with cache tag invalidations.
337+ cache_tags.invalidator.checksum:
338+ class: Drupal\redis\Cache\RedisCacheTagsChecksum
339+ arguments: ['@redis.factory']
340+ tags:
341+ - { name: cache_tags_invalidator }
342+
343+ # Replaces the default lock backend with a redis implementation.
344+ lock:
345+ class: Drupal\Core\Lock\LockBackendInterface
346+ factory: ['@redis.lock.factory', get]
347+
348+ # Replaces the default persistent lock backend with a redis implementation.
349+ lock.persistent:
350+ class: Drupal\Core\Lock\LockBackendInterface
351+ factory: ['@redis.lock.factory', get]
352+ arguments: [true]
353+
354+ # Replaces the default flood backend with a redis implementation.
355+ flood:
356+ class: Drupal\Core\Flood\FloodInterface
357+ factory: ['@redis.flood.factory', get]
258358```
259359
260360#### Varnish
261361
362+ at page https://example.com/admin/modules , filter: purge and check then install.
363+
262364Varnish Server Hostname: varnish
263365
264366Varnish Server Port: 8080
0 commit comments