Skip to content

Commit 7a54df5

Browse files
committed
READ.me uptodate
1 parent 5da8916 commit 7a54df5

File tree

3 files changed

+46
-46
lines changed

3 files changed

+46
-46
lines changed

README.md

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Inception
22
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.
33

4-
## Important things about the project
4+
## Important things to read before beginning the project
55

66
1. **Don't try to do all the containers** (Nginx, wordpress and mariaDB) at the same time.
77
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
1919
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!)
2020

2121
- 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+
2224
If you have questions: please contact me, I will be glad to give you an answer ! my discord username: vbachele#7949
2325

2426
# SUMMARY
@@ -36,6 +38,8 @@ Docker is an open platform for developing, shipping, and running applications. D
3638
Docker provides the ability to package and run an application in a loosely isolated environment called a container.
3739

3840
## 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/)
3943
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.
4044

4145
## What is a docker-file ?
@@ -120,6 +124,7 @@ Nginx conf documents will be used to config our server and the right proxy conne
120124
- [All nginx definitions](<http://nginx.org/en/docs/http/ngx_http_core_module.html>)
121125
- [Nginx Command line](<https://www.nginx.com/resources/wiki/start/topics/tutorials/commandline/>)
122126
- [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)
123128

124129
### Listen && Location
125130
- 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
177182
*definitions*
178183
*wp-config.php* This file tells to your database how to get your files and how to treat them
179184
## What are the steps to create your Wordpress
180-
1. Create you dockerfile image
185+
1. **Create you dockerfile image**
181186
- Download php-fpm
182187
- Copy the www.conf file in php/7.3/fpm/pool.d/
183188
- Create the php directory to enable php-fpm to run
184189
- Copy the script and launch it
185190
- Go to the html directory
186191
- Launch php-fpm
187192

188-
2. Create a script
193+
2. **Create a script**
189194
- Download wordpress
190195
- Create the configuration file of wordpress
191196
- Move files from wordpress in the html directory
192197
- Give the 4th environmental variables for wordpress
193198

194-
3. Create a www.conf
199+
3. **Create a www.conf**
195200
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
196201
- Put listen = 0.0.0.0:9000 to listen to all ports
197202
- 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
217222
```
218223

219224
## What are the steps to create your own Maria DB image
220-
1. Create a dockerfile
225+
1. **Create a dockerfile**
221226
- Download mariadb-server && mariadb-client
222227
- To run mariaDB on your container, you have to copy your .sh and the .sql on the /var/local/bin/
223228
- Give the right to execute your mysqld (which is the daemon for mysql)
224229
- Launch your script to install mariaDB
225230
- Then do a CMD to enable the database to listen to all the IPV4 adresses.
226231

227-
2. Create a script (.sh file)
232+
2. **Create a script (.sh file)**
228233
- mysql_install_db initializes the MySQL data directory and creates the system tables that it contains, if they do not exist
229234
- In this script we downloaded Maria DB on the container, we have to install it and create the root user
230235
- 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.
231236

232-
3. Create your file.sql
237+
3. **Create your file.sql**
233238
- 2 options :
234239
1. You create the database, the user and you give all privileges to the user
235240
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
273278
```
274279

275280
### How to set up REDIS
276-
1. Create a dockerfile
281+
1. **Create a dockerfile**
277282
- Install redis on it
278283
- Copy the .sh in your image
279284
- RUN the .sh
280285

281-
2. Create a sheel script
286+
2. **Create a sheel script**
282287
*Redis by default has a redis.conf and we need to modify 3 values on it*
283288
- Modify the value on the .conf document with the sed function
284289
- Run the redis-server command to install it
285290

286-
3. Modify the dockerfile of wordpress
291+
3. **Modify the dockerfile of wordpress**
287292
- You need to DL the wp-cli and you need to move it it the app directory (/usr/bin/wordpress)
288293
- Add the installation of redis and php-redis
289294

290-
4. Modify your script on wordpress file
295+
4. **Modify your script on wordpress file**
291296
*To do this, we can set directly information in the script for wordpress wpcli command*
292297
- Modify the wp-config.php file
293298
- Define the redis Host
@@ -298,10 +303,10 @@ redis-server --protected-mode no // To set up redis when you launch your image
298303
- Install the redis-cache plugin, updates and enables it
299304

300305
### 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**
302307
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.
303308

304-
2. Check if the plugin is installed on wordpress
309+
2. **Check if the plugin is installed on wordpress**
305310
- Go to your wp-admin panel on wordpress : for me it is https://vbachele.42.fr
306311
- click on plugins on the left tab
307312
- 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
317322
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.
318323

319324
### How to set up your ftp server ?
320-
1. Create a dockerfile
325+
1. **Create a dockerfile**
321326
- Download vsftpd (a ftp secure secure server)
322327
- Copy the .conf in your ftp image
323328
- Run your script to install ftp_server
324329
- Run your ftp_server
325-
2. Modify your docker-composer.yml
330+
2. **Modify your docker-composer.yml**
326331
- Create your image as usual
327332
- Add the port 20 and 21 (port by default for ftp servers)
328333
- Put the same volumes as your wordpress && nginx
329334

330-
3. Create a script to execute
335+
3. **Create a script to execute**
331336
*In this script we will create a user, give rights*
332337
- Create a user
333338
- give him the right to your www files
334339

335-
4. Create .conf_file
340+
4. **Create .conf_file**
336341
*In this document*
337342

338343
## ADMINER
@@ -341,22 +346,22 @@ An FTP Server, in the simplest of definitions, is a software application that en
341346
Replace phpMyAdmin with Adminer and you will get a tidier user interface, better support for MySQL features, higher performance and more security.
342347

343348
### How to set up adminer
344-
1. Create a dockerfile
349+
1. **Create a dockerfile**
345350
- Download curl && php
346351
- Download the version of adminer
347352
- Move the adminer php file to the index.php file (located in var/www/html)
348353
- Add the user www-data
349354
- Move your conf file in the php-fpm.d directory
350355

351-
2. Create a www.conf file
356+
2. **Create a www.conf file**
352357
- You need to add the listen port (*in my case the 9000*)
353358
- Add the listen owner and listen group *(in my case : www-data)*
354359

355-
3. Modify the nginx.conf file
360+
3. **Modify the nginx.conf file**
356361
- You need to add in your nginx.conf a rule to listen the adminer on the port 9000.
357362
- It will check if the index.php exist
358363

359-
4. Modify your docker-compose.yml
364+
4. **Modify your docker-compose.yml**
360365
- Create as usual a docker image adminer in your docker-compose
361366

362367
### How to know adminer is working?
@@ -372,20 +377,20 @@ Replace phpMyAdmin with Adminer and you will get a tidier user interface, better
372377
Hugo is a fast and modern static site generator written in Go, and designed to make website creation fun again.
373378

374379
### How to set up hugo?
375-
1. Modify the docker-compose file
380+
1. **Modify the docker-compose file**
376381

377-
2. Create a dockerfile
382+
2. **Create a dockerfile**
378383
- Download hugo
379384
- Create and go the dedicate directory (for me the name is *me*)
380385
- Create your webiste and add your template
381386
- Copy your toml file to replace the one for your directory
382387

383-
3. Add a config.toml file
388+
3. **Add a config.toml file**
384389
- The toml file is used by hugo as a configuration file
385390
- You need to add the #baseURL with your url
386391
- Your need to add the theme your downloaded on the dockerfile for my case it is "m10c"
387392

388-
4. Modify the .nginx file
393+
4. **Modify the .nginx file**
389394
- You have to add a rule to listen the dedicated directory
390395
- Add the rule for the proxy pass to listen your container
391396
- 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
396401
- If you see a page it works !
397402
![hugo_website](images/hugo.png)
398403

404+
##
405+
399406
# Useful things to know about inception dockers and containers
400407
- I installed Ohmyzsh - check my dockerfile to see the command
401408
- On the mac, Apache service is installed by default. I deleted Apache from my computer to avoid any problem with nginx

scrs/docker-compose.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,20 @@ services:
6666
networks:
6767
- network
6868

69-
# ftp-server:
70-
# build: requirements/bonus/ftp_server
71-
# container_name: ftp-server
72-
# ports:
73-
# - "21:21"
74-
# - "21100-21110:21100-21110"
75-
# volumes:
76-
# - "wordpress_data:/var/www/html"
77-
# networks:
78-
# - network
79-
# restart: always
80-
# environment:
81-
# FTP_USR: ${FTP_USR}
82-
# FTP_PWD: ${FTP_PWD}
69+
ftp-server:
70+
build: requirements/bonus/ftp_server
71+
container_name: ftp-server
72+
ports:
73+
- "21:21"
74+
- "21100-21110:21100-21110"
75+
volumes:
76+
- "wordpress_data:/var/www/html"
77+
networks:
78+
- network
79+
restart: always
80+
environment:
81+
FTP_USR: ${FTP_USR}
82+
FTP_PWD: ${FTP_PWD}
8383

8484
adminer:
8585
build: ./requirements/bonus/adminer

scrs/requirements/wordpress/dockerfile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,10 @@ RUN apt-get update && apt-get -y install \
1515
php-redis \
1616
&& rm -rf /var/lib/apt/lists/*
1717

18-
# BONUS PART #
19-
20-
## redis ##
21-
# RUN php-redis \
22-
# redis
23-
2418
# I need to install wp_cli command and put it in the right directory /usr/local/bin
2519
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
2620
&& chmod +x wp-cli.phar \
2721
&& mv wp-cli.phar /usr/local/bin/wp
28-
##################
2922

3023
# Copy the .conf in the html directory
3124
COPY ./conf/www.conf /etc/php/7.3/fpm/pool.d/

0 commit comments

Comments
 (0)