From 82046848178c46561ae1585c15c8dd2827c32d79 Mon Sep 17 00:00:00 2001 From: sandwich <299465+dskvr@users.noreply.github.com> Date: Tue, 23 Jan 2024 16:32:08 +0000 Subject: [PATCH] begin nocapd container, fix logger pkg, other minor fixes --- .gitignore | 2 +- apps/nocapd/.gitignore | 3 +- apps/nocapd/Dockerfile | 21 +++++++++++ apps/nocapd/docker-compose.yaml | 63 ++++++++++++++++++++++----------- apps/nocapd/package.json | 10 +++++- apps/trawler/package.json | 2 +- packages/logger/package.json | 6 ++-- 7 files changed, 79 insertions(+), 28 deletions(-) create mode 100644 apps/nocapd/Dockerfile diff --git a/.gitignore b/.gitignore index add95169..313bae90 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ yarn.lock *.wasm **/dist yarn-error.log -.env +.env* !*.sample .lmdb .redis diff --git a/apps/nocapd/.gitignore b/apps/nocapd/.gitignore index b5f7ca43..89c8785f 100644 --- a/apps/nocapd/.gitignore +++ b/apps/nocapd/.gitignore @@ -1,4 +1,5 @@ node_modules config.y*ml yarn.lock -.events \ No newline at end of file +.events +.env* \ No newline at end of file diff --git a/apps/nocapd/Dockerfile b/apps/nocapd/Dockerfile new file mode 100644 index 00000000..09a24475 --- /dev/null +++ b/apps/nocapd/Dockerfile @@ -0,0 +1,21 @@ +# Use an official Node.js runtime as a parent image, based on Alpine +FROM node:20-alpine + +RUN mkdir /app + +# Set the working directory in the container +WORKDIR /app + +# Copy the current directory contents into the container at /usr/src/app +COPY . . + +# RUN echo "registry=http://host.docker.internal:4873" > .npmrc + +# Install any needed packages specified in package.json +RUN yarn install --network-timeout 1000000 + +# Make port 3000 available to the world outside this container +# EXPOSE 3000 + +# Run the app when the container launches +CMD yarn launch \ No newline at end of file diff --git a/apps/nocapd/docker-compose.yaml b/apps/nocapd/docker-compose.yaml index ebe3d210..18b62da2 100644 --- a/apps/nocapd/docker-compose.yaml +++ b/apps/nocapd/docker-compose.yaml @@ -1,26 +1,47 @@ version: "3" services: - # nocapd: - # container_name: trawler - # restart: unless-stopped - # build: . - # volumes: - # - ./nocapd.config.yaml:/etc/@nostrwatch/nocapd/config.yaml - # - ./.lmdb:/app/.lmdb - # environment: - # DOCKER: 'yes' - # env_file: .env - cache: - image: redis:latest - restart: always - ports: - - '6379:6379' - volumes: - - ./.redis:/.data:rw - env_file: .env - command: redis-server --loglevel $REDIS_LOGLEVEL + nocapd: + container_name: nocapd + restart: unless-stopped + build: + context: . + args: + BUILDKIT_INLINE_CACHE: 0 + dockerfile: Dockerfile + volumes: + - /Users/sandwich/Develop/nostr-watch/.lmdb:/app/.lmdb:rw + - ./.env.docker:/app/.env:ro + - ./config.yaml:/app/config.yaml:ro + environment: + DOCKER: 'yes' + env_file: .env.docker + # depends_on: + # - cache + networks: + - trawlernet +# cache: +# image: redis:latest +# restart: always +# ports: +# - '6379:6379' +# volumes: +# - ./.redis:/.data:rw +# env_file: .env.docker +# command: redis-server +# healthcheck: +# test: ["CMD", "redis-cli", "ping"] +# interval: 10s +# timeout: 5s +# retries: 3 +# networks: +# - nocapdnet + volumes: lmdb: driver: local - cache: - driver: local \ No newline at end of file + cache: + driver: local + +networks: + trawlernet: + driver: bridge diff --git a/apps/nocapd/package.json b/apps/nocapd/package.json index 6b4374bb..ddd5b7ce 100644 --- a/apps/nocapd/package.json +++ b/apps/nocapd/package.json @@ -6,9 +6,17 @@ "license": "MIT", "dependencies": { "@nostr-fetch/adapter-nostr-tools": "0.14.1", + "@nostrwatch/controlflow": "^0.0.2", + "@nostrwatch/logger": "^0.0.2", + "@nostrwatch/nocap": "^0.1.7", + "@nostrwatch/nwcache": "^0.0.1", + "@nostrwatch/publisher": "^0.0.1", + "@nostrwatch/seed": "^0.0.1", + "@nostrwatch/utils": "^0.0.1", "chalk": "5.3.0", "nostr-fetch": "0.14.1", - "object-mapper": "6.2.0" + "object-mapper": "6.2.0", + "timestring": "^7.0.0" }, "scripts": { "launch": "node src/index.js" diff --git a/apps/trawler/package.json b/apps/trawler/package.json index 9844fa3e..2325aaef 100644 --- a/apps/trawler/package.json +++ b/apps/trawler/package.json @@ -11,7 +11,7 @@ "@nostr-fetch/adapter-nostr-tools": "0.13.1", "@nostrwatch/controlflow": "^0.0.2", "@nostrwatch/logger": "^0.0.1", - "@nostrwatch/nocap": "^0.1.5", + "@nostrwatch/nocap": "^0.1.7", "@nostrwatch/nwcache": "^0.0.1", "@nostrwatch/publisher": "^0.0.1", "@nostrwatch/seed": "^0.0.1", diff --git a/packages/logger/package.json b/packages/logger/package.json index 174ea516..a184ae29 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -1,10 +1,10 @@ { "name": "@nostrwatch/logger", - "version": "0.0.2", + "version": "0.0.3", "type": "module", "main": "index.js", "license": "MIT", "dependencies": { - "logger": "0.0.1" + "logging": "^3.3.0" } -} \ No newline at end of file +}