blob: 0d4d0616891f7499335fa2f51a86829182cf663f [file] [log] [blame]
Matthias Andreas Benkardaa404642019-12-31 13:23:47 +01001# TikiWiki Docker Image
2
3TikiWiki is full featured content management system written in PHP. You can
4find more useful information at http://tiki.org
5
6## Pulling
7
8```
9docker pull tikiwiki/tikiwiki:19.x
10```
11
12## Running
13
14### Variables
15
16Some env variables are provided to setup the database, but you can also mount
17your configurations files inside container. The env vars and the default values
18are listed below and the names are self explanatory.
19
20```
21TIKI_DB_VERSION=19
22TIKI_DB_HOST='db'
23TIKI_DB_USER
24TIKI_DB_PASS
25TIKI_DB_NAME=tikiwiki
26```
27
28### Single container
29
30Example to get a running container below.
31
32```
33docker run --rm --name tiki --link mariadb:db \
34 -e TIKI_DB_USER=tiki \
35 -e TIKI_DB_PASS=wiki \
36 -p 80:80 \
37 -d tikiwiki/tikiwiki
38```
39
40### docker-compose
41
42The following creates and start two containers:
43
441. TikiWiki with por 80 published on host
452. MariaDB instance with the schema `tikiwiki`
46
47```yml
48version: '2'
49services:
50 tiki:
51 image: tikiwiki/tikiwiki:19.x
52 ports:
53 - "80:80"
54 depends_on:
55 - db
56 environment:
57 - TIKI_DB_USER=tiki
58 - TIKI_DB_PASS=wiki
59 - TIKI_DB_NAME=tikiwiki
60 db:
61 image: mariadb
62 environment:
63 - MYSQL_USER=tiki
64 - MYSQL_PASSWORD=wiki
65 - MYSQL_DATABASE=tikiwiki
66 - MYSQL_ROOT_PASSWORD=tkwkiiii
67 - TERM=dumb
68```
69
70### scalable mode with docker-compose
71
72The following recipe makes possible to grow the amount of TikiWiki
73containers, so in this way, it is possible to use more resources from
74host to handle incoming traffic.
75
76Concerning about this mode:
77
781. It it not compatible to web installer, so installing database using
79command line is needed.
802. It is needed to have a reverse proxy load balancing traffic to TikiWiki
81containers.
82
83#### docker-compose.yml
84
85This setup uses `eeacms/haproxy` container as reverse proxy and load balancer and
86declare a set of volumes. When new **tiki** containers are created, they will share
87the same set of volumes.
88
89```yml
90version: '3.7'
91
92services:
93 haproxy:
94 image: eeacms/haproxy
95 depends_on:
96 - tiki
97 ports:
98 - "80:5000"
99 environment:
100 BACKENDS: "tiki"
101 DNS_ENABLED: "true"
102 LOG_LEVEL: "info"
103 tiki:
104 image: tikiwiki/tikiwiki:19.x
105 depends_on:
106 - db
107 deploy:
108 replicas: 2
109 environment:
110 - TIKI_DB_USER=tiki
111 - TIKI_DB_PASS=wiki
112 - TIKI_DB_NAME=tikiwiki
113 volumes:
114 - tiki_files:/var/www/html/files/
115 - tiki_img_trackers:/var/www/html/img/trackers/
116 - tiki_img_wiki_up:/var/www/html/img/wiki_up/
117 - tiki_img_wiki:/var/www/html/img/wiki/
118 - tiki_modules_cache:/var/www/html/modules/cache/
119 - tiki_storage:/var/www/html/storage/
120 - tiki_temp:/var/www/html/temp/
121 - tiki_sessions:/var/www/sessions/
122 db:
123 image: mariadb
124 environment:
125 - MYSQL_USER=tiki
126 - MYSQL_PASSWORD=wiki
127 - MYSQL_DATABASE=tikiwiki
128 - MYSQL_ROOT_PASSWORD=tkwkiiii
129 - TERM=dumb
130volumes:
131 tiki_files:
132 tiki_img_trackers:
133 tiki_img_wiki_up:
134 tiki_img_wiki:
135 tiki_modules_cache:
136 tiki_storage:
137 tiki_temp:
138 tiki_sessions:
139```
140
141#### Starting containers
142
143First it is needed to copy the YML above in a folder with
144a descriptive name, like `example.com`.
145
146Then, inside the folder `example.com`, the following command
147starts all container from docker-compose.yml.
148
149```sh
150docker-compose up -d
151```
152
153After wait all containers to start and the console prompt appears
154again, the following command shows the containers running for
155docker-compose.yml on folder `example.com`.
156
157```
158docker-compose ps
159```
160
161The output should be like:
162
163```
164 Name Command State Ports
165------------------------------------------------------------------------------------
166examplecom_db_1 docker-entrypoint.sh mysqld Up 3306/tcp
167examplecom_haproxy_1 /docker-entrypoint.sh hapr ... Up 0.0.0.0:80->5000/tcp
168examplecom_tiki_1 /entrypoint.sh apache2-for ... Up 443/tcp, 80/tcp
169```
170
171There is 1 container running for each service (**db**, **haproxy**, **tiki**)
172in **example.com** folder.
173
174
175#### Installing database
176
177There is a command line installer available in tiki folder that should be used
178to install the database. **WE CAN NOT USE THE WEB INSTALLER!**. The following
179command installs Tiki database
180
181```sh
182docker-compose exec tiki php console.php database:install
183```
184
185#### Scaling containers
186
187If more Tiki container is wanted, the following command launch new containers.
188
189```sh
190docker-compose scale tiki=3
191```
192
193Now, the following containers will be listed on `docker-compose ps`:
194
195```sh
196 Name Command State Ports
197------------------------------------------------------------------------------------
198examplecom_db_1 docker-entrypoint.sh mysqld Up 3306/tcp
199examplecom_haproxy_1 /docker-entrypoint.sh hapr ... Up 0.0.0.0:80->5000/tcp
200examplecom_tiki_1 /entrypoint.sh apache2-for ... Up 443/tcp, 80/tcp
201examplecom_tiki_2 /entrypoint.sh apache2-for ... Up 443/tcp, 80/tcp
202examplecom_tiki_3 /entrypoint.sh apache2-for ... Up 443/tcp, 80/tcp
203```