Skip to content

Commit ebeca7e

Browse files
authored
Merge pull request #10 from maxh33/feat/rabbitMQ
Feat/rabbit mq
2 parents 2169b3a + 3580083 commit ebeca7e

18 files changed

+722
-114
lines changed

.github/workflows/deploy.yml

+16-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches:
66
- main
7-
- chore/simplify-project-architecture
7+
- feat/rabbitMQ
88

99
env:
1010
REGISTRY: ghcr.io
@@ -39,6 +39,18 @@ jobs:
3939
MONGODB_URI: ${{ secrets.MONGODB_URI }}
4040
NODE_ENV: production
4141

42+
- name: Set RabbitMQ Credentials
43+
run: |
44+
# Use localhost for GitHub Actions since we're running verification locally
45+
echo "RABBITMQ_PASSWORD=${{ secrets.RABBITMQ_PASSWORD }}" >> $GITHUB_ENV
46+
echo "RABBITMQ_URL=amqp://pulse_flow_user:${{ secrets.RABBITMQ_PASSWORD }}@localhost:5672" >> $GITHUB_ENV
47+
48+
- name: Verify RabbitMQ Connection
49+
run: npm run verify:rabbitmq
50+
env:
51+
RABBITMQ_URL: ${{ secrets.RABBITMQ_URL }}
52+
NODE_ENV: production
53+
4254
- name: Set up Docker Buildx
4355
uses: docker/setup-buildx-action@v3
4456

@@ -59,6 +71,8 @@ jobs:
5971
GRAFANA_PROMETHEUS_URL=${{ secrets.GRAFANA_PROMETHEUS_URL }}
6072
GRAFANA_USERNAME=${{ secrets.GRAFANA_USERNAME }}
6173
GRAFANA_API_KEY=${{ secrets.GRAFANA_API_KEY }}
74+
RABBITMQ_URL=${{ secrets.RABBITMQ_URL }}
75+
METRICS_PUSH_INTERVAL=60000
6276
EOL
6377
6478
- name: Build and push Docker image
@@ -92,6 +106,7 @@ jobs:
92106
GRAFANA_PROMETHEUS_URL: ${{ secrets.GRAFANA_PROMETHEUS_URL }}
93107
GRAFANA_USERNAME: ${{ secrets.GRAFANA_USERNAME }}
94108
GRAFANA_API_KEY: ${{ secrets.GRAFANA_API_KEY }}
109+
RABBITMQ_URL: ${{ secrets.RABBITMQ_URL }}
95110
GITHUB_REPOSITORY: ${{ github.repository }}
96111

97112
- name: Wait for app to start

.github/workflows/keep-alive.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Keep Alive
2+
3+
on:
4+
schedule:
5+
- cron: '*/10 * * * *' # Run every 10 minutes
6+
workflow_dispatch: # Manual trigger
7+
8+
jobs:
9+
ping:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Ping Application
13+
uses: actions/github-script@v7
14+
with:
15+
script: |
16+
const axios = require('axios');
17+
try {
18+
const response = await axios.get('https://pulse-flow.onrender.com/ping');
19+
console.log('Ping successful:', response.status);
20+
if (response.status !== 200) {
21+
throw new Error(`Unexpected status: ${response.status}`);
22+
}
23+
} catch (error) {
24+
console.error('Ping failed:', error.message);
25+
// Don't fail the workflow to avoid notifications
26+
// but log the error for monitoring
27+
}

.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,13 @@ docs/
5858
docs/drafts/
5959
*.draft.md
6060

61+
# Metrics and monitoring
62+
*.metrics
63+
*.prom
64+
65+
# TypeScript cache
66+
*.tsbuildinfo
67+
68+
# Render deployment
69+
.render/
70+

README.md

+33-38
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# [Still Under Development] PulseFlow - Real-Time Social Media Analytics Platform
1+
# [Under Development] PulseFlow - Real-Time Social Media Analytics Platform
22

33
## Overview
4-
Backend for real-time data processing and visualization platform built with enterprise-grade technologies. This project demonstrates advanced data simulation, monitoring, and analytics capabilities using modern DevOps practices.
4+
5+
PulseFlow is a backend platform designed for real-time data processing and visualization, leveraging enterprise-grade technologies. This project showcases advanced capabilities in data simulation, monitoring, and analytics, all built on modern DevOps practices
56

67
## Features
78
- Real-time social media data processing
@@ -17,43 +18,47 @@ Backend for real-time data processing and visualization platform built with ente
1718
- **Database**: MongoDB with Mongoose ODM
1819
- **Containerization**: Docker & Docker Compose
1920

20-
### Monitoring & Visualization
21-
- **Metrics**: Prometheus
22-
- **Dashboards**: Grafana
23-
- **Health Checks**: Custom endpoints with prometheus-client
21+
## Architecture Components
22+
- Microservices-based Design: Modular architecture for scalability and maintainability.
23+
- MongoDB Data Storage: Efficient and scalable data management.
24+
- Real-time Metrics Collection: Continuous monitoring of system performance.
25+
- Custom Dashboards: Visual insights through Grafana and MongoDB Charts.
26+
27+
### Message Queue Integration:
28+
- RabbitMQ with CloudAMQP: Utilizes a managed RabbitMQ service for distributed message processing.
29+
- Configuration: Secure, encrypted connections with elastic scaling.
30+
- Key Features: Reliable message queuing, automatic message routing, and error handling with dead-letter queues.
31+
- Message Flow: Synthetic tweet data is generated, published to RabbitMQ, processed asynchronously, and stored in MongoDB.
2432

2533
### CI/CD & DevOps
2634
- **Continuous Integration**: GitHub Actions
2735
- **Container Registry**: GitHub Container Registry
2836
- **Container Orchestration**: Docker Compose
2937

30-
### Architecture Components
31-
- Microservices-based design
32-
- MongoDB data storage
33-
- Real-time metrics collection
34-
- Custom dashboards
38+
## Monitoring Setup
3539

36-
### Monitoring Setup
37-
The application exports metrics in Prometheus format and pushes them to Grafana Cloud. A local monitoring stack is also available through Docker Compose.
3840

39-
#### Available Metrics
40-
- Tweet processing rate and duration
41-
- Sentiment analysis distribution
42-
- Platform usage statistics
43-
- Error rates and system health
44-
- API response times
41+
- **Metrics**: Prometheus
42+
- **Dashboards**: Grafana
43+
- **Health Checks**: Custom endpoints with prometheus-client
44+
- **MongoDB Charts**:
45+
46+
The application exports metrics in Prometheus format and pushes them to Grafana Cloud. A local monitoring stack is also available through Docker Compose.
4547

4648
# Dashboards
4749

50+
51+
**![>> **SOON** ~~Project Demo Gif~~ <<](public/demo.gif)**
52+
4853
### Grafana Performance Dashboard
4954
![Grafana Dashboard](public/GrafanaEx.png)
5055

51-
**[>> View LIVE Grafana Dashboard HERE <<](https://maxh33.grafana.net/public-dashboards/2f5dd656ee264fd2ac6f13f1aa1b4004)**
56+
**[>> **SOON** ~~View LIVE Grafana Dashboard HERE~~ <<](https://maxh33.grafana.net/public-dashboards/2f5dd656ee264fd2ac6f13f1aa1b4004)**
5257

5358
## MongoDB Charts Dashboard
5459
![MongoDB Charts Dashboard](public/MainMetrics.png)
5560

56-
**[>> View LIVE MongoDB Charts Dashboard HERE <<](https://charts.mongodb.com/charts-project-0-tmkdyjw/public/dashboards/6798e048-db1e-4c24-85a6-e942bec5d15f)**
61+
**[>> **SOON** ~~View LIVE MongoDB Charts Dashboard HERE~~ <<](https://charts.mongodb.com/charts-project-0-tmkdyjw/public/dashboards/6798e048-db1e-4c24-85a6-e942bec5d15f)**
5762

5863

5964
## Data Generation Methodology
@@ -81,24 +86,14 @@ The application exports metrics in Prometheus format and pushes them to Grafana
8186
### Disclaimer
8287
🚨 **Note**: All data is artificially generated and does not represent real social media interactions.
8388

84-
## Deployment Infrastructure
85-
86-
### Platform
87-
- **Hosting**: Render.com
88-
- **Deployment Type**: Web Service
89-
- **Continuous Deployment**: Enabled
90-
91-
### Render.com Configuration
92-
- Automatic GitHub repository synchronization
93-
- Node.js runtime environment
94-
- Scalable web service infrastructure
95-
- Built-in environment variable management
89+
## Deployment Infrastructure Workflow:
9690

97-
#### Deployment Workflow
98-
1. Code pushed to GitHub
99-
2. Render.com detects changes
100-
3. Automatic build and deployment
101-
4. Zero-downtime updates
91+
1. **Data Generation:** Synthetic tweets created with Chance.js.
92+
2. **Message Queuing:** Data published to RabbitMQ, ensuring reliable processing.
93+
3. **Data Storage:** Tweets stored in MongoDB for efficient access.
94+
4. **CI/CD:** Automated tests and deployment via GitHub Actions.
95+
5. **Hosting:** Application deployed on Render for scalability.
96+
6. **Monitoring:** Metrics collected and visualized in Grafana.
10297

10398
## Project Status & Quality Checks
10499

docker-compose.prod.yml

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ services:
4343
- NODE_ENV=production
4444
- PORT=3000
4545
- MONGODB_URI=${MONGODB_URI}
46+
- RABBITMQ_URL=${RABBITMQ_URL}
4647
healthcheck:
4748
test: ["CMD", "curl", "-f", "http://localhost:3000/healthz"]
4849
interval: 30s

package-lock.json

+117
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)