- Clone the repository:
git clone https://github.com/Data-Bishop/Messaging-System-With-RABBITMQ-and-CELERY.git
cd Messaging-System-With-RABBITMQ-and-CELERY
- Create and activate a virtual environment:
python3 -m venv venv
source venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
- Set up RabbitMQ and Redis locally.
- Configure Nginx:
- Edit /etc/nginx/sites-available/messaging_system
- Create a symlink in /etc/nginx/sites-enabled/
- Restart Nginx: sudo systemctl restart nginx
- Run the Flask application:
python3 app.py
- Start Celery worker:
celery -A celery_worker.celery worker --loglevel=info
- Set up ngrok: Ensure that you have completed the initial ngrok setup.
ngrok http 5000
-
Launch an EC2 instance (Ubuntu 20.04 LTS).
-
SSH into your EC2 instance:
ssh -i your-key-pair.pem ubuntu@your-ec2-public-dns
- 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
- Transfer project files:
scp -i your-key-pair.pem -r ./* ubuntu@your-ec2-public-dns:/home/ubuntu/messaging_system
- Set up the project environment:
cd messaging_system
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
- Configure Nginx:
- Edit /etc/nginx/sites-available/messaging_system
- Create symlink: sudo ln -s /etc/nginx/sites-available/messaging_system /etc/nginx/sites-enabled
- Test and restart Nginx:
sudo nginx -t
sudo systemctl restart nginx
- 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
- Start the Flask application:
nohup python3 app.py > app.log 2>&1 &
- Start Celery worker:
nohup celery -A celery_worker.celery worker --loglevel=info > celery.log 2>&1 &
- Set up ngrok:
ngrok config add-authtoken YOUR_AUTHTOKEN_HERE
nohup ngrok http 5000 | tee ngrok_output.log &
- Retrieve ngrok URL:
curl http://localhost:4040/api/tunnels