Skip to content

Commit

Permalink
v0.38.2.1
Browse files Browse the repository at this point in the history
Add support for local nostr relay
  • Loading branch information
hzrd149 committed Feb 7, 2024
1 parent 79ff55c commit 069d6cc
Show file tree
Hide file tree
Showing 12 changed files with 102 additions and 40 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/buildService.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: Build Service
on:
workflow_dispatch:
pull_request:
paths-ignore: ['*.md']
branches: ['main', 'master']
paths-ignore: ["*.md"]
branches: ["main", "master"]
push:
paths-ignore: ['*.md']
branches: ['main', 'master']
paths-ignore: ["*.md"]
branches: ["main", "master"]

jobs:
BuildPackage:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/releaseService.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Release Service
on:
push:
tags:
- 'v*.*'
- "v*.*"

jobs:
ReleasePackage:
Expand Down
18 changes: 15 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
# syntax=docker/dockerfile:1
FROM node:20 as builder

WORKDIR /app
COPY ./nostrudel /app/

# Copy package files and install dependencies
COPY ./nostrudel/package*.json ./
COPY ./nostrudel/yarn.lock ./
RUN yarn install --frozen-lockfile --production=false

# Copy application files
COPY ./nostrudel .

# Build
ENV VITE_COMMIT_HASH=""
ENV VITE_APP_VERSION="Start9-OS"
RUN yarn install && yarn build
RUN yarn build

FROM nginx:stable-alpine-slim

RUN apk update && \
apk add --no-cache yq && \
rm -rf /var/cache/apk/*

EXPOSE 8080
COPY --from=builder /app/dist /usr/share/nginx/html

Expand Down
36 changes: 29 additions & 7 deletions docker_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
#!/bin/sh
set -e

echo
cat /root/start9/config.yaml

CACHE_RELAY_ENABLED=$(yq '.enable-cache-relay' /root/start9/config.yaml)
#CACHE_RELAY=$(yq '.cache-relay' /root/start9/config.yaml)
CACHE_RELAY=nostr.embassy:8080

PROXY_PASS_BLOCK=""
if [ -n "$CACHE_RELAY" ] && [ "$CACHE_RELAY_ENABLED" = "true" ]; then
echo "Cache relay set to $CACHE_RELAY"
sed -i 's/CACHE_RELAY_ENABLED = false/CACHE_RELAY_ENABLED = true/g' /usr/share/nginx/html/index.html
PROXY_PASS_BLOCK="$PROXY_PASS_BLOCK
location /local-relay {
proxy_pass http://$CACHE_RELAY/;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "upgrade";
}
"
else
echo "No cache relay set"
fi

echo "Starting noStrudel ..."
echo

CONF_FILE="/etc/nginx/conf.d/default.conf"
NGINX_CONF='server {
NGINX_CONF="server {
listen 80;
return 301 https://$host$request_uri;
return 301 https://\$host\$request_uri;
}
server {
Expand All @@ -18,6 +38,9 @@ server {
ssl_certificate_key /mnt/cert/main.key.pem;
server_name localhost;
merge_slashes off;
$PROXY_PASS_BLOCK
root /usr/share/nginx/html;
index index.html index.htm;
Expand Down Expand Up @@ -53,15 +76,14 @@ server {
text/xml;
location / {
try_files $uri $uri/ /index.html;
try_files \$uri \$uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
'
}"
echo "$NGINX_CONF" > $CONF_FILE

_term() {
Expand Down
7 changes: 5 additions & 2 deletions instructions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
## Using noStrudel

*Connecting to your own private relay is not supported yet*

- Click `launch UI` to access your personal noStrudel client
- Create a new account or access an existing account by using a nip-07 browser extension or pasting in your private key. If creating a new account, be sure to securely back up the private key, preferably using Vaultwarden on your Start9 server

## Using your local nostr relay (optional)

If you have Nostr RS Relay installed you can enable the "Use local relay for caching" option to use it as a cache.
It must be set to "Public" mode. otherwise it will only cache your events
37 changes: 24 additions & 13 deletions manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Example written in yaml (toml and json are also acceptable)
# Docs: https://docs.start9.com/0.3.5.x/developer-docs/specification/dependencies#advanced-configuration

# The package identifier used by the OS. This must be unique amongst all other known packages
id: nostrudel
# A human readable service title
# A human readable service title
title: "noStrudel"
# Service version - accepts up to four digits, where the last confirms to revisions necessary for StartOS - see documentation: https://github.com/Start9Labs/emver-rs. This value will change with each release of the service.
version: 0.38.1.0
version: 0.38.2.1
# Release notes for the update - can be a string, paragraph or URL
release-notes: ->
- Support for nsecbunker and the new OAuth flow
- Added simple "Launchpad" view (most stuff will be added in the future)
- Restore scroll position when returning to the timeline
- Show unavailable events in threads
- Organized all the "other stuff" in a tools page
- Added support to cache events in local relays instead of the browsers cache
- And a ton more, read them all in the https://github.com/hzrd149/nostrudel/blob/master/CHANGELOG.md#0380 changelog
- Support for nsecbunker and the new OAuth flow
- Added simple "Launchpad" view (most stuff will be added in the future)
- Restore scroll position when returning to the timeline
- Show unavailable events in threads
- Organized all the "other stuff" in a tools page
- Added support to cache events in local relays instead of the browsers cache
- And a ton more, read them all in the https://github.com/hzrd149/nostrudel/blob/master/CHANGELOG.md#0380 changelog

# The type of license for the project. Include the LICENSE in the root of the project directory. A license is required for a Start9 package.
license: mit
Expand Down Expand Up @@ -80,7 +80,11 @@ health-checks:
name: Web UI
success-message: noStrudel is ready
type: script
config: ~
config:
get:
type: script
set:
type: script
properties: ~
# type: script
# This denotes any data, asset, or pointer volumes that should be connected when the "docker run" command is invoked
Expand All @@ -100,7 +104,7 @@ interfaces:
# A descriptive description of what the interface does
description: A user interface that is expected to host noStrudel web app.
tor-config:
# Port mappings are from the external port to the internal container port
# Port mappings are from the external port to the internal container port
port-mapping:
80: "80"
443: "3443"
Expand All @@ -115,7 +119,14 @@ interfaces:
protocols:
- tcp
- http
dependencies: {}
dependencies:
nostr:
version: ">0.8.0"
critical: true
requirement:
type: "opt-in"
how: Can use the browser cache or local relay
description: Optionally used to cache events
# Specifies how backups should be run for this service. The default StartOS provided option is to use the duplicity backup library on a system image (compat)
backup:
create:
Expand Down
2 changes: 1 addition & 1 deletion scripts/deps.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from "https://deno.land/x/[email protected]/mod.ts";
export * from "https://deno.land/x/[email protected]/util.ts";
export * from "https://deno.land/x/[email protected]/util.ts";
18 changes: 17 additions & 1 deletion scripts/procedures/getConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,20 @@

import { compat, types as T } from "../deps.ts";

export const getConfig: T.ExpectedExports.getConfig = compat.getConfig({});
export const getConfig: T.ExpectedExports.getConfig = compat.getConfig({
"enable-cache-relay": {
name: "Use local relay for caching",
description: "Enables",
type: "boolean",
default: false,
},
"cache-relay": {
name: "Cache Relay",
description: "A local relay to use for caching events",
type: "pointer",
subtype: "package",
"package-id": "nostr",
target: "lan-address",
interface: "websocket",
},
});
4 changes: 2 additions & 2 deletions scripts/procedures/healthChecks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { types as T, healthUtil } from "../deps.ts";

export const health: T.ExpectedExports.health = {
"web-ui": healthUtil.checkWebUrl("http://nostrudel.embassy:8080/index.html")
}
"web-ui": healthUtil.checkWebUrl("http://nostrudel.embassy:8080/index.html"),
};
2 changes: 1 addition & 1 deletion scripts/procedures/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ export const main = async (effects: T.Effects) => {
// args defaulted to [] - not necessary to include if empty
await effects.runDaemon({ command: "docker_entrypoint.sh", args: [] }).wait();
return util.ok;
}
};
4 changes: 2 additions & 2 deletions scripts/procedures/migrations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { compat, types as T } from "../deps.ts";

export const migration: T.ExpectedExports.migration = compat.migrations
.fromMapping({}, "0.38.1.0" );
export const migration: T.ExpectedExports.migration =
compat.migrations.fromMapping({}, "0.38.2.1");
4 changes: 1 addition & 3 deletions scripts/procedures/setConfig.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// This is where any configuration rules related to the configuration would go. These ensure that the user can only create a valid config.

import { compat, } from "../deps.ts";
import { compat } from "../deps.ts";

export const setConfig = compat.setConfig;

0 comments on commit 069d6cc

Please sign in to comment.