42 cursus: docker project.
- Status: finished
- Result: 125%
- Observations: (null)
- run
make
ormake load
to start the docker-compose containers. - run
make stop
to stop the containers. - run
make prune
to stop the containers and/or delete the volumes.
NOTE: to change the docker-compose volumes location, you will need to change it in the Makefile
and on the srcs/docker-compose.yml
file.
P.S.: you can change variables such as the Domain, users and passwords on the srcs/.env
file.
For this project we need to setup a simple docker-compose network with the following containers:
- NGINX with TLSv1.2 or TLSv1.3.
- Wordpress + php-fpm (installed and configured).
- MariaDB.
With the following volumes:
- A volume that contains Wordpress database.
- A volume that contains Wordpress website files.
Each docker container must have his own Dockerfile
and, of course, have to restart in case of crash
Here is an example diagram of the expected result:
NOTE: I also open the port 80, to recive HTTP connections, but I redirect those to the HTTPS protocol, that's how it should be, and how it is in most websites. Just delete the line of the docker-compose.yml if you don't want the port 80 open.
I wanted to learn more about Docker so I also do the bonus part of the project, that part requires us to setup 5 more containers:
- redis cache, for wordpress.
- FTP server pointing to the volume of the wordpress site.
- A static website (Some simple .html, .css and .js files is the web root, so wordpress is now in
https://domain.com/wordpress
). - Adminer (a simple tool to manage mysql).
- A service of my choice, I choose
bind
(a DNS service), because we need to setup the ip resolve manually in/etc/hosts
to access the web via the domain, so a DNS was fine for that purpouse. - I also add PhpMyAdmin because... why not? Simple to install and way better than adminer.
In addition to the diagram above, I also open the ports 21, 21100-21110 for the FTP server.
Conclusion: now I like Docker and I enjoyed this a lot.
NOTE: the bind container (DNS container) is commented on the docker-compose.yml file because it's not really important, uncomment it if you want it.