Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ grpcio-tools==1.67.0
numpy==1.26.4
Pillow==11.0.0
python-decouple==3.8
requests==2.32.0
requests==2.32.3
ring==0.10.1
gunicorn==23.0.0
psycopg2==2.9.10
Expand All @@ -31,4 +31,4 @@ base91==1.0.1
nostr-sdk==0.35.1
pygeohash==3.0.1
asgiref == 3.8.1
secp256k1
secp256k1
38 changes: 37 additions & 1 deletion scripts/traditional/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,16 +262,52 @@ $ ra_reg escrow-pay RobotName
...
```

Production:
```
# edit .env setting LNVENDOR to either "CLN" or "LND"
DEVELOPMENT = False
TESTING = False
USE_TOR = True
LOG_TO_CONSOLE = False
LOGGER_LEVEL = "WARNING"
HOST_NAME = "coordinator_onion_address.onion"
HOST_NAME2 = "*"
ONION_LOCATION = "coordinator_onion_address.onion"

$ . venv/bin/activate

$ scripts/traditional/traditional-services postgres-setup

$ scripts/traditional/traditional-services postgres-database-production

$ scripts/traditional/traditional-services strfry-setup
$ scripts/traditional/traditional-services nginx-setup

# change commit_sha

$ scripts/traditional/traditional-services production
```

Update:
```
$ . venv/bin/activate

$ pip install -r requirements_dev.txt
$ pip install -r requirements.txt

$ scripts/generate_grpc.sh

# for testing:
# start just postgres and redis in an other window
$ scripts/traditional/traditional-services test

# in the main window
$ . scripts/traditional/regtest-nodes test

# for production:
# backup traditional folder
# update commit_sha
$ scripts/traditional/traditional-services production

# then for both testing and production, in the main window
$ python3 manage.py migrate
```
47 changes: 47 additions & 0 deletions scripts/traditional/strfry-sync-external
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/sh

_get_env_var() {
if ! env_var="$(dotenv -f ".env" get "$1" 2>/dev/null)"; then
echo "error: getting $1 from .env" >&2
return 1
fi
printf "%s\n" "$env_var"

return 0
}

# transform relative path into absolute and remove trailing slashes
_get_env_var_path() {
env_var="$(_get_env_var "$1")" || return "$?"
real_path="$(realpath -m "$env_var")" || return "$?"
printf "%s\n" "$real_path"

return 0
}

TRADITIONAL_SERVICES_DIR="$(_get_env_var_path "TRADITIONAL_SERVICES_DIR")" || return "$?"

STRFRY_DIR="$TRADITIONAL_SERVICES_DIR/strfry"

STRFRY_GIT_DIR="$(_get_env_var_path "STRFRY_GIT_DIR")" || return "$?"

strfry_bin="$STRFRY_GIT_DIR/strfry"

onion_url_list=$(cat << EOF
wss://nostr.satstralia.com
wss://relay.damus.io
wss://freelay.sovbit.host
EOF
)

while true; do
for onion_url in $onion_url_list; do
torsocks timeout 15s "$strfry_bin" \
--config "$STRFRY_DIR/strfry.conf" \
sync "$onion_url" \
--filter '{"kinds":[38383]}' \
--dir both
done

sleep 300
done
49 changes: 49 additions & 0 deletions scripts/traditional/strfry-sync-federation
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/sh

_get_env_var() {
if ! env_var="$(dotenv -f ".env" get "$1" 2>/dev/null)"; then
echo "error: getting $1 from .env" >&2
return 1
fi
printf "%s\n" "$env_var"

return 0
}

# transform relative path into absolute and remove trailing slashes
_get_env_var_path() {
env_var="$(_get_env_var "$1")" || return "$?"
real_path="$(realpath -m "$env_var")" || return "$?"
printf "%s\n" "$real_path"

return 0
}

TRADITIONAL_SERVICES_DIR="$(_get_env_var_path "TRADITIONAL_SERVICES_DIR")" || return "$?"

STRFRY_DIR="$TRADITIONAL_SERVICES_DIR/strfry"

STRFRY_GIT_DIR="$(_get_env_var_path "STRFRY_GIT_DIR")" || return "$?"

strfry_bin="$STRFRY_GIT_DIR/strfry"

onion_url_list=$(cat << EOF
ws://ngdk7ocdzmz5kzsysa3om6du7ycj2evxp2f2olfkyq37htx3gllwp2yd.onion/relay
ws://4t4jxmivv6uqej6xzx2jx3fxh75gtt65v3szjoqmc4ugdlhipzdat6yd.onion/relay
ws://mmhaqzuirth5rx7gl24d4773lknltjhik57k7ahec5iefktezv4b3uid.onion/relay
ws://otmoonrndnrddqdlhu6b36heunmbyw3cgvadqo2oqeau3656wfv7fwad.onion/relay
ws://librebazovfmmkyi2jekraxsuso3mh622avuuzqpejixdl5dhuhb4tid.onion/relay
EOF
)

while true; do
for onion_url in $onion_url_list; do
torsocks timeout 15s "$strfry_bin" \
--config "$STRFRY_DIR/strfry.conf" \
sync "$onion_url" \
--filter '{"kinds":[38383, 31986, 1059]}' \
--dir both
done

sleep 120
done
32 changes: 32 additions & 0 deletions scripts/traditional/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>
robosats
</title>
<style type="text/css">
body {
font-size: 16px;
margin: 40px auto;
padding: 0 10px;
max-width: 650px;
}
</style>
</head>
<body>
<header>
<h1>
Robosats
</h1>
</header>
<p>
robosats coordinator
</p>
<p>
available at /api
</p>
</body>
</html>
Loading