assiangment 1
This commit is contained in:
commit
92f6b6ba39
47
README.md
Normal file
47
README.md
Normal file
@ -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:
|
||||||
|
|
31
docker-compose.yaml
Normal file
31
docker-compose.yaml
Normal file
@ -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:
|
6
prepare-app.sh
Executable file
6
prepare-app.sh
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
echo "Preparing application..."
|
||||||
|
docker network create myapp-net
|
||||||
|
docker volume create mysql-data
|
||||||
|
echo "Preparation complete."
|
||||||
|
|
7
remove-app.sh
Executable file
7
remove-app.sh
Executable file
@ -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."
|
||||||
|
|
5
start-app.sh
Executable file
5
start-app.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
echo "Starting application..."
|
||||||
|
docker compose up -d
|
||||||
|
echo "Application started. Access it at http://localhost:8080"
|
||||||
|
|
5
stop-app.sh
Executable file
5
stop-app.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
echo "Stopping application..."
|
||||||
|
docker-compose down
|
||||||
|
echo "Application stopped."
|
||||||
|
|
10
web/index.html
Normal file
10
web/index.html
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>My Simple Docker App</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Welcome to My Nginx Server!</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user