···11+# This file is for setting up the Skywatch Automod service using Docker Compose.
22+#
33+# Before running `docker compose up`, you need to:
44+# 1. Create a `.env` file with your configuration. See the README.md for details.
55+# 2. (Optional but recommended) Create an empty `cursor.txt` file in this directory
66+# to ensure Docker mounts a file, not a directory.
77+# On Linux/macOS: touch cursor.txt
88+#
99+version: "3.8"
1010+1111+services:
1212+ automod:
1313+ # Build the Docker image from the Dockerfile in the current directory.
1414+ build: .
1515+ container_name: skywatch-automod
1616+1717+ # Restart the container automatically if it stops unexpectedly.
1818+ restart: unless-stopped
1919+2020+ # Expose the metrics server port to the host machine.
2121+ ports:
2222+ - "4100:4101"
2323+2424+ # Load environment variables from a .env file in the same directory.
2525+ # This is where you should put your BSKY_HANDLE, BSKY_PASSWORD, etc.
2626+ env_file:
2727+ - .env
2828+2929+ # Mount a volume to persist the firehose cursor.
3030+ # This links the `cursor.txt` file from your host into the container at `/app/cursor.txt`.
3131+ # Persisting this file allows the automod to resume from where it left off
3232+ # after a restart, preventing it from reprocessing old events or skipping new ones.
3333+ volumes:
3434+ - ./cursor.txt:/app/cursor.txt
+9-3
src/main.ts
···5252});
53535454jetstream.on("open", () => {
5555- logger.info(
5656- `Connected to Jetstream at ${FIREHOSE_URL} with cursor ${jetstream.cursor} (${epochUsToDateTime(jetstream.cursor!)})`,
5757- );
5555+ if (jetstream.cursor) {
5656+ logger.info(
5757+ `Connected to Jetstream at ${FIREHOSE_URL} with cursor ${jetstream.cursor} (${epochUsToDateTime(jetstream.cursor)})`,
5858+ );
5959+ } else {
6060+ logger.info(
6161+ `Connected to Jetstream at ${FIREHOSE_URL}, waiting for cursor...`,
6262+ );
6363+ }
5864 cursorUpdateInterval = setInterval(() => {
5965 if (jetstream.cursor) {
6066 logger.info(