238 lines
4.5 KiB
Markdown
238 lines
4.5 KiB
Markdown
# 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. |