Skip to content

This repository contains a setup and deployment guide for a messaging system using rabbitmq and celery

Notifications You must be signed in to change notification settings

Data-Bishop/Messaging-System-With-RABBITMQ-and-CELERY

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Messaging System With Rabbitmq and Celery - Setup and Deployment Guide (For ubuntu/linux machines)

License: MIT Maintenance

Local Setup

  1. Clone the repository:
git clone https://github.com/Data-Bishop/Messaging-System-With-RABBITMQ-and-CELERY.git
cd Messaging-System-With-RABBITMQ-and-CELERY
  1. Create and activate a virtual environment:
python3 -m venv venv
source venv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Set up RabbitMQ and Redis locally.
  2. Configure Nginx:
  • Edit /etc/nginx/sites-available/messaging_system
  • Create a symlink in /etc/nginx/sites-enabled/
  • Restart Nginx: sudo systemctl restart nginx
  1. Run the Flask application:
python3 app.py
  1. Start Celery worker:
celery -A celery_worker.celery worker --loglevel=info
  1. Set up ngrok: Ensure that you have completed the initial ngrok setup.
ngrok http 5000

AWS EC2 Deployment

  1. Launch an EC2 instance (Ubuntu 20.04 LTS).

  2. SSH into your EC2 instance:

ssh -i your-key-pair.pem ubuntu@your-ec2-public-dns
  1. Update and install dependencies:
sudo apt update && sudo apt upgrade -y
sudo apt install python3-pip python3-venv nginx rabbitmq-server redis-server -y
sudo snap install ngrok
  1. Transfer project files:
scp -i your-key-pair.pem -r ./* ubuntu@your-ec2-public-dns:/home/ubuntu/messaging_system
  1. Set up the project environment:
cd messaging_system
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
  1. Configure Nginx:
  • Edit /etc/nginx/sites-available/messaging_system
  • Create symlink: sudo ln -s /etc/nginx/sites-available/messaging_system /etc/nginx/sites-enabled
  1. Test and restart Nginx:
sudo nginx -t
sudo systemctl restart nginx
  1. Set up logging:
sudo touch /var/log/messaging_system.log
sudo chown ubuntu:ubuntu /var/log/messaging_system.log
sudo chmod 644 /var/log/messaging_system.log
  1. Start the Flask application:
nohup python3 app.py > app.log 2>&1 &
  1. Start Celery worker:
nohup celery -A celery_worker.celery worker --loglevel=info > celery.log 2>&1 &
  1. Set up ngrok:
ngrok config add-authtoken YOUR_AUTHTOKEN_HERE
nohup ngrok http 5000 | tee ngrok_output.log &
  1. Retrieve ngrok URL:
curl http://localhost:4040/api/tunnels

About

This repository contains a setup and deployment guide for a messaging system using rabbitmq and celery

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published