From 92f6b6ba393f66024da0f8d9ae923d457894cfd5 Mon Sep 17 00:00:00 2001 From: puneetkhurana Date: Wed, 19 Mar 2025 12:22:46 +0100 Subject: [PATCH] assiangment 1 --- .DS_Store | Bin 0 -> 6148 bytes README.md | 47 ++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yaml | 31 +++++++++++++++++++++++++++++ prepare-app.sh | 6 ++++++ remove-app.sh | 7 +++++++ start-app.sh | 5 +++++ stop-app.sh | 5 +++++ web/index.html | 10 ++++++++++ 8 files changed, 111 insertions(+) create mode 100644 .DS_Store create mode 100644 README.md create mode 100644 docker-compose.yaml create mode 100755 prepare-app.sh create mode 100755 remove-app.sh create mode 100755 start-app.sh create mode 100755 stop-app.sh create mode 100644 web/index.html diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..73493abca19b9dd400a4cb9054278b823eb2f01c GIT binary patch literal 6148 zcmeHKO^ee&7=EX%wy~}hRM?9U@Y=20-GyE8lC9l?2SGNX2bG#M!3~>cLX&P-N+D_QXiS_YYthDG6fg>Gn*w6*-lqUNc1)LabN{CBW$^Uqnmp|1_(jaee$0I^ z#Bp(o)cYk3C8B$jV)uv0J&Ak36u%yNxu|fzR=5_O(;0dk(o0|uqXnys+P4a0M~*SU z9Ir6uhOyYA3iB@Jlgl~g8+l(Uytd?VtZ36{KP#*{6_}r2S79#>`<1=e@KYjY|-!>D64h(iLs@(r2#&4M(O4=(3ydi$P*ItFVlYLA-_~)C#!{i8 z6Vs0mrblM_g~H_M=--y%#2ketHwqX9Ru!nLYDe7vXMcbHuaZp7C}0%$uM}X7p*tL4 zN&0SGTb#ISZKRJ#!bDuDP*RZT>sS`VRlJKN4Q;k403D5`LU>^2LqN)4GNZshRp2*2 C;;Zxk literal 0 HcmV?d00001 diff --git a/README.md b/README.md new file mode 100644 index 0000000..8999b51 --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +Last login: Mon Mar 17 20:02:32 on ttys001 + +The default interactive shell is now zsh. +To update your account to use zsh, please run `chsh -s /bin/zsh`. +For more details, please visit https://support.apple.com/kb/HT208050. +MacBookPro:~ puneetkhurana$ cd Documents/ +MacBookPro:Documents puneetkhurana$ cd zkt25/ +MacBookPro:zkt25 puneetkhurana$ cd z1/ +MacBookPro:z1 puneetkhurana$ vim README.md + + + + + + + + + + + + + + + + +Start the Application** +This script **starts all services in the background**: +bash +./start-app.sh + +Expected output: + +Starting application... +Application started. Access it at http://localhost:8080 + + +view the Application in a Web Browser** +- Open **[http://localhost:8080](http://localhost:8080)** +- You should see: `Welcome to My Nginx Server!` + +Pause the Application (Without Deleting Data)** +To stop the application while keeping data intact: + +./stop-app.sh + +Expected output: + diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..e6541ac --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,31 @@ +version: '3.8' + +services: + web: + image: nginx:latest + restart: always + ports: + - "8080:80" + volumes: + - ./web:/usr/share/nginx/html + networks: + - myapp-net + depends_on: + - db + + db: + image: mysql:latest + restart: always + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: myappdb + volumes: + - mysql-data:/var/lib/mysql + networks: + - myapp-net + +volumes: + mysql-data: + +networks: + myapp-net: diff --git a/prepare-app.sh b/prepare-app.sh new file mode 100755 index 0000000..b3d0c40 --- /dev/null +++ b/prepare-app.sh @@ -0,0 +1,6 @@ +#!/bin/bash +echo "Preparing application..." +docker network create myapp-net +docker volume create mysql-data +echo "Preparation complete." + diff --git a/remove-app.sh b/remove-app.sh new file mode 100755 index 0000000..72437a7 --- /dev/null +++ b/remove-app.sh @@ -0,0 +1,7 @@ +#!/bin/bash +echo "Removing application..." +docker-compose down -v +docker network rm myapp-net +docker volume rm mysql-data +echo "Cleanup complete." + diff --git a/start-app.sh b/start-app.sh new file mode 100755 index 0000000..b980455 --- /dev/null +++ b/start-app.sh @@ -0,0 +1,5 @@ +#!/bin/bash +echo "Starting application..." +docker compose up -d +echo "Application started. Access it at http://localhost:8080" + diff --git a/stop-app.sh b/stop-app.sh new file mode 100755 index 0000000..45a5380 --- /dev/null +++ b/stop-app.sh @@ -0,0 +1,5 @@ +#!/bin/bash +echo "Stopping application..." +docker-compose down +echo "Application stopped." + diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000..6d01a9d --- /dev/null +++ b/web/index.html @@ -0,0 +1,10 @@ + + + + My Simple Docker App + + +

Welcome to My Nginx Server!

+ + +