203Drupal - amagerard/Docker GitHub Wiki
Docker/Home
Ubuntu/Casaos.
1-Casaos | 2- Portainer | 3- Drupal | 4- Joomla | 5-Wordpress |
---|---|---|---|---|
6-Xwiki | 7- Mediawiki | 8- Httpd | ||
Docker | Zimaos |
3. Drupal.
Drupal is a Content Management System.
It is possible to create, manage and easily modify a website.
This procedure is based on this example.
Ubuntu ip : 192.168.60.8/24
Casaos version: v0.4.15
Your username: teacher
Your home directory:/home/teacher
3.1 Create Network and Volumes with Portainer.
Open Portainer for create network and volumes.
http://192.168.60.8:9000
Click on Environments Local.
3.1.1 Each Drupal instance has its container.
- cnt_dpl_wb_number.
- cnt_dpl_db_number.
Containers will be created from Casaos graphical interface.
3.1.2 Each Drupal instance has its network.
- net_dpl_number.
Createnet_dpl_1
.
Select Networks.
Add network.
Name : net_dpl_1
Add Driver options:
Name : com.docker.network.bridge.name value : net_dpl_1
Create the network.
Name: com.docker.network.bridge.name value : net_dpl_1
is not specified, docker will give it a name as br-XXXX
.
3.1.3 Each Drupal instance has its volume.
- vol_dpl_wb_number
- vol_dpl_db_number
Create these volumes.
Select Volumes.
Add volume.
Name: vol_dpl_wb_1
Create the volume.
Add the volume.
Name: vol_dpl_db_1
Create the volume.
3.2 Install Drupal with a yaml script.
Copy this script in notepad, kate, gedit or another text editor
and save with a name that has a yaml extension.
# 2025, January
# replace number by 1 or 2 or ... until 9
# example n = 1
# port published wb = 8081
# port published db = 33771
# ip = 192.168.60.8
# you must create network net_dpl_1 from portainer before installing drupal.
# you must create volume vol_dpl_wb_1 from portainer before installing drupal.
# you must create volume vol_dpl_db_1 from portainer before installing drupal.
#
# Be careful with the tab, the indentation is 4 characters.
#
name: drupal_1 ## change n of drupal_n
services:
drupal:
cpu_shares: 90
command: []
container_name: cnt_dpl_wb_1 ## change n of cnt_dpl_wb_n
depends_on:
drupaldb:
condition: service_started
restart: true
required: true
deploy:
resources:
limits:
memory: 2048M
environment:
- DRUPAL_DB_HOST=cnt_dpl_db_1 ## change n of cnt_dpl_db_n
- DRUPAL_DB_PASSWORD=password ## Change password if you want
hostname: cnt_dpl_wb_1 ## change n of cnt_dpl_wb_n
image: drupal:latest
links:
- drupaldb:mariadb
ports:
- target: 80
published: '8081' ## change n of published : 808n
protocol: tcp
restart: always
volumes:
- /var/lib/docker/volumes/vol_dpl_wb_1/_data:/var/www/html # create volume from portainer and change n of vol_dpl_wb_n
devices: []
cap_add: []
network_mode: net_dpl_1 # create with portainer, change n of net_dpl_n
privileged: false
drupaldb:
cpu_shares: 90
command: []
container_name: cnt_dpl_db_1 ## change n of cnt_dpl_db_n
deploy:
resources:
limits:
memory: 2048M
environment:
- MYSQL_ROOT_PASSWORD=password # it is the same password DRUPAL_DB_PASSWORD
hostname: cnt_dpl_db_1 ## change n of cnt_dpl_db_n
image: mariadb:latest
ports:
- target: 3306
published: '33771' ## change n of 3377n
protocol: tcp
restart: always
volumes:
- /var/lib/docker/volumes/vol_dpl_db_1/_data:/var/lib/mysql ## create volume from portainer and change n of vol_dpl_db_n
devices: []
cap_add: []
network_mode: net_dpl_1 # create network from portainer and change n of net_dpl_n
privileged: false
x-casaos:
author: self
category: self
hostname: 192.168.60.8 ## change IP
icon: https://www.drupal.org/files/EL_blue_RGB%281%29.png # check if existe
index: /
is_uncontrolled: false
port_map: '8081' ## change n of 808n
scheme: http
store_app_id: drupal_1 ## change n of drupal_n
title:
custom: drupal_1 ## change n of drupal_n
Open casaos .
http://192.168.60.8
.
Click on the "+" which is located in the middle right of the browser web page.
Install a customized app.
Click on right top who name "import".
Import.
Click on Drag your Docker Compose here or click to upload
.
Search your script yaml.
Submit.
OK and OK.
Install.
Information.
If you want to change your drupal instance in 2
,
edit this file and replace _1
by _2
.
Then replace the port 8081
by 8082
and 33771
by 33772
.
3.3 Attach volumes with containers.
On portainer, by default the volumes are marked Unused.
This is a problem for Drupal.
Open Portainer.
http://192.168.60.8:9000
Click on Environments Local.
Select Container cnt_dpl_wb_1
.
Stop cnt_dpl_wb_1
.
Click on cnt_dpl_wb_1
.
Click on Duplicate/Edit
.
Advanced container settings
.
Click on Volumes
.
Volumes mapping.
Choose container /var/www/html
.
Click on Volume.
Select a Volume.
Choose vol_dpl_wb_1 - local
.
Click on Deploy the container
.
Click on Replace
.
Select Container cnt_dpl_db_1
.
Stop cnt_dpl_db_1
.
Click on cnt_dpl_db_1
.
Click on Duplicate/Edit
.
Advanced container settings
.
Click on Volumes
.
Volumes mapping.
Choose container /val/lib/mysql
.
Click on Volume.
Select a Volume.
Choose vol_dpl_db_1 - local
.
Click on Deploy the container
.
Click on Replace
.
3.4 First access Drupal.
http://192.168.60.8:8081
Select language : English
Save and continue.
Standard.
Save and continue.
Database type : MySQL,MariadB
Database name : cnt_dpl_db_1
Database username : root
Database password: password
Advanced options.
Host: 172.18.0.1
The ip host is the network net_dpl_1 gateway.
The gateway is displayed in Portainer Networks.
Port number: 33771
Save and continue.
Site name: mybeautifulweb
site email addres: as you want
username: as you want
password: as you want
Confirm password: as you want
Save and continue.
Drupal is ready.