Skip to content

appinha/42cursus-02-ft_server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

42cursus' ft_server

Development repo for 42cursus' ft_server project
For further information about 42cursus and its projects, please refer to 42cursus repo.

GitHub code size in bytes Number of lines of code Code language count GitHub top language GitHub last commit


🗣️ About

This is a System Administration subject. You will discover Docker and you will set up your first web server.

For detailed information, refer to the subject of this project.

🚀 TLDR: this project consists of developing a web server set up with Docker. The web server
includes NGINX, SSL Protocol, a MySQL database (MariaDB), phpMyAdmin and Wordpress.

📑 Index

@root

  • Dockerfile - contains the instructions for building the web server's docker image.

@/srcs/

  • setup.sh - script for setup configuration: installs and configures all requested services.
  • services.sh - script for initialization of webserver's services.
  • autoindex.sh - script for turning autoindex on or off.
  • testing.sh - script (with docker commands) for testing the project.

@/srcs/setup/

🛠️ Usage

Requirements

1. Check system specification

This project requires Docker to run. To check if you have Docker installed, run:

$ docker --version

2. Install requirements

To install Docker, follow the instructions available in the official documentation.

Instructions

1. Creating the Docker image

To create the Docker image, from the root of this repo run:

$ docker build -t <image_name> .

To check if the image was properly created, run:

$ docker images

2. Creating a Docker container

To create a Docker container, run:

$ docker run --name <container_name> -it -p 80:80 -p 443:443 <image_name>

To list all existing containers, run:

$ docker container ls -al

3. Accessing the web server

Open a web browser and navigate to the localhost.

To access the database manager, go to localhost/wordpress/wp-login.php

📌 Useful Links

Docker

Debian

Webserver Tutorial

NGINX

SSL Protocol

Webserver's services

🤓 Study Summary

Docker

Docker is a solution for the management of lightweight process containers.

An image is an object that you can download and reuse to instantiate new containers. Ready-made images are provided in Docker's official repositories (their "official images"), the Docker Hub.

Docker can build images automatically by reading the instructions from a Dockerfile - a text file that contains all commands, in order, needed to build a given image. Using docker build users can create an automated build that executes several command-line instructions in succession.

The build is run by the Docker daemon, not by the CLI. Docker daemon is a server which interacts with the operating system and performs all kinds of services.

An ENTRYPOINT identifies which executable should be run when a container is started from your image.

Docker CLI commands:

  • docker images - List all docker images.
  • docker rmi [image_name] - Remove image.
  • docker build -t [image_name] . - Build an image from a Dockerfile (in current location).
  • docker run --name [container_name] image - Start a container from an image, with a custom name.
  • docker run --name [container_name] -it -p 80:80 -p 443:443 [name] - -i interactive, -p ports.
  • docker start|stop [container_name] - Start or stop an existing container.
  • docker ps - List currently running docker containers.
  • docker ps -a - List all docker containers (running and stopped).
  • docker exec -it [container_name] sh - Open a shell inside of an already running container.
  • docker rm [container_name] - Remove a stopped container.

Reference: Docker Documentation - CLI

NGINX

NGINX (read as "engine-x" ) is a lightweight, high-performance web server designed for high-traffic use cases.

SSL Protocol

OpenSSL is a software library for applications that secure communications over computer networks against eavesdropping or need to identify the party at the other end.

MySQL & MariaDB

MySQL is an open-source relational database management system.

MariaDB is a community-developed, commercially supported fork of the MySQL relational database management system, intended to remain free and open-source software under the GNU General Public License.

phpMyAdmin

phpMyAdmin is a free and open source administration tool for MySQL and MariaDB.

Wordpress

WordPress (WP, WordPress.org) is a free and open-source content management system (CMS) written in PHP and paired with a MySQL or MariaDB database.