Release 1.0.0

This commit is contained in:
2026-03-12 21:45:01 +00:00
parent 28be3105b6
commit b2a9f74f59
12 changed files with 1028 additions and 522 deletions
+199 -102
View File
@@ -1,6 +1,4 @@
# Running with Docker Compose
This project includes Docker and Docker Compose configuration for easy deployment.
# Docker Deployment Guide
## Prerequisites
@@ -9,145 +7,244 @@ This project includes Docker and Docker Compose configuration for easy deploymen
## Quick Start
### 1. Copy Environment File
1. Copy environment template:
```bash
copy .env.example .env
```
```bash
copy .env.example .env
```
2. Edit `.env` with your Reddit credentials:
```env
REDDIT_CLIENT_ID=your_client_id
REDDIT_CLIENT_SECRET=your_client_secret
REDDIT_USERNAME=your_username
REDDIT_PASSWORD=your_password
SUBREDDIT=your_subreddit
```
### 2. Edit .env
3. Start the bot:
```bash
docker-compose up -d
```
Open `.env` and fill in your Reddit credentials:
4. Verify it's running:
```bash
docker-compose ps
```
5. View logs:
```bash
docker-compose logs -f
```
## Environment Variables
Required variables (in `.env`):
- REDDIT_CLIENT_ID - OAuth client ID from Reddit app
- REDDIT_CLIENT_SECRET - OAuth client secret
- REDDIT_USERNAME - Your Reddit account username
- REDDIT_PASSWORD - Your Reddit account password
- SUBREDDIT - Target subreddit name
Optional variables:
- REDDIT_RELEASE_TYPES - Comma-separated types (default: release)
- Examples: "release", "release,snapshot"
- REDDIT_CHECK_BEDROCK - Enable Bedrock Edition detection (default: false)
- Set to "true" or "false"
- REDDIT_CHECK_INTERVAL - Seconds between checks (default: 3600)
- Example: 600 for 10-minute checks
- REDDIT_WIKI_PAGE_NAME - Post template wiki page name (default: minecraft_update_bot)
- REDDIT_USER_AGENT - API user agent (default: MinecraftUpdateBot/1.0)
## Configuration File
Edit `.env` to control all behavior. Example with all options:
```env
REDDIT_CLIENT_ID=your_client_id
REDDIT_CLIENT_SECRET=your_client_secret
REDDIT_USERNAME=your_username
REDDIT_PASSWORD=your_password
SUBREDDIT=your_subreddit
REDDIT_CLIENT_ID=abc123
REDDIT_CLIENT_SECRET=xyz789
REDDIT_USERNAME=mybot
REDDIT_PASSWORD=botpass
SUBREDDIT=mysubreddit
REDDIT_RELEASE_TYPES=release,snapshot
REDDIT_CHECK_BEDROCK=true
REDDIT_CHECK_INTERVAL=3600
REDDIT_WIKI_PAGE_NAME=minecraft_update_bot
REDDIT_USER_AGENT=MinecraftUpdateBot/1.0
```
### 3. (Optional) Set Up Wiki Configuration
Create a wiki page on your subreddit named `minecraft_update_bot` with your post templates in YAML format. This allows different posts for releases, snapshots, etc.
See [WIKI_CONFIG.md](WIKI_CONFIG.md) for detailed instructions and examples.
### 4. Start the Bot
## Container Management
Start the bot:
```bash
docker-compose up -d
```
This will:
- Build the Docker image
- Start the bot in a container
- Persist data in a Docker volume named `minecraft-bot-db`
- Auto-restart the container if it crashes
### 5. View Logs
```bash
# Watch logs in real-time
docker-compose logs -f
# Or check status
docker-compose ps
```
### 5. Stop the Bot
Stop the bot:
```bash
docker-compose down
```
## Configuration
All configuration is done via the `.env` file. The following variables are available:
| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| `REDDIT_CLIENT_ID` | ✓ | - | Your Reddit app client ID |
| `REDDIT_CLIENT_SECRET` | ✓ | - | Your Reddit app secret |
| `REDDIT_USERNAME` | ✓ | - | Your Reddit username |
| `REDDIT_PASSWORD` | ✓ | - | Your Reddit password |
| `SUBREDDIT` | ✓ | - | Subreddit to post to |
| `RELEASE_TYPES` | | `release` | Comma-separated: `release,snapshot` |
| `CHECK_BEDROCK` | | `false` | Enable Bedrock Edition detection: `true` or `false` |
| `CHECK_INTERVAL` | | `3600` | Seconds between checks |
| `REDDIT_USER_AGENT` | | `MinecraftUpdateBot/1.0` | API user agent |
### Examples
**Check for both releases and snapshots:**
```env
RELEASE_TYPES=release,snapshot
```
**Check every 10 minutes (for testing):**
```env
CHECK_INTERVAL=600
```
## Data Persistence
The bot's database (list of posted versions) is stored in a Docker volume called `minecraft-bot-db`. This persists between container restarts.
To view the data:
Restart the bot:
```bash
docker volume inspect minecraft-bot-db
docker-compose restart
```
To reset the database (post all versions again):
```bash
docker volume rm minecraft-bot-db
```
## Building
To rebuild the image after code changes:
Rebuild after code changes:
```bash
docker-compose build --no-cache
docker-compose up -d
```
View logs:
```bash
docker-compose logs -f minecraftupdatebot
```
View specific log entries:
```bash
docker-compose logs minecraftupdatebot | grep "[BOT]"
```
## Data Persistence
The bot's version database persists in a Docker volume named `minecraft-bot-db`.
View volume details:
```bash
docker volume inspect minecraft-bot-db
```
The database file is located at `/app/DB/posted_versions.json` inside the container.
Reset the database (allows reposting all versions):
```bash
docker-compose down
docker volume rm minecraft-bot-db
docker-compose up -d
```
Check database contents from host:
```bash
docker run --rm -v minecraft-bot-db:/data alpine cat /data/posted_versions.json
```
## Wiki Configuration
The bot loads post templates from a subreddit wiki page (default name: minecraft_update_bot).
Create the wiki page on your subreddit with YAML configuration:
```yaml
release:
title: "Minecraft {version} Released"
body: |
New version available!
Version: {version}
Released: {release_date}
snapshot:
title: "Minecraft {version} Snapshot"
body: |
Test build available
Released: {release_date}
bedrock-windows:
title: "Bedrock Edition {version} Available"
body: |
Bedrock update available
Released: {release_date}
```
See WIKI_CONFIG.md for complete documentation.
## Monitoring
Check bot status:
```bash
docker-compose ps
```
Monitor logs in real-time:
```bash
docker-compose logs -f
```
Look for these status messages:
- [BOT] Successfully connected to Reddit
- [BOT] Started update checker
- [BOT] New Java release found
- [BOT] New Bedrock release found
- [BOT] Posted Minecraft
For errors, look for:
- [BOT] Error messages
- [BEDROCK_CHECKER] Error messages
- [CHAT] Error messages
## Troubleshooting
### Container won't start
Container won't start:
```bash
docker-compose logs
```
Check for missing credentials or configuration errors.
Check for configuration errors or missing credentials.
Reddit authentication fails:
- Verify credentials in .env are correct
- Check Reddit app still exists at https://www.reddit.com/prefs/apps
- Ensure the bot account has permission to post to the subreddit
### Reddit authentication error
No posts being made:
1. Check logs: `docker-compose logs -f`
2. Verify subreddit name in REDDIT_SUBREDDIT env var
3. Check database: `docker run --rm -v minecraft-bot-db:/data alpine cat /data/posted_versions.json`
4. Verify wiki configuration loaded: Look for "[WIKI_CONFIG] Loaded" in logs
- Verify your credentials in `.env`
- Check that your Reddit app still exists at https://www.reddit.com/prefs/apps
- Make sure your account can post to the subreddit
Bedrock detection not working:
- Ensure REDDIT_CHECK_BEDROCK is set to "true" in .env
- Check logs for minecraft.wiki scraping errors
- Bedrock detection requires internet access to minecraft.wiki
### No posts being made
Chat commands not working:
- Only subreddit moderators can send commands
- Send messages containing "reload-config" or "repost-latest"
- Check logs for [CHAT] messages
- Check the logs: `docker-compose logs -f`
- Verify the subreddit name in `.env`
- Check `docker exec minecraft-bot cat /app/DB/posted_versions.json` to see what's been posted
## Network Access
## Advanced Options
The bot requires:
- Reddit API connectivity (PRAW library)
- Minecraft launcher manifest (launchermeta.mojang.com)
- minecraft.wiki (for Bedrock detection if enabled)
- Update server (updts.slfhstd.uk for bot version checking)
### Custom Post Template
If behind a proxy, configure Docker networking accordingly.
Mount your config file to customize the post format:
## Performance
Edit `docker-compose.yml`:
```yaml
volumes:
- minecraft-bot-db:/app/DB
- ./config.py:/app/config.py # Uncomment this line
Default settings:
- Checks every 3600 seconds (1 hour)
- Allows 86400 seconds (24 hours) between update notifications
- Wiki config refreshes on each check (cached for 5 minutes)
For testing with faster checks:
```env
REDDIT_CHECK_INTERVAL=300
```
Then edit `config.py` locally to customize `POST_TEMPLATE`.
For production (less frequent):
```env
REDDIT_CHECK_INTERVAL=7200
```
## Security
Best practices:
- Never commit .env file with real credentials to version control
- .env is listed in .gitignore by default
- Use Reddit app credentials, not your personal account password if possible
- Restrict subreddit moderator permissions for bot accounts
- Review logs regularly for unauthorized access attempts
### Resource Limits