From efbe10d6649ea5b55f42a4c2b5ed6885678ae359 Mon Sep 17 00:00:00 2001 From: Iban Date: Thu, 4 May 2023 12:05:02 +0200 Subject: [PATCH] initial --- z1/README.md | 46 ++++++++++++++++++++++++++++++++++++++++++ z1/docker-compose.yaml | 21 +++++++++++++++++++ z1/prepare-app.sh | 7 +++++++ z1/remove-app.sh | 4 ++++ z1/start-app.sh | 4 ++++ z1/stop-app.sh | 3 +++ 6 files changed, 85 insertions(+) create mode 100644 z1/README.md create mode 100644 z1/docker-compose.yaml create mode 100755 z1/prepare-app.sh create mode 100755 z1/remove-app.sh create mode 100755 z1/start-app.sh create mode 100755 z1/stop-app.sh diff --git a/z1/README.md b/z1/README.md new file mode 100644 index 0000000..d43a0db --- /dev/null +++ b/z1/README.md @@ -0,0 +1,46 @@ +Software Requirements + + Docker version 20.10.5 or higher + Docker Compose version 1.29.1 or higher + +Application Description + + The web application is a simple blogging platform that allows users to create, edit, and delete blog posts. The application uses a MySQL database to store blog post data and a httpd server. + + +The application uses the following virtual networks and named volumes: + + Named volumes: + db_data: MySQL database data + web_data: WEB code data + + +The application consists of the following containers: + + MySQL container: Used to store blog post data + httpd container: PRovide de front-end + + +To prepare the application, run the prepare-app.sh script. This script will perform the following tasks: + + Compile Docker images for MySQL and HTTPD + Create virtual networks and named volumes for the application + Create and initialize the MySQL database + + + +To run the application, run the start-app.sh script. This script will start all necessary containers, configure them to restart in the event of a failure, and display the port on which the application can be accessed. +Pausing and Deleting the Application + +To pause the application, use the docker-compose pause command. To delete the application, run the stop-app.sh script. This script will stop all running containers and remove all associated resources. +Removing all Tracks of the Application + +To remove all traces of the application, run the remove-app.sh script. This script will remove all containers, volumes, and networks created during the preparation and running of the application. +Docker Compose + +If desired, the application can be deployed using Docker Compose. The docker-compose.yaml file contains the necessary configurations for the MySQLand HTTPD. + + +Conclusion + + This document provides a detailed guide for deploying, running, and managing the web application using Docker. Please refer to the included scripts and configuration files for more information. diff --git a/z1/docker-compose.yaml b/z1/docker-compose.yaml new file mode 100644 index 0000000..156bb49 --- /dev/null +++ b/z1/docker-compose.yaml @@ -0,0 +1,21 @@ +version: '3' +services: + web: + image: httpd:latest + ports: + - "80:80" + volumes: + - web_data:/var/html/usr/local/apache2/htdocs/ + database: + image: mysql:latest + + volumes: + - db_data:/var/lib/mysql + environment: + MYSQL_ROOT_PASSWORD: ass1root + MYSQL_DATABASE: mydb + MYSQL_USER: iban + MYSQL_PASSWORD: ass1 +volumes: + web_data: + db_data: diff --git a/z1/prepare-app.sh b/z1/prepare-app.sh new file mode 100755 index 0000000..7038ab7 --- /dev/null +++ b/z1/prepare-app.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +docker volume create web_data +docker volume create db_data + + +docker-compose up -d diff --git a/z1/remove-app.sh b/z1/remove-app.sh new file mode 100755 index 0000000..f468499 --- /dev/null +++ b/z1/remove-app.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +docker volume rm web_data +docker volume rm db_data diff --git a/z1/start-app.sh b/z1/start-app.sh new file mode 100755 index 0000000..bd0f0b8 --- /dev/null +++ b/z1/start-app.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +docker-compose up -d +echo "The app is available at http://localhost:80" diff --git a/z1/stop-app.sh b/z1/stop-app.sh new file mode 100755 index 0000000..f163d8d --- /dev/null +++ b/z1/stop-app.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker-compose down