dockerize
This commit is contained in:
parent
1748432ddb
commit
4281aafc61
50
.dockerignore
Normal file
50
.dockerignore
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# Docker ignore file for discord-jellyseerr
|
||||||
|
|
||||||
|
# Python virtual environment
|
||||||
|
.venv/
|
||||||
|
venv/
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
*.so
|
||||||
|
.Python
|
||||||
|
env/
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
lib/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
|
||||||
|
# IDE files
|
||||||
|
.idea/
|
||||||
|
.vscode/
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
logs/
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Git files
|
||||||
|
.git/
|
||||||
|
.gitignore
|
||||||
|
|
||||||
|
# Docker files
|
||||||
|
.dockerignore
|
||||||
|
|
||||||
|
# Environment variables
|
||||||
|
# Don't ignore .env since we need it to run the bot
|
||||||
|
# but make sure not to commit it to version control
|
||||||
|
|
||||||
|
# OS specific
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
97
DOCKER.md
Normal file
97
DOCKER.md
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
# Docker Deployment for Discord-Jellyseerr Bot
|
||||||
|
|
||||||
|
This document contains instructions for deploying the Discord-Jellyseerr Bot using Docker.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- Docker installed on your host machine
|
||||||
|
- Docker Compose installed on your host machine
|
||||||
|
- A valid Discord bot token
|
||||||
|
- Access to a Jellyseerr instance
|
||||||
|
|
||||||
|
## Deployment Steps
|
||||||
|
|
||||||
|
### 1. Configure Environment Variables
|
||||||
|
|
||||||
|
Make sure your `.env` file is properly configured with the following variables:
|
||||||
|
|
||||||
|
```
|
||||||
|
# Discord Bot Token (required)
|
||||||
|
DISCORD_BOT_TOKEN=your_discord_bot_token_here
|
||||||
|
|
||||||
|
# Bot command prefix (default is !)
|
||||||
|
BOT_PREFIX=!
|
||||||
|
|
||||||
|
# Jellyseerr Configuration (required)
|
||||||
|
JELLYSEERR_URL=http://your-jellyseerr-instance:5055
|
||||||
|
JELLYSEERR_EMAIL=your_jellyseerr_email@example.com
|
||||||
|
JELLYSEERR_PASSWORD=your_jellyseerr_password
|
||||||
|
|
||||||
|
# Notification Settings
|
||||||
|
# Set to 'true' to enable notifications for these events
|
||||||
|
NOTIFY_REQUEST_APPROVED=true
|
||||||
|
NOTIFY_REQUEST_DECLINED=true
|
||||||
|
NOTIFY_MEDIA_AVAILABLE=true
|
||||||
|
|
||||||
|
# Notification Channel ID (leave empty to disable notifications)
|
||||||
|
NOTIFICATION_CHANNEL_ID=your_channel_id_here
|
||||||
|
|
||||||
|
# UI Settings
|
||||||
|
EMBED_COLOR=0x3498db
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Build and Deploy with Docker Compose
|
||||||
|
|
||||||
|
Run the following command in the project directory to build and start the bot:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
This will:
|
||||||
|
- Build the Docker image for the bot
|
||||||
|
- Start the container in detached mode
|
||||||
|
- Mount the project directory to the container
|
||||||
|
- Mount the logs directory for persistent logs
|
||||||
|
|
||||||
|
### 3. View Logs
|
||||||
|
|
||||||
|
You can view the logs of the running container with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose logs -f
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. Stop the Bot
|
||||||
|
|
||||||
|
To stop the bot, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose down
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. Update the Bot
|
||||||
|
|
||||||
|
To update the bot after making changes to the code:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose build
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
## Persistent Data
|
||||||
|
|
||||||
|
The Docker setup mounts the following directories for persistent data:
|
||||||
|
- The entire project directory for easy updates
|
||||||
|
- The logs directory to retain log files
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
If you encounter issues:
|
||||||
|
|
||||||
|
1. Check the logs using `docker-compose logs -f`
|
||||||
|
2. Verify your `.env` file has the correct credentials
|
||||||
|
3. Ensure your Discord bot token is valid
|
||||||
|
4. Confirm you can access your Jellyseerr instance from the Docker host
|
||||||
|
|
||||||
|
For authentication issues, verify that the Jellyseerr user account has the necessary permissions and that local authentication is enabled in Jellyseerr.
|
22
Dockerfile
Normal file
22
Dockerfile
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
FROM python:3.10-slim
|
||||||
|
|
||||||
|
# Set working directory
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||||
|
PYTHONUNBUFFERED=1 \
|
||||||
|
PYTHONFAULTHANDLER=1
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
COPY requirements.txt .
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
# Copy application code
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Create logs directory
|
||||||
|
RUN mkdir -p logs && chmod 777 logs
|
||||||
|
|
||||||
|
# Run the bot
|
||||||
|
CMD ["python", "main.py"]
|
37
README.md
37
README.md
@ -12,6 +12,8 @@ This Discord bot integrates with Jellyseerr to provide commands for searching, r
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
### Standard Installation
|
||||||
|
|
||||||
1. Clone this repository:
|
1. Clone this repository:
|
||||||
```
|
```
|
||||||
git clone https://github.com/yourusername/discord-jellyseerr.git
|
git clone https://github.com/yourusername/discord-jellyseerr.git
|
||||||
@ -46,11 +48,33 @@ This Discord bot integrates with Jellyseerr to provide commands for searching, r
|
|||||||
./run.sh
|
./run.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Docker Installation
|
||||||
|
|
||||||
|
1. Clone this repository:
|
||||||
|
```
|
||||||
|
git clone https://github.com/yourusername/discord-jellyseerr.git
|
||||||
|
cd discord-jellyseerr
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Copy the `.env.example` file to `.env` and edit it with your configuration:
|
||||||
|
```
|
||||||
|
cp .env.example .env
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Edit the `.env` file with your Discord bot token and Jellyseerr API details as shown above.
|
||||||
|
|
||||||
|
4. Build and run using Docker Compose:
|
||||||
|
```
|
||||||
|
docker compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
For more detailed Docker deployment instructions, see [DOCKER.md](DOCKER.md).
|
||||||
|
|
||||||
## Setting up the Discord Bot
|
## Setting up the Discord Bot
|
||||||
|
|
||||||
1. Go to the [Discord Developer Portal](https://discord.com/developers/applications)
|
1. Go to the [Discord Developer Portal](https://discord.com/developers/applications)
|
||||||
2. Create a new application and set up a bot
|
2. Create a new application and set up a bot
|
||||||
4. Enable the following Privileged Gateway Intents:
|
3. Enable the following Privileged Gateway Intents:
|
||||||
- MESSAGE CONTENT INTENT
|
- MESSAGE CONTENT INTENT
|
||||||
4. Invite the bot to your server with the following permissions:
|
4. Invite the bot to your server with the following permissions:
|
||||||
- Send Messages
|
- Send Messages
|
||||||
@ -101,6 +125,17 @@ This bot does not handle notifications, as the native webhook integration provid
|
|||||||
|
|
||||||
Contributions are welcome! Please feel free to submit a Pull Request.
|
Contributions are welcome! Please feel free to submit a Pull Request.
|
||||||
|
|
||||||
|
## Deployment Options
|
||||||
|
|
||||||
|
### Standard Deployment
|
||||||
|
Run the bot directly on your system with Python. This is simple for testing but requires you to manage dependencies and keep the process running.
|
||||||
|
|
||||||
|
### Docker Deployment
|
||||||
|
Deploy the bot as a Docker container for better isolation and easier management. The Docker setup includes:
|
||||||
|
- Containerized environment with all dependencies
|
||||||
|
- Volume mounting for persistent logs
|
||||||
|
- Automatic restarts if the bot crashes
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
This project is licensed under the MIT License - see the LICENSE file for details.
|
This project is licensed under the MIT License - see the LICENSE file for details.
|
22
docker-compose.yml
Normal file
22
docker-compose.yml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
discord-jellyseerr:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
container_name: discord-jellyseerr
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- ./:/app
|
||||||
|
- ./logs:/app/logs
|
||||||
|
environment:
|
||||||
|
- TZ=UTC
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
networks:
|
||||||
|
- discord-jellyseerr-network
|
||||||
|
|
||||||
|
networks:
|
||||||
|
discord-jellyseerr-network:
|
||||||
|
driver: bridge
|
Loading…
x
Reference in New Issue
Block a user