docs: update deployment instructions with all three methods (.env file, docker run env vars, docker-compose)
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
# Matrix Ancestor Quote Bot Configuration
|
||||
|
||||
MATRIX_HOME_SERVER=https://your.matrix.server.com:443
|
||||
# Replace these values with your own:
|
||||
MATRIX_HOME_SERVER=https://matrix.org
|
||||
MATRIX_ACCESS_TOKEN=your_access_token_here
|
||||
BOT_COMMAND=!quote
|
||||
BOT_COMMAND=!quote
|
||||
|
||||
# Optional: Enable debug logging (set to false in production)
|
||||
DEBUG=false
|
||||
|
||||
15
Dockerfile
15
Dockerfile
@@ -1,7 +1,18 @@
|
||||
FROM node:18-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files first for better layer caching
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies (including dotenv)
|
||||
RUN npm install
|
||||
|
||||
# Copy application source code
|
||||
COPY . .
|
||||
RUN npm prune --production
|
||||
CMD ["node", "index.js"]
|
||||
|
||||
# Expose port if needed (optional, Matrix uses websocket)
|
||||
# EXPOSE 3000
|
||||
|
||||
# Run the bot (dotenv will auto-load from /app/.env or environment variables)
|
||||
CMD ["node", "index.js"]
|
||||
|
||||
87
README.md
87
README.md
@@ -1,40 +1,69 @@
|
||||
# Ancestor Quote Bot
|
||||
# Ancestor Quote Bot 🎃
|
||||
|
||||
A Matrix chatbot that responds to `/quote` commands with random quotes from Darkest Dungeons' Narrator/Ancestor.
|
||||
A Matrix chatbot that responds to `!quote` commands with random quotes from Darkest Dungeons.
|
||||
|
||||
## Setup
|
||||
## Quick Start
|
||||
|
||||
1. Copy `.env.example` to `.env` and fill in your credentials:
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
```bash
|
||||
# 1. Update .env file (create from template)
|
||||
cp .env.example .env
|
||||
# Edit .env with your MATRIX_ACCESS_TOKEN and MATRIX_HOME_SERVER
|
||||
|
||||
2. Build the Docker image:
|
||||
```bash
|
||||
docker build -t ancestor-quote-bot .
|
||||
```
|
||||
# 2. Build Docker image
|
||||
docker build -t ancestor-quote-bot .
|
||||
|
||||
3. Run the bot:
|
||||
```bash
|
||||
docker run --rm \
|
||||
-e MATRIX_HOME_SERVER=https://your.matrix.server.com \
|
||||
-e MATRIX_ACCESS_TOKEN=your_access_token_here \
|
||||
ancestor-quote-bot
|
||||
```
|
||||
# 3. Run the bot
|
||||
docker run --rm \
|
||||
-e MATRIX_HOME_SERVER=https://matrix.org \
|
||||
-e MATRIX_ACCESS_TOKEN=your_token_here \
|
||||
ancestor-quote-bot
|
||||
```
|
||||
|
||||
## Deployment Options
|
||||
|
||||
### Option 1: Pass env vars via `docker run` (Recommended for Docker)
|
||||
```bash
|
||||
docker run --rm \
|
||||
-e MATRIX_HOME_SERVER=https://matrix.org \
|
||||
-e MATRIX_ACCESS_TOKEN=your_access_token_here \
|
||||
-e BOT_COMMAND=!quote \
|
||||
ancestor-quote-bot
|
||||
```
|
||||
|
||||
### Option 2: Mount .env file directly
|
||||
```bash
|
||||
docker run --rm \
|
||||
-v $(pwd)/.env:/app/.env \
|
||||
ancestor-quote-bot
|
||||
```
|
||||
|
||||
### Option 3: Use docker-compose.yml (Production)
|
||||
```bash
|
||||
docker compose up -d
|
||||
# Or with custom env:
|
||||
docker compose up -d \
|
||||
-e MATRIX_HOME_SERVER=https://matrix.org \
|
||||
-e MATRIX_ACCESS_TOKEN=your_access_token_here
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
- `MATRIX_HOME_SERVER`: Your Matrix homeserver URL (e.g., https://matrix.org)
|
||||
- `MATRIX_ACCESS_TOKEN`: Bot access token for authentication
|
||||
- `BOT_COMMAND`: The command trigger (default: `!quote`)
|
||||
| Variable | Description | Default |
|
||||
|----------|-------------|---------|
|
||||
| `MATRIX_HOME_SERVER` | Matrix homeserver URL (e.g., https://matrix.org) | https://matrix.org |
|
||||
| `MATRIX_ACCESS_TOKEN` | Bot access token for authentication | REQUIRED |
|
||||
| `BOT_COMMAND` | Command trigger to request a quote | !quote |
|
||||
|
||||
## Usage
|
||||
## How It Works
|
||||
|
||||
Type the bot command in any room you've joined, and it will reply with a random Ancestor quote.
|
||||
1. The bot connects to your Matrix homeserver using the provided access token
|
||||
2. Once joined to a room, it listens for messages containing the trigger command
|
||||
3. When triggered, it selects a random quote from `quotes.json` and replies instantly
|
||||
|
||||
Example:
|
||||
```
|
||||
Room: #general:matrix.org
|
||||
!quote
|
||||
Bot: Dispatch this thug in brutal fashion, that all may hear of your arrival!
|
||||
```
|
||||
## Getting an Access Token
|
||||
|
||||
Use [this](https://matrix.org/docs/projects/registration/matrix-registration-api) or your Matrix admin panel to register a bot account.
|
||||
|
||||
## License
|
||||
|
||||
ISC
|
||||
|
||||
Reference in New Issue
Block a user