Change docker to docker compose, add ofelia docker-compose.yml example

This commit is contained in:
Jonathan Rosenbaum 2026-05-06 19:49:11 -04:00
parent 3b5ab748ae
commit 451e023b7a

View File

@ -174,7 +174,7 @@ docker compose up -d
### 3. Verify Container is Running ### 3. Verify Container is Running
```bash ```bash
docker ps | grep lwvwv-subscriber docker compose ps | grep lwvwv-subscriber
``` ```
## Usage ## Usage
@ -183,13 +183,13 @@ docker ps | grep lwvwv-subscriber
```bash ```bash
# Run the full workflow (downloads roster, converts, subscribes) # Run the full workflow (downloads roster, converts, subscribes)
docker exec lwvwv-subscriber /app/run-subscription.sh docker compose exec lwvwv-subscriber /app/run-subscription.sh
# With a specific CSV file (skips download) # With a specific CSV file (skips download)
docker exec lwvwv-subscriber /app/run-subscription.sh /path/to/members.csv docker compose exec lwvwv-subscriber /app/run-subscription.sh /path/to/members.csv
# Run subscribe-members.sh directly with env vars # Run subscribe-members.sh directly with env vars
docker exec lwvwv-subscriber /app/subscribe-members.sh /tmp/rosters/members.csv docker compose exec lwvwv-subscriber /app/subscribe-members.sh /tmp/rosters/members.csv
``` ```
### Scheduled Execution (via Ofelia) ### Scheduled Execution (via Ofelia)
@ -205,6 +205,48 @@ labels:
ofelia.job-exec.lwvwv-subscribe.schedule: "0 0 0,6,12,18 * * *" ofelia.job-exec.lwvwv-subscribe.schedule: "0 0 0,6,12,18 * * *"
``` ```
<details>
<summary>
```
docker-compose.yml for Ofelia job scheduler
```
</summary>
```
# This service provides ofelia, which is a job scheduler (cron).
#
# There should be at least on job in one of the services to make this
# meaningfull to run.
#
# It is accessible everywhere since it is bound to the docker socket.
# Cron jobs can be conveniently created with labels.
#
# https://github.com/mcuadros/ofelia
#
# When you add/change a cron job simply -
# docker compose restart
services:
ofelia:
container_name: ofelia
image: mcuadros/ofelia:latest
command: daemon --docker
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
```
</details>
### Standalone Usage (without Docker) ### Standalone Usage (without Docker)
The scripts also work outside Docker using positional arguments: The scripts also work outside Docker using positional arguments:
@ -221,13 +263,13 @@ CONNECTOR_PASSWORD=mypassword ./subscribe-members.sh members.csv
```bash ```bash
# View container logs # View container logs
docker logs lwvwv-subscriber docker compose logs lwvwv-subscriber
# Follow logs in real-time # Follow logs in real-time
docker logs -f lwvwv-subscriber docker compose logs -f lwvwv-subscriber
# View Ofelia scheduler logs # View Ofelia scheduler logs in Ofelia directory
docker logs ofelia docker compose logs ofelia
``` ```
## Troubleshooting ## Troubleshooting
@ -249,7 +291,7 @@ If you see errors like `CONNECTOR_URL not set`:
1. Check that `../env` exists and contains the variable 1. Check that `../env` exists and contains the variable
2. Verify the entrypoint is parsing it correctly: 2. Verify the entrypoint is parsing it correctly:
```bash ```bash
docker exec lwvwv-subscriber env | grep CONNECTOR docker compose exec lwvwv-subscriber env | grep CONNECTOR
``` ```
### Manual CSV Subscription ### Manual CSV Subscription
@ -260,7 +302,7 @@ To subscribe members without downloading:
cp members.csv automation/rosters/ cp members.csv automation/rosters/
# Run with specific file # Run with specific file
docker exec lwvwv-subscriber /app/run-subscription.sh /tmp/rosters/members.csv docker compose exec lwvwv-subscriber /app/run-subscription.sh /tmp/rosters/members.csv
``` ```
## Network Requirements ## Network Requirements