You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+32-25Lines changed: 32 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
# Inception
2
2
This project from 42 school aims to broaden your knowledge of system administration by using Docker. IIn this tutorial You will virtualize several Docker images, creating them in your new personal virtual machine. In this read.me you will have an inception tutorial to know how the project works.
3
3
4
-
## Important things about the project
4
+
## Important things to read before beginning the project
5
5
6
6
1.**Don't try to do all the containers** (Nginx, wordpress and mariaDB) at the same time.
7
7
You will be lost and you will not understand properly how it works. Do it step by step.
@@ -19,6 +19,8 @@ You will be lost and you will not understand properly how it works. Do it step b
19
19
You want to try if each container works in general? No worries, you will be able to do it by importing images for wordpress and mariaDB from the hub. (if you read this for the first time, I invite you to begin to read this beautiful READ.ME and put a star on it! It helps!)
20
20
21
21
- The 2 github which helped me a lot for the project : [llescure](https://github.com/llescure/42_Inception) and [malatini](https://github.com/42cursus/inception)
22
+
- This github which helped me for the bonus[twagger](https://github.com/twagger/inception)
23
+
22
24
If you have questions: please contact me, I will be glad to give you an answer ! my discord username: vbachele#7949
23
25
24
26
# SUMMARY
@@ -36,6 +38,8 @@ Docker is an open platform for developing, shipping, and running applications. D
36
38
Docker provides the ability to package and run an application in a loosely isolated environment called a container.
37
39
38
40
## What is a docker-compose ?
41
+
[What is docker in general](https://www.educative.io/blog/docker-compose-tutorial)
42
+
[What is docker network](https://www.aquasec.com/cloud-native-academy/docker-container/docker-networking/)
39
43
Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration.
40
44
41
45
## What is a docker-file ?
@@ -120,6 +124,7 @@ Nginx conf documents will be used to config our server and the right proxy conne
-[PID 1 signal handling && nginx](https://cloud.google.com/architecture/best-practices-for-building-containers#signal-handling)
127
+
-[What is TLS(in french)](https://fr.wikipedia.org/wiki/Transport_Layer_Security)
123
128
124
129
### Listen && Location
125
130
- Listen will indicate to the server which request it has to accept:
@@ -177,21 +182,21 @@ All the information about what every line means are in this [tutorial](https://o
177
182
*definitions*
178
183
*wp-config.php* This file tells to your database how to get your files and how to treat them
179
184
## What are the steps to create your Wordpress
180
-
1. Create you dockerfile image
185
+
1.**Create you dockerfile image**
181
186
- Download php-fpm
182
187
- Copy the www.conf file in php/7.3/fpm/pool.d/
183
188
- Create the php directory to enable php-fpm to run
184
189
- Copy the script and launch it
185
190
- Go to the html directory
186
191
- Launch php-fpm
187
192
188
-
2. Create a script
193
+
2.**Create a script**
189
194
- Download wordpress
190
195
- Create the configuration file of wordpress
191
196
- Move files from wordpress in the html directory
192
197
- Give the 4th environmental variables for wordpress
193
198
194
-
3. Create a www.conf
199
+
3.**Create a www.conf**
195
200
You need to edit www.conf and place it in /etc/php/7.3(the usual version of php on 42 vm)/fpm/pool.d and wp-content.php to disable access to the wordpress installation page when you access your site at https://login.42.fr
196
201
- Put listen = 0.0.0.0:9000 to listen to all ports
197
202
- Increase the number for the pm values in order to avoid a 502 page
@@ -217,19 +222,19 @@ mysql -uroot -p$MYSQL_ROOT_PASSWORD $MYSQL_DATABASE < /usr/local/bin/wordpress.s
217
222
```
218
223
219
224
## What are the steps to create your own Maria DB image
220
-
1. Create a dockerfile
225
+
1.**Create a dockerfile**
221
226
- Download mariadb-server && mariadb-client
222
227
- To run mariaDB on your container, you have to copy your .sh and the .sql on the /var/local/bin/
223
228
- Give the right to execute your mysqld (which is the daemon for mysql)
224
229
- Launch your script to install mariaDB
225
230
- Then do a CMD to enable the database to listen to all the IPV4 adresses.
226
231
227
-
2. Create a script (.sh file)
232
+
2.**Create a script (.sh file)**
228
233
- mysql_install_db initializes the MySQL data directory and creates the system tables that it contains, if they do not exist
229
234
- In this script we downloaded Maria DB on the container, we have to install it and create the root user
230
235
- Then we launch the commandline to give all the privileges to the root user. The function GRANT from mysqlcli (sql command line) gives access (or all access) to a user.
231
236
232
-
3. Create your file.sql
237
+
3.**Create your file.sql**
233
238
- 2 options :
234
239
1. You create the database, the user and you give all privileges to the user
235
240
as [malatini did](https://github.com/42cursus/inception/blob/validated/srcs/requirements/mariadb/config/create_db.sql)
@@ -273,21 +278,21 @@ redis-server --protected-mode no // To set up redis when you launch your image
273
278
```
274
279
275
280
### How to set up REDIS
276
-
1. Create a dockerfile
281
+
1.**Create a dockerfile**
277
282
- Install redis on it
278
283
- Copy the .sh in your image
279
284
- RUN the .sh
280
285
281
-
2. Create a sheel script
286
+
2.**Create a sheel script**
282
287
*Redis by default has a redis.conf and we need to modify 3 values on it*
283
288
- Modify the value on the .conf document with the sed function
284
289
- Run the redis-server command to install it
285
290
286
-
3. Modify the dockerfile of wordpress
291
+
3.**Modify the dockerfile of wordpress**
287
292
- You need to DL the wp-cli and you need to move it it the app directory (/usr/bin/wordpress)
288
293
- Add the installation of redis and php-redis
289
294
290
-
4. Modify your script on wordpress file
295
+
4.**Modify your script on wordpress file**
291
296
*To do this, we can set directly information in the script for wordpress wpcli command*
292
297
- Modify the wp-config.php file
293
298
- Define the redis Host
@@ -298,10 +303,10 @@ redis-server --protected-mode no // To set up redis when you launch your image
298
303
- Install the redis-cache plugin, updates and enables it
299
304
300
305
### How to know your redis is installed on wordpress and running
301
-
1. Check redis is properly installed on your redis image
306
+
1.**Check redis is properly installed on your redis image**
302
307
Launch the command 'redis-cli -h localhost' on your redis image, your should connect to your localhost. Then do ping and the answer should be PONG. Great your redis is installed.
303
308
304
-
2. Check if the plugin is installed on wordpress
309
+
2.**Check if the plugin is installed on wordpress**
305
310
- Go to your wp-admin panel on wordpress : for me it is https://vbachele.42.fr
306
311
- click on plugins on the left tab
307
312
- If you see "Redis Object Cache", Congrats !, click on settings and you will see Status "Connected" in green
@@ -317,22 +322,22 @@ Launch the command 'redis-cli -h localhost' on your redis image, your should con
317
322
An FTP Server, in the simplest of definitions, is a software application that enables the transfer of files from one computer to another. FTP (which stands for “File Transfer Protocol”) is a way to transfer files to any computer in the world that is connected to the Internet. For wordpress it allows to modify ealisy your files like the wordpress files or your code.
318
323
319
324
### How to set up your ftp server ?
320
-
1. Create a dockerfile
325
+
1.**Create a dockerfile**
321
326
- Download vsftpd (a ftp secure secure server)
322
327
- Copy the .conf in your ftp image
323
328
- Run your script to install ftp_server
324
329
- Run your ftp_server
325
-
2. Modify your docker-composer.yml
330
+
2.**Modify your docker-composer.yml**
326
331
- Create your image as usual
327
332
- Add the port 20 and 21 (port by default for ftp servers)
328
333
- Put the same volumes as your wordpress && nginx
329
334
330
-
3. Create a script to execute
335
+
3.**Create a script to execute**
331
336
*In this script we will create a user, give rights*
332
337
- Create a user
333
338
- give him the right to your www files
334
339
335
-
4. Create .conf_file
340
+
4.**Create .conf_file**
336
341
*In this document*
337
342
338
343
## ADMINER
@@ -341,22 +346,22 @@ An FTP Server, in the simplest of definitions, is a software application that en
341
346
Replace phpMyAdmin with Adminer and you will get a tidier user interface, better support for MySQL features, higher performance and more security.
342
347
343
348
### How to set up adminer
344
-
1. Create a dockerfile
349
+
1.**Create a dockerfile**
345
350
- Download curl && php
346
351
- Download the version of adminer
347
352
- Move the adminer php file to the index.php file (located in var/www/html)
348
353
- Add the user www-data
349
354
- Move your conf file in the php-fpm.d directory
350
355
351
-
2. Create a www.conf file
356
+
2.**Create a www.conf file**
352
357
- You need to add the listen port (*in my case the 9000*)
353
358
- Add the listen owner and listen group *(in my case : www-data)*
354
359
355
-
3. Modify the nginx.conf file
360
+
3.**Modify the nginx.conf file**
356
361
- You need to add in your nginx.conf a rule to listen the adminer on the port 9000.
357
362
- It will check if the index.php exist
358
363
359
-
4. Modify your docker-compose.yml
364
+
4.**Modify your docker-compose.yml**
360
365
- Create as usual a docker image adminer in your docker-compose
361
366
362
367
### How to know adminer is working?
@@ -372,20 +377,20 @@ Replace phpMyAdmin with Adminer and you will get a tidier user interface, better
372
377
Hugo is a fast and modern static site generator written in Go, and designed to make website creation fun again.
373
378
374
379
### How to set up hugo?
375
-
1. Modify the docker-compose file
380
+
1.**Modify the docker-compose file**
376
381
377
-
2. Create a dockerfile
382
+
2.**Create a dockerfile**
378
383
- Download hugo
379
384
- Create and go the dedicate directory (for me the name is *me*)
380
385
- Create your webiste and add your template
381
386
- Copy your toml file to replace the one for your directory
382
387
383
-
3. Add a config.toml file
388
+
3.**Add a config.toml file**
384
389
- The toml file is used by hugo as a configuration file
385
390
- You need to add the #baseURL with your url
386
391
- Your need to add the theme your downloaded on the dockerfile for my case it is "m10c"
387
392
388
-
4. Modify the .nginx file
393
+
4.**Modify the .nginx file**
389
394
- You have to add a rule to listen the dedicated directory
390
395
- Add the rule for the proxy pass to listen your container
391
396
- include the params for the proxy for nginx
@@ -396,6 +401,8 @@ Hugo is a fast and modern static site generator written in Go, and designed to m
396
401
- If you see a page it works !
397
402

398
403
404
+
##
405
+
399
406
# Useful things to know about inception dockers and containers
400
407
- I installed Ohmyzsh - check my dockerfile to see the command
401
408
- On the mac, Apache service is installed by default. I deleted Apache from my computer to avoid any problem with nginx
0 commit comments