/inception

This project is an introduction to using Docker and Docker-compose in a network.

Primary LanguageShell


Logo

42 Inception

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. License
  5. Contact

About The Project

This project is about learning to use Docker and docker-compose. We are tasked with creating an NGINX, Wordpress, MariaDB stack without using the original docker images, and instead using the latest version of either Alpine or Debian.

Here was my approach:

  • Look at the original Docker images and see how they manage their configurations and what daemons they run
  • Create an NGINX container that serves only a static index.html page, using port 80
  • Wordpress and MariaDB could only work when done together, so invest time into researching how they will interface together, this applies between NGINX and Wordpress aswell (While I don't have my resources ready now, I can explain a little how they interface later in the README file)
  • Initialise MariaDB, research into SQL syntax and how to create databases
  • Coordinate everything into a docker-compose file
  • Investigate into how docker networks work and create your network
  • Look into bind volumes
  • Put some time into creating scripts that will automate a few things for me in the local environment, among which:
    • creating an .env file
    • creating a ssl key and certificate
    • creating a log directory and log files (for mariadb and nginx, wordpress is vocal enough)
    • creating volume folders
    • adding domain to hosts file
  • Utilise keys in ssl connection, only use port 443 in NGINX container from now on
  • Make hundreds of small tweaks and changes and eventually end up with a working product (to be continued)

(back to top)

Built With

This section should list any major frameworks/libraries used to bootstrap your project. Leave any add-ons/plugins for the acknowledgements section. Here are a few examples.

  • Docker
  • docker-compose
  • Make
  • bash
  • NGINX
  • Wordpress
  • MariaDB

(back to top)

Getting Started

To run my program, use make in the root folder, this should create all dependencies

Prerequisites

Prior to running please install the following:

  • Docker
  • docker-compose
  • Make

Add yourself to the docker group

Usage

Use make without sudo, otherwise the result will not be successful Upon receiving message "Wordpress has been started on port 9000" you may open your browser and type "https://khatlas.42.fr" and be redirected to "https://khatlas.42.fr/wordpress" Data will be retained in ~/data, if you already have a folder named wordpress or mariadb over there it will be treated as the volume and results may vary In order to remove retained data volumes run make fclean, a prompt will ask you if you would like to remove ~/data, do not type your password if you are using ~/data for anything and instead manually type: "sudo rm -rf ~/data/wordpress && rm -rf ~/data/mysql" Re-running after removing volumes will create a new volume Logging in to wp-admin looks as follows: go to url: https://khatlas.42.fr/wordpress/wp-admin and type your username and password. These will have been randomly generated and can be found in ./srcs/.env The passwords are composed of random alphanumeric characters every time you remove the .env file and re-run the Makefile

What more did I want to implement

Creating a private ssl key and certificate locally and copying it is not secure, and I wanted to create a swarm cluster in which I could transfer secret encrypted files, I still want to do this but docker swarm is a bit of a rabbit hole In 42 we are unable to add a domain to the hosts file (for good reasons) and I wanted to see if I can make the website work if I port forward it to the local Mac environment I also wanted to do the bonus, though I was afraid that I would run into too many roadblocks, and time is precious

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Kewin Hatlas - kewin.hatlas@gmail.com

Project Link: https://github.com/atticbat/inception

(back to top)

(back to top)