A tool for parsing traffic on the jetstream and applying a moderation workstream based on regexp based rules

Merge pull request #22 from skywatch-bsky/docker-compose

Adds a docker-compose file

authored by Scarnecchia and committed by GitHub f3dbfc14 6f2f2d71

Changed files
+43 -3
src
+34
compose.yaml
··· 1 + # This file is for setting up the Skywatch Automod service using Docker Compose. 2 + # 3 + # Before running `docker compose up`, you need to: 4 + # 1. Create a `.env` file with your configuration. See the README.md for details. 5 + # 2. (Optional but recommended) Create an empty `cursor.txt` file in this directory 6 + # to ensure Docker mounts a file, not a directory. 7 + # On Linux/macOS: touch cursor.txt 8 + # 9 + version: "3.8" 10 + 11 + services: 12 + automod: 13 + # Build the Docker image from the Dockerfile in the current directory. 14 + build: . 15 + container_name: skywatch-automod 16 + 17 + # Restart the container automatically if it stops unexpectedly. 18 + restart: unless-stopped 19 + 20 + # Expose the metrics server port to the host machine. 21 + ports: 22 + - "4100:4101" 23 + 24 + # Load environment variables from a .env file in the same directory. 25 + # This is where you should put your BSKY_HANDLE, BSKY_PASSWORD, etc. 26 + env_file: 27 + - .env 28 + 29 + # Mount a volume to persist the firehose cursor. 30 + # This links the `cursor.txt` file from your host into the container at `/app/cursor.txt`. 31 + # Persisting this file allows the automod to resume from where it left off 32 + # after a restart, preventing it from reprocessing old events or skipping new ones. 33 + volumes: 34 + - ./cursor.txt:/app/cursor.txt
+9 -3
src/main.ts
··· 52 52 }); 53 53 54 54 jetstream.on("open", () => { 55 - logger.info( 56 - `Connected to Jetstream at ${FIREHOSE_URL} with cursor ${jetstream.cursor} (${epochUsToDateTime(jetstream.cursor!)})`, 57 - ); 55 + if (jetstream.cursor) { 56 + logger.info( 57 + `Connected to Jetstream at ${FIREHOSE_URL} with cursor ${jetstream.cursor} (${epochUsToDateTime(jetstream.cursor)})`, 58 + ); 59 + } else { 60 + logger.info( 61 + `Connected to Jetstream at ${FIREHOSE_URL}, waiting for cursor...`, 62 + ); 63 + } 58 64 cursorUpdateInterval = setInterval(() => { 59 65 if (jetstream.cursor) { 60 66 logger.info(