Skip to content
This repository has been archived by the owner on Dec 17, 2023. It is now read-only.

Commit

Permalink
feat: new project layout #9 and implemented NIP-42 for broadcasting #5
Browse files Browse the repository at this point in the history
  • Loading branch information
piraces committed Feb 3, 2023
1 parent cd37620 commit b9f452f
Show file tree
Hide file tree
Showing 25 changed files with 547 additions and 442 deletions.
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ VERSION=0.3.1
REPLAY_TO_RELAYS=false
RELAYS_TO_PUBLISH_TO=""
DEFAULT_WAIT_TIME_BETWEEN_BATCHES=60000
DEFAULT_WAIT_TIME_FOR_RELAY_RESPONSE=3000
MAX_EVENTS_TO_REPLAY=10
ENABLE_AUTO_NIP05_REGISTRATION=false
MAIN_DOMAIN_NAME=""
Expand Down
1 change: 1 addition & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
builds:
- id: rsslay-linux
main: ./cmd/rsslay
ldflags:
- -s -w -linkmode external -extldflags '-static' -X 'github.com/piraces/rsslay/pkg/version.BuildVersion={{.Version}}'
env:
Expand Down
12 changes: 7 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ COPY go.mod ./
COPY go.sum ./
RUN go mod download

COPY *.go ./
COPY assets/* ./assets/
COPY templates/* ./templates/
COPY schema.sql .
COPY cmd/ ./cmd/
COPY internal/ ./internal/
COPY pkg/ ./pkg/
COPY web/ ./web/
COPY scripts/ ./scripts/

RUN apk add --no-cache build-base

RUN CGO_ENABLED=1 go build -ldflags="-s -w -linkmode external -extldflags '-static'" -o /rsslay
RUN CGO_ENABLED=1 go build -ldflags="-s -w -linkmode external -extldflags '-static'" -o /rsslay cmd/rsslay/main.go

FROM alpine:latest

Expand All @@ -31,6 +32,7 @@ ENV VERSION=0.3.1
ENV REPLAY_TO_RELAYS=false
ENV RELAYS_TO_PUBLISH_TO=""
ENV DEFAULT_WAIT_TIME_BETWEEN_BATCHES=60000
ENV DEFAULT_WAIT_TIME_FOR_RELAY_RESPONSE=3000
ENV MAX_EVENTS_TO_REPLAY=10
ENV ENABLE_AUTO_NIP05_REGISTRATION=false
ENV MAIN_DOMAIN_NAME=""
Expand Down
12 changes: 7 additions & 5 deletions Dockerfile.fly
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ COPY go.mod ./
COPY go.sum ./
RUN go mod download

COPY *.go ./
COPY assets/* ./assets/
COPY templates/* ./templates/
COPY schema.sql .
COPY cmd/ ./cmd/
COPY internal/ ./internal/
COPY pkg/ ./pkg/
COPY web/ ./web/
COPY scripts/ ./scripts/

RUN apk add --no-cache build-base

RUN CGO_ENABLED=1 go build -ldflags="-s -w -linkmode external -extldflags '-static'" -tags osusergo,netgo -o /rsslay
RUN CGO_ENABLED=1 go build -ldflags="-s -w -linkmode external -extldflags '-static'" -tags osusergo,netgo -o /rsslay cmd/rsslay/main.go

FROM alpine:latest

Expand All @@ -33,6 +34,7 @@ ENV VERSION=0.3.1
ENV REPLAY_TO_RELAYS=false
ENV RELAYS_TO_PUBLISH_TO=""
ENV DEFAULT_WAIT_TIME_BETWEEN_BATCHES=60000
ENV DEFAULT_WAIT_TIME_FOR_RELAY_RESPONSE=3000
ENV MAX_EVENTS_TO_REPLAY=10
ENV ENABLE_AUTO_NIP05_REGISTRATION=false
ENV MAIN_DOMAIN_NAME=""
Expand Down
14 changes: 9 additions & 5 deletions Dockerfile.railwayapp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ARG SECRET
ARG REPLAY_TO_RELAYS
ARG RELAYS_TO_PUBLISH_TO
ARG DEFAULT_WAIT_TIME_BETWEEN_BATCHES
ARG DEFAULT_WAIT_TIME_FOR_RELAY_RESPONSE
ARG MAX_EVENTS_TO_REPLAY
ARG ENABLE_AUTO_NIP05_REGISTRATION
ARG MAIN_DOMAIN_NAME
Expand All @@ -19,14 +20,15 @@ COPY go.mod ./
COPY go.sum ./
RUN go mod download

COPY *.go ./
COPY assets/* ./assets/
COPY templates/* ./templates/
COPY schema.sql .
COPY cmd/ ./cmd/
COPY internal/ ./internal/
COPY pkg/ ./pkg/
COPY web/ ./web/
COPY scripts/ ./scripts/

RUN apk add --no-cache build-base

RUN CGO_ENABLED=1 go build -ldflags="-s -w -linkmode external -extldflags '-static'" -o /rsslay
RUN CGO_ENABLED=1 go build -ldflags="-s -w -linkmode external -extldflags '-static'" -o /rsslay cmd/rsslay/main.go

FROM alpine:latest

Expand All @@ -37,6 +39,7 @@ ARG SECRET
ARG REPLAY_TO_RELAYS
ARG RELAYS_TO_PUBLISH_TO
ARG DEFAULT_WAIT_TIME_BETWEEN_BATCHES
ARG DEFAULT_WAIT_TIME_FOR_RELAY_RESPONSE
ARG MAX_EVENTS_TO_REPLAY
ARG ENABLE_AUTO_NIP05_REGISTRATION
ARG MAIN_DOMAIN_NAME
Expand All @@ -57,6 +60,7 @@ ENV VERSION=0.3.1
ENV REPLAY_TO_RELAYS=false
ENV RELAYS_TO_PUBLISH_TO=""
ENV DEFAULT_WAIT_TIME_BETWEEN_BATCHES=60000
ENV DEFAULT_WAIT_TIME_FOR_RELAY_RESPONSE=3000
ENV MAX_EVENTS_TO_REPLAY=10
ENV ENABLE_AUTO_NIP05_REGISTRATION="false"
ENV MAIN_DOMAIN_NAME=""
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
relayer-rss-bridge: $(shell find . -name "*.go")
CC=$$(which musl-gcc) go build -ldflags="-s -w -linkmode external -extldflags '-static'" -o ./relayer-rss-bridge
CC=$$(which musl-gcc) go build -ldflags="-s -w -linkmode external -extldflags '-static'" -o ./relayer-rss-bridge cmd/rsslay/main.go
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
[![Publish Docker image](https://github.com/piraces/rsslay/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/piraces/rsslay/actions/workflows/docker-publish.yml)
![Docker Hub](https://img.shields.io/docker/pulls/piraces/rsslay?logo=docker)

[![Go Report Card](https://goreportcard.com/badge/github.com/piraces/rsslay)](https://goreportcard.com/report/github.com/piraces/rsslay)
[![Go Reference](https://pkg.go.dev/badge/github.com/piraces/rsslay.svg)](https://pkg.go.dev/github.com/piraces/rsslay)

**Relay that creates virtual nostr profiles for each RSS feed submitted**

**Working relay: `wss://rsslay.nostr.moe`. Frontend available in [rsslay.nostr.moe](https://rsslay.nostr.moe).**
Expand Down Expand Up @@ -76,6 +79,7 @@ _**Note:** it will create a local database file to store the currently known RSS
- `REPLAY_TO_RELAYS`: set to true if you want to send the fetched events to other relays defined in `RELAYS_TO_PUBLISH_TO` (default is false)
- `RELAYS_TO_PUBLISH_TO`: string with relays separated by `,` to re-publish events to in format `wss://[URL],wss://[URL2]` where `URL` and `URL2` are URLs of valid relays (default is empty)
- `DEFAULT_WAIT_TIME_BETWEEN_BATCHES`: default time to wait between sending batches of requests to other relays in milliseconds (default 60000, 60 seconds)
- `DEFAULT_WAIT_TIME_FOR_RELAY_RESPONSE`: default time to wait for relay response for possible auth event in milliseconds (default is 3000, 3 seconds).
- `MAX_EVENTS_TO_REPLAY`: maximum number of events to send to a relay in `RELAYS_TO_PUBLISH_TO` in a batch
- `ENABLE_AUTO_NIP05_REGISTRATION`: enables [NIP-05](https://github.com/nostr-protocol/nips/blob/master/05.md) automatic registration for all feed profiles in the format `[URL]@[MAIN_DOMAIN_NAME]` where URL is the main URL for the feed and `MAIN_DOMAIN_NAME` the below environment variable (default `false`)
- `MAIN_DOMAIN_NAME`: main domain name where this relay will be available (only for NIP-05 purposes if enabled with `ENABLE_AUTO_NIP05_REGISTRATION`)
Expand Down
Loading

0 comments on commit b9f452f

Please sign in to comment.