removed odd files
This commit is contained in:
parent
f7988f1f2d
commit
2057655061
64
README.md
64
README.md
@ -1,64 +0,0 @@
|
|||||||
# Docker Web Application Deployment
|
|
||||||
|
|
||||||
The application consists of two services:
|
|
||||||
|
|
||||||
1. **Web Service (Nginx):**
|
|
||||||
- Uses the official Nginx image.
|
|
||||||
- Listens on port 80 inside the container and is mapped to host port 8080.
|
|
||||||
2. **Database Service (MySQL 5.7):**
|
|
||||||
- Uses the official MySQL 5.7 image.
|
|
||||||
- Configured with a root password and a default database.
|
|
||||||
- Persists its data using the named volume `mysql-data`.
|
|
||||||
|
|
||||||
## Files Overview
|
|
||||||
|
|
||||||
- **prepare-app.sh:**
|
|
||||||
- Creates the required Docker network (`myapp-net`) and persistent volume (`mysql-data`).
|
|
||||||
- **docker-compose.yaml:**
|
|
||||||
- Defines the two services along with their ports, environment variables, volumes, and restart policies.
|
|
||||||
- **start-app.sh:**
|
|
||||||
- Starts the services using Docker Compose in detached mode.
|
|
||||||
- Displays the URL to access the web service.
|
|
||||||
- **stop-app.sh:**
|
|
||||||
- Stops the running containers without deleting the persistent volume.
|
|
||||||
- **remove-app.sh:**
|
|
||||||
- Removes all the created resources (containers, network, and volume) from the deployment.
|
|
||||||
|
|
||||||
## Deployment Instructions
|
|
||||||
|
|
||||||
1. **Preparation:**
|
|
||||||
- Ensure Docker and Docker Compose are installed.
|
|
||||||
- Make the scripts executable:
|
|
||||||
```bash
|
|
||||||
chmod +x prepare-app.sh start-app.sh stop-app.sh remove-app.sh
|
|
||||||
```
|
|
||||||
- Run the preparation script:
|
|
||||||
```bash
|
|
||||||
./prepare-app.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Starting the Application:**
|
|
||||||
- Launch the services by running:
|
|
||||||
```bash
|
|
||||||
./start-app.sh
|
|
||||||
```
|
|
||||||
- Open your web browser and navigate to [http://localhost:8080](http://localhost:8080) to see the Nginx welcome page.
|
|
||||||
|
|
||||||
3. **Stopping the Application:**
|
|
||||||
- Stop the services without losing data:
|
|
||||||
```bash
|
|
||||||
./stop-app.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
4. **Removing the Application:**
|
|
||||||
- To completely remove all deployed resources, run:
|
|
||||||
```bash
|
|
||||||
./remove-app.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
## Notes
|
|
||||||
|
|
||||||
- The application uses an external network (`myapp-net`) and a persistent volume (`mysql-data`) that are created in `prepare-app.sh`.
|
|
||||||
- The Nginx container depends on the MySQL container to demonstrate inter-service communication within the `myapp-net` network.
|
|
||||||
- Containers are configured to restart on failure.
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
version: '3.8'
|
|
||||||
|
|
||||||
services:
|
|
||||||
web:
|
|
||||||
image: nginx:latest
|
|
||||||
ports:
|
|
||||||
- "8080:80"
|
|
||||||
networks:
|
|
||||||
- myapp-net
|
|
||||||
restart: on-failure
|
|
||||||
depends_on:
|
|
||||||
- db
|
|
||||||
|
|
||||||
db:
|
|
||||||
image: mysql:5.7
|
|
||||||
environment:
|
|
||||||
MYSQL_ROOT_PASSWORD: example
|
|
||||||
MYSQL_DATABASE: appdb
|
|
||||||
volumes:
|
|
||||||
- mysql-data:/var/lib/mysql
|
|
||||||
networks:
|
|
||||||
- myapp-net
|
|
||||||
restart: on-failure
|
|
||||||
|
|
||||||
networks:
|
|
||||||
myapp-net:
|
|
||||||
external: true
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
mysql-data:
|
|
||||||
external: true
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# prepare-app.sh
|
|
||||||
|
|
||||||
if ! docker network ls | grep -w myapp-net >/dev/null; then
|
|
||||||
docker network create myapp-net
|
|
||||||
echo "Created Docker network: myapp-net"
|
|
||||||
else
|
|
||||||
echo "Docker network myapp-net already exists."
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if ! docker volume ls | grep -w mysql-data >/dev/null; then
|
|
||||||
docker volume create mysql-data
|
|
||||||
echo "Created Docker volume: mysql-data"
|
|
||||||
else
|
|
||||||
echo "Docker volume mysql-data already exists."
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Preparation complete."
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# remove-app.sh
|
|
||||||
|
|
||||||
docker-compose down
|
|
||||||
|
|
||||||
docker volume rm mysql-data
|
|
||||||
docker network rm myapp-net
|
|
||||||
|
|
||||||
echo "All application resources removed."
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# start-app.sh
|
|
||||||
|
|
||||||
docker-compose up -d
|
|
||||||
|
|
||||||
sleep 5
|
|
||||||
|
|
||||||
echo "Application started. Access the web service at http://localhost:8080"
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# stop-app.sh
|
|
||||||
|
|
||||||
docker-compose stop
|
|
||||||
echo "Application services stopped. Persistent data remains intact."
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user