2025-06-30 20:29:55 +02:00
# Lemmy Poster
A Laravel application for posting articles to Lemmy platforms.
## Docker Deployment
### Building the Image
```bash
docker build -t your-registry/lemmy-poster:latest .
docker push your-registry/lemmy-poster:latest
```
### Docker Compose
Create a `docker-compose.yml` file:
```yaml
services:
app-web:
image: your-registry/lemmy-poster:latest
command: ["web"]
ports:
- "8000:8000"
environment:
2025-06-30 21:28:15 +02:00
- DB_DATABASE=${DB_DATABASE}
- DB_USERNAME=${DB_USERNAME}
2025-06-30 20:29:55 +02:00
- DB_PASSWORD=${DB_PASSWORD}
- LEMMY_INSTANCE=${LEMMY_INSTANCE}
- LEMMY_USERNAME=${LEMMY_USERNAME}
- LEMMY_PASSWORD=${LEMMY_PASSWORD}
- LEMMY_COMMUNITY=${LEMMY_COMMUNITY}
depends_on:
- mysql
volumes:
- storage_data:/var/www/html/storage/app
restart: unless-stopped
app-queue:
image: your-registry/lemmy-poster:latest
command: ["queue"]
environment:
2025-06-30 21:28:15 +02:00
- DB_DATABASE=${DB_DATABASE}
- DB_USERNAME=${DB_USERNAME}
2025-06-30 20:29:55 +02:00
- DB_PASSWORD=${DB_PASSWORD}
- LEMMY_INSTANCE=${LEMMY_INSTANCE}
- LEMMY_USERNAME=${LEMMY_USERNAME}
- LEMMY_PASSWORD=${LEMMY_PASSWORD}
- LEMMY_COMMUNITY=${LEMMY_COMMUNITY}
depends_on:
- mysql
volumes:
- storage_data:/var/www/html/storage/app
restart: unless-stopped
mysql:
image: mysql:8.0
environment:
2025-06-30 21:28:15 +02:00
- MYSQL_DATABASE=${DB_DATABASE}
- MYSQL_USER=${DB_USERNAME}
2025-06-30 20:29:55 +02:00
- MYSQL_PASSWORD=${DB_PASSWORD}
2025-06-30 21:28:15 +02:00
- MYSQL_ROOT_PASSWORD=${DB_PASSWORD}
2025-06-30 20:29:55 +02:00
volumes:
- mysql_data:/var/lib/mysql
restart: unless-stopped
volumes:
mysql_data:
storage_data:
```
### Environment Variables
Create a `.env` file with:
```env
2025-06-30 21:28:15 +02:00
# Database Settings
DB_DATABASE=lemmy_poster
DB_USERNAME=lemmy_user
DB_PASSWORD=your-password
# Lemmy Settings
2025-06-30 20:29:55 +02:00
LEMMY_INSTANCE=your-lemmy-instance.com
LEMMY_USERNAME=your-lemmy-username
LEMMY_PASSWORD=your-lemmy-password
LEMMY_COMMUNITY=your-target-community
```
### Deployment
2025-06-30 21:28:15 +02:00
1. Build and push the image to your registry
2025-06-30 20:29:55 +02:00
2. Copy the docker-compose.yml to your server
3. Create the .env file with your environment variables
4. Run: `docker-compose up -d`
2025-06-30 21:28:15 +02:00
The application will automatically:
- Wait for the database to be ready
- Run database migrations on first startup
- Start the queue worker after migrations complete
- Handle race conditions between web and queue containers
2025-06-30 20:29:55 +02:00
The web interface will be available on port 8000, ready for CloudFlare tunnel configuration.
2025-06-30 21:28:15 +02:00
### Architecture
The application uses a multi-container setup:
- **app-web**: Serves the Laravel web interface and handles HTTP requests
- **app-queue**: Processes background jobs (article fetching, Lemmy posting)
- **mysql**: Database storage for articles, logs, and application data
Both app containers use the same Docker image but with different commands (`web` or `queue` ). Environment variables are passed from your `.env` file to configure database access and Lemmy integration.