Zulip Bot Service
This is a Zulip bot service that provides AI-powered responses to user queries.
Running as a Service with PM2
The application can be set up to run as a background service using PM2, which ensures it starts automatically on system boot and restarts if it crashes.
Prerequisites
- Node.js and npm installed on your system
- PM2 installed globally (
npm install -g pm2) - Python 3.11+ and required dependencies
Installation
-
Make sure all required environment variables are set in your
.envfile:ZULIP_BOT_EMAIL=your-bot@example.com ZULIP_BOT_API_KEY=your-api-key ZULIP_SITE=https://your-zulip-instance.com OPENAI_API_KEY=your-openai-api-key -
Make the setup script executable:
chmod +x pm2_start.sh -
Run the setup script:
./pm2_start.sh -
The script will:
- Install PM2 if not already installed
- Start the bot as a background service
- Configure PM2 to run at system startup
- Provide instructions for any required sudo commands
Managing the Service
- Check status:
pm2 status - View logs:
pm2 logs zulip-bot - Restart:
pm2 restart zulip-bot - Stop:
pm2 stop zulip-bot - Start (if stopped):
pm2 start zulip-bot
Troubleshooting
If the service fails to start:
- Check logs for errors:
pm2 logs zulip-bot - Ensure all environment variables are properly set
- Verify that the Flask app works by running it directly:
./run_app.sh
Manual Setup
If you prefer to run the bot without PM2:
-
Activate the virtual environment:
source venv/bin/activate -
Run the Flask app:
./run_app.sh
Development
For development purposes, you can run the Flask app in debug mode:
export FLASK_APP=app
export FLASK_DEBUG=1
flask run --port=5100
Description
Languages
Python
92.4%
C++
4.2%
Cython
2%
C
0.7%
Jupyter Notebook
0.3%
Other
0.3%