Skip to content

Latest commit

 

History

History
232 lines (161 loc) · 5.53 KB

File metadata and controls

232 lines (161 loc) · 5.53 KB

UNIWA

UNIVERSITY OF WEST ATTICA
SCHOOL OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING AND INFORMATICS

University of West Attica · Department of Computer Engineering and Informatics


Cloud Computing and Services

Virtual Lab – Dockerized Cloud Services

Vasileios Evangelos Athanasiou
Student ID: 19390005

GitHub · LinkedIn

Georgios Theocharis
Student ID: 19390283

GitHub


Supervision

Supervisor: Vasileios Mamalis, Professor

UNIWA Profile

Supervisor: Dimitrios Kallergis, Applications Lecturer

UNIWA Profile · LinkedIn

Co-supervisor: Apostolos Anagnostopoulos, Special Technical Laboratory Staff

UNIWA Profile


Athens, June 2024



INSTALL

Virtual Lab – Dockerized Cloud Services

The shell scripts up.sh and down.sh automate the process of automatically running services and shutting them down respectively.


1. up.sh

#!/bin/bash

NETWORK="vlab_network"
WORDPRESS="../Wordpress"
MYSQL="../MySQL"
PHPMYADMIN="../phpMyAdmin"
COMPOSE_FILE="docker-compose.yaml"
COMPOSE_FILE_OVERRIDE="docker-compose.override.yaml"

up_containers() {
docker network create $NETWORK

echo "Starting MySQL..."
(cd $MYSQL && docker compose -f $COMPOSE_FILE -f $COMPOSE_FILE_OVERRIDE up -d)

echo "Starting phpMyAdmin..."
(cd $PHPMYADMIN && docker compose -f $COMPOSE_FILE -f $COMPOSE_FILE_OVERRIDE up -d)

echo "Starting WordPress..."
(cd $WORDPRESS && docker compose -f $COMPOSE_FILE -f $COMPOSE_FILE_OVERRIDE up -d)
}

up_containers

exit 0
  • NETWORK: The name of the Docker network to be created.
  • WORDPRESS: The filepath where the docker-compose files for running the Wordpress service are located.
  • MYSQL: The filepath where the docker-compose files for running the MySQL service are located.
  • PHPMYADMIN: The relative path to the phpMyAdmin Docker installation directory.
  • COMPOSE_FILE: The name of the main Docker Compose file that creates the image of each service and configures the network.
  • COMPOSE_FILE_OVERRIDE: The name of the Docker Compose override file that contains all the configs for each service.

2. down.sh

#!/bin/bash

NETWORK="vlab_network"
WORDPRESS="../Wordpress"
MYSQL="../MySQL"
PHPMYADMIN="../phpMyAdmin"
COMPOSE_FILE="docker-compose.yaml"
COMPOSE_FILE_OVERRIDE="docker-compose.override.yaml"

down_containers() {
echo "Stopping WordPress..."
(cd $WORDPRESS && docker compose -f $COMPOSE_FILE -f $COMPOSE_FILE_OVERRIDE down)

echo "Stopping phpMyAdmin..."
(cd $PHPMYADMIN && docker compose -f $COMPOSE_FILE -f $COMPOSE_FILE_OVERRIDE down)

echo "Stopping MySQL..."
(cd $MYSQL && docker compose -f $COMPOSE_FILE -f $COMPOSE_FILE_OVERRIDE down)

docker network rm $NETWORK
}

down_containers

exit 0

3. Install & Setup

To install and configure this project, follow these steps:

3.1 Clone the repository by running the command

git clone https://github.com/Cloud-Computing-and-Services/Virtual-Lab.git

3.2 Go to the project directory by pressing the command

cd Virtual-Lab/src

3.3 Go to the install directory, where the bash scripts that automate the startup and shutdown of the project are located

cd install

3.4 Start the project by running the bash script by pressing the command

./up.sh

3.5 Open your browser and visit the services at the following links:

Use phpMyAdmin to manage the MySQL database and configure the database for WordPress.


4. Stop

To stop the services from running, follow these steps:

4.1 Go to the install directory, where the bash scripts that automate starting and stopping the project are located

cd install

4.2 Terminate the project by running the bash script by pressing the command

./down.sh

5. Conclusion

To summarize, with the above shell scripts we can create or remove the containers of the 3 services of the application. Removing the containers includes removing the network that the containers communicate with. The data volumes remain as they are.