Upload files to "sk1"
This commit is contained in:
parent
1f319a20c8
commit
4125a9bb9c
238
sk1/README.md
Normal file
238
sk1/README.md
Normal file
@ -0,0 +1,238 @@
|
|||||||
|
# Cloud Notes App
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
Cloud Notes App is a containerized cloud-based web application for storing notes online.
|
||||||
|
The application allows users to add and manage notes using a modern web interface connected to a MongoDB database.
|
||||||
|
The project was developed as part of a Cloud Technologies deployment assignment.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Technologies Used
|
||||||
|
|
||||||
|
- Node.js
|
||||||
|
- Express.js
|
||||||
|
- MongoDB
|
||||||
|
- Nginx
|
||||||
|
- Docker
|
||||||
|
- Docker Compose
|
||||||
|
- Railway Cloud Platform
|
||||||
|
- GitHub
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Application Architecture
|
||||||
|
|
||||||
|
The application uses a multi-container architecture consisting of:
|
||||||
|
|
||||||
|
1. **Node.js Backend Container**
|
||||||
|
- Handles API requests
|
||||||
|
- Connects to MongoDB
|
||||||
|
- Serves application logic
|
||||||
|
|
||||||
|
2. **MongoDB Database Container**
|
||||||
|
- Stores user notes persistently
|
||||||
|
- Uses persistent storage volumes
|
||||||
|
|
||||||
|
3. **Nginx Reverse Proxy Container**
|
||||||
|
- Handles HTTP traffic
|
||||||
|
- Proxies requests to Node.js backend
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Add cloud notes
|
||||||
|
- Persistent database storage
|
||||||
|
- Responsive user interface
|
||||||
|
- Dockerized deployment
|
||||||
|
- Public cloud hosting
|
||||||
|
- HTTPS support
|
||||||
|
- MongoDB integration
|
||||||
|
- Reverse proxy using Nginx
|
||||||
|
- Environment variable configuration
|
||||||
|
- Automated deployment scripts
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Cloud Platform
|
||||||
|
|
||||||
|
The application is deployed publicly using the **Railway** cloud platform.
|
||||||
|
|
||||||
|
Railway provides:
|
||||||
|
- Public HTTPS access
|
||||||
|
- Container hosting
|
||||||
|
- Cloud networking
|
||||||
|
- Managed MongoDB service
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Public Access
|
||||||
|
|
||||||
|
The application is accessible publicly through HTTPS using a generated Railway domain.
|
||||||
|
|
||||||
|
**Example:**
|
||||||
|
```
|
||||||
|
https://your-domain.up.railway.app
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Persistent Storage
|
||||||
|
|
||||||
|
MongoDB data is stored using persistent volumes to ensure that notes remain saved after application restarts.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Deployment Instructions
|
||||||
|
|
||||||
|
### Run Application
|
||||||
|
```bash
|
||||||
|
docker compose up -d --build
|
||||||
|
```
|
||||||
|
|
||||||
|
### Stop Application
|
||||||
|
```bash
|
||||||
|
docker compose down -v
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Scripts
|
||||||
|
|
||||||
|
### `prepare-app.sh`
|
||||||
|
Used to:
|
||||||
|
- Build containers
|
||||||
|
- Start services
|
||||||
|
- Deploy the application
|
||||||
|
|
||||||
|
### `remove-app.sh`
|
||||||
|
Used to:
|
||||||
|
- Stop containers
|
||||||
|
- Remove services
|
||||||
|
- Clean deployment resources
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Environment Variables
|
||||||
|
|
||||||
|
The application uses environment variables for secure configuration.
|
||||||
|
|
||||||
|
**Example:**
|
||||||
|
```env
|
||||||
|
MONGO_URL=mongodb://mongodb:27017/notes
|
||||||
|
```
|
||||||
|
|
||||||
|
> Sensitive data is not stored directly in GitHub.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Backup Instructions
|
||||||
|
|
||||||
|
MongoDB database can be backed up using:
|
||||||
|
```bash
|
||||||
|
mongodump
|
||||||
|
```
|
||||||
|
|
||||||
|
Backup files can later be restored using:
|
||||||
|
```bash
|
||||||
|
mongorestore
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Viewing Logs
|
||||||
|
|
||||||
|
Docker logs can be viewed using:
|
||||||
|
```bash
|
||||||
|
docker logs container_name
|
||||||
|
```
|
||||||
|
|
||||||
|
Railway deployment logs are available through the Railway dashboard.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Cost Analysis
|
||||||
|
|
||||||
|
Estimated cloud deployment cost for:
|
||||||
|
- **1,000 users/day**
|
||||||
|
- **50 GB database/storage**
|
||||||
|
|
||||||
|
### Estimated Resources
|
||||||
|
|
||||||
|
| Resource | Estimated Cost |
|
||||||
|
|----------------------|-------------------|
|
||||||
|
| Railway Web Service | $5 – $10/month |
|
||||||
|
| MongoDB Storage | $5 – $15/month |
|
||||||
|
| Network Traffic | $2 – $5/month |
|
||||||
|
|
||||||
|
### Estimated Annual Cost
|
||||||
|
|
||||||
|
Approximately **$150 – $300 per year**, depending on traffic and storage usage.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Repository Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
sk1/
|
||||||
|
│
|
||||||
|
├── app/
|
||||||
|
│ ├── public/
|
||||||
|
│ │ └── index.html
|
||||||
|
│ ├── Dockerfile
|
||||||
|
│ ├── package.json
|
||||||
|
│ └── server.js
|
||||||
|
│
|
||||||
|
├── nginx/
|
||||||
|
│ └── nginx.conf
|
||||||
|
│
|
||||||
|
├── docker-compose.yml
|
||||||
|
├── prepare-app.sh
|
||||||
|
├── remove-app.sh
|
||||||
|
└── README.md
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Configuration Description
|
||||||
|
|
||||||
|
### Docker Compose
|
||||||
|
Defines:
|
||||||
|
- Application containers
|
||||||
|
- Networking
|
||||||
|
- Persistent volumes
|
||||||
|
|
||||||
|
### Nginx Configuration
|
||||||
|
Used as reverse proxy forwarding requests to the Node.js application.
|
||||||
|
|
||||||
|
### Dockerfile
|
||||||
|
Builds the Node.js application container.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Requirements for Running
|
||||||
|
|
||||||
|
The following software is required:
|
||||||
|
- Docker Desktop
|
||||||
|
- Docker Compose
|
||||||
|
- Git
|
||||||
|
- Internet connection
|
||||||
|
|
||||||
|
**Supported operating systems:**
|
||||||
|
- Windows
|
||||||
|
- Linux
|
||||||
|
- macOS
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## External Resources
|
||||||
|
|
||||||
|
The following resources were used during development:
|
||||||
|
- [Docker Documentation](https://docs.docker.com)
|
||||||
|
- [MongoDB Documentation](https://www.mongodb.com/docs)
|
||||||
|
- [Node.js Documentation](https://nodejs.org/en/docs)
|
||||||
|
- [Railway Documentation](https://docs.railway.app)
|
||||||
|
- [GitHub Documentation](https://docs.github.com)
|
||||||
|
|
||||||
|
> Generative AI assistance was used for debugging, deployment guidance, frontend improvements, and README preparation.
|
||||||
30
sk1/docker-compose.yml
Normal file
30
sk1/docker-compose.yml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
|
||||||
|
app:
|
||||||
|
build: ./app
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
- MONGO_URL=mongodb://mongo:27017/notes
|
||||||
|
depends_on:
|
||||||
|
- mongo
|
||||||
|
|
||||||
|
mongo:
|
||||||
|
image: mongo
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- mongo-data:/data/db
|
||||||
|
|
||||||
|
nginx:
|
||||||
|
image: nginx
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "80:80"
|
||||||
|
volumes:
|
||||||
|
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
|
||||||
|
depends_on:
|
||||||
|
- app
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
mongo-data:
|
||||||
1
sk1/prepare-app.sh
Normal file
1
sk1/prepare-app.sh
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
||||||
BIN
sk1/remove-app.sh
Normal file
BIN
sk1/remove-app.sh
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user