diff --git a/sk1/README.md b/sk1/README.md new file mode 100644 index 0000000..7c5dacc --- /dev/null +++ b/sk1/README.md @@ -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. \ No newline at end of file diff --git a/sk1/docker-compose.yml b/sk1/docker-compose.yml new file mode 100644 index 0000000..e45914e --- /dev/null +++ b/sk1/docker-compose.yml @@ -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: \ No newline at end of file diff --git a/sk1/prepare-app.sh b/sk1/prepare-app.sh new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/sk1/prepare-app.sh @@ -0,0 +1 @@ + diff --git a/sk1/remove-app.sh b/sk1/remove-app.sh new file mode 100644 index 0000000..06d7405 Binary files /dev/null and b/sk1/remove-app.sh differ