From f41c4f34054bbc21307723c3801fbec9f060ab37 Mon Sep 17 00:00:00 2001 From: Mikey Date: Sun, 17 Feb 2019 22:32:33 +1300 Subject: [PATCH 1/8] update to latest ssb-server (#19) --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 416814c..d2612aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ ENV PATH=/home/node/.npm-global/bin:$PATH ENV NPM_CONFIG_PREFIX=/home/node/.npm-global USER node -RUN npm install -g scuttlebot-release@13.0.0-2 +RUN npm install -g ssb-server@14.1.2 EXPOSE 8008 @@ -19,5 +19,5 @@ HEALTHCHECK --interval=30s --timeout=30s --start-period=10s --retries=10 \ CMD sbot whoami || exit 1 ENV HEALING_ACTION RESTART -ENTRYPOINT [ "/tini", "--", "sbot" ] -CMD [ "server" ] +ENTRYPOINT [ "/tini", "--", "ssb-server" ] +CMD [ "start" ] From 18c079c8adb177b9311282f12415155d1e3b734f Mon Sep 17 00:00:00 2001 From: Michael Williams Date: Mon, 18 Feb 2019 00:20:38 +1300 Subject: [PATCH 2/8] update config docs to match latest --- README.md | 72 +++++++++++++++++++++++++++++++++++++++++++++--------- install.sh | 31 +++++++++++++++++++++-- 2 files changed, 89 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 1c85837..93886cf 100644 --- a/README.md +++ b/README.md @@ -70,18 +70,37 @@ ssh root@your.ip.address.here > > point a domain name (example.com) to your pub server's IP address (using a DNS A record) > -> edit `./create-sbot` to change `host` definition to say `host=example.com` where `example.com` is your domain name. +> edit `~/ssb-pub-data/config` to change the `connections.incoming.net[].external` property from your server ip address to your domain name: > -> ```shell -> nano ./create-sbot +> ```json +> { +> "connections": { +> "incoming": { +> "net": [ +> { +> "scope": "public", +> "host": "0.0.0.0", +> "external": ["hostname.yourdomain.tld"] +> "transform": "shs", +> "port": 8008 +> } +> ] +> }, +> "outgoing": { +> "net": [ +> { +> "transform": "shs" +> } +> ] +> } +> } +> } > ``` > -> then stop, remove, and re-create sbot: +> then restart sbot: > > ```shell -> docker stop sbot -> docker rm sbot -> ./create-sbot +> docker restart sbot > ``` (credit to [seven1m/do-install-button](https://github.com/seven1m/do-install-button) for the Digital Ocean installer) @@ -140,7 +159,37 @@ chown -R 1000:1000 ~/ssb-pub-data > rsync -avz ~/ssb-pub-data/blobs/sha256/ $HOST:~/ssb-pub-data/blobs/sha256/ > ``` -#### step 2. run the container +#### step 2. setup ssb config + +```shell +EXTERNAL= + +cat > ~/ssb-pub-data/config < ./create-sbot < -memory_limit=$(($(free -b --si | awk '/Mem\:/ { print $2 }') - 200*(10**6))) +memory_limit="\$((\$(free -b --si | awk '/Mem\:/ { print $2 }') - 200*(10**6)))" docker run -d --name sbot \ -v ~/ssb-pub-data/:/home/node/.ssb/ \ - -e ssb_host="\$ssb_host" \ -p 8008:8008 \ --restart unless-stopped \ --memory "\$memory_limit" \ @@ -174,7 +221,7 @@ chmod +x ./create-sbot ./create-sbot ``` -#### step 3. create `./sbot` script +#### step 4. create `./sbot` script we will now create a shell script in `./sbot` to help us command our Scuttlebutt server running: @@ -307,5 +354,6 @@ for `healer` docker pull ahdinosaur/ssb-pub docker stop sbot docker rm sbot +# edit ~/ssb-pub-data/config if necessary ./create-sbot ``` diff --git a/install.sh b/install.sh index 7ba403b..1d786ae 100755 --- a/install.sh +++ b/install.sh @@ -26,6 +26,35 @@ docker pull ahdinosaur/ssb-pub mkdir ~/ssb-pub-data chown -R 1000:1000 ~/ssb-pub-data +# +# setup sbot config +# +EXTERNAL=$(dig +short myip.opendns.com @resolver1.opendns.com) +cat > ~/ssb-pub-data/config < ./create-sbot < Date: Mon, 18 Feb 2019 00:30:45 +1300 Subject: [PATCH 3/8] this is why my previous "test" failed --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 93886cf..7fd8f6e 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ from GitHub: ```shell git clone https://github.com/ahdinosaur/ssb-pub.git cd ssb-pub -docker build -t ssb-pub . +docker build -t ahdinosaur/ssb-pub . ``` ### create `sbot` container From d7ec624cace83608f5c013176824b8e7410fce30 Mon Sep 17 00:00:00 2001 From: Michael Williams Date: Mon, 18 Feb 2019 00:56:10 +1300 Subject: [PATCH 4/8] EOF yo --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7fd8f6e..4312b64 100644 --- a/README.md +++ b/README.md @@ -187,6 +187,7 @@ cat > ~/ssb-pub-data/config < Date: Mon, 18 Feb 2019 00:59:29 +1300 Subject: [PATCH 5/8] escape the town --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4312b64..e3732ae 100644 --- a/README.md +++ b/README.md @@ -198,7 +198,7 @@ create a `./create-sbot` script: cat > ./create-sbot < Date: Thu, 14 Mar 2019 14:41:47 +1300 Subject: [PATCH 6/8] use `ssb-server` command instead of `sbot` https://github.com/ahdinosaur/ssb-pub/pull/20#discussion_r264017364 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d2612aa..f5e4e30 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ RUN npm install -g ssb-server@14.1.2 EXPOSE 8008 HEALTHCHECK --interval=30s --timeout=30s --start-period=10s --retries=10 \ - CMD sbot whoami || exit 1 + CMD ssb-server whoami || exit 1 ENV HEALING_ACTION RESTART ENTRYPOINT [ "/tini", "--", "ssb-server" ] From afa6e85a306047b139addf5433c0cfc9131dd3eb Mon Sep 17 00:00:00 2001 From: Michael Williams Date: Thu, 14 Mar 2019 14:42:07 +1300 Subject: [PATCH 7/8] use latest `ssb-server` version https://github.com/ahdinosaur/ssb-pub/pull/20#discussion_r264017387 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f5e4e30..d47c442 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ ENV PATH=/home/node/.npm-global/bin:$PATH ENV NPM_CONFIG_PREFIX=/home/node/.npm-global USER node -RUN npm install -g ssb-server@14.1.2 +RUN npm install -g ssb-server@14.1.7 EXPOSE 8008 From fdc1589bbe6d737f212050bde8335467861ab30a Mon Sep 17 00:00:00 2001 From: Michael Williams Date: Thu, 14 Mar 2019 14:47:59 +1300 Subject: [PATCH 8/8] add documentation on upgrading --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index e3732ae..4fb44e3 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ easily host your own [Secure ScuttleButt (SSB)](https://www.scuttlebutt.nz) pub if you feel like sharing your pub, please add it to [the informal registry of pubs](https://github.com/ssbc/scuttlebot/wiki/Pub-Servers) as request-only or with a re-usable invite (`invite.create 1000`)! +(if you are running a v1 pub, [migrate to the latest v2!](#migrating-from-v1-to-v2) :tada: ) + :heart: ## table of contents @@ -19,7 +21,9 @@ if you feel like sharing your pub, please add it to [the informal registry of pu - [command and control](#command-and-control) - [create invites](#create-invites) - [stop, start, restart containers](#stop-start-restart-containers) +- [upgrading](#upgrading) - [update `ssb-pub` image](#update-ssb-pub-image) + - [migrating from v1 to v2](#migrating-from-v1-to-v2) ## one-click setup @@ -349,6 +353,8 @@ for `healer` - `docker start healer` - `docker restart healer` +## upgrading + ### update `ssb-pub` image ```shell @@ -358,3 +364,16 @@ docker rm sbot # edit ~/ssb-pub-data/config if necessary ./create-sbot ``` + +### migrating from `v1` to `v2` + +for a `v1` pub owner to update to the latest `v2` version of `ssb-pub`: + +1. pull the latest v2 image: `docker pull ahdinosaur/ssb-pub` +2. stop sbot container: `docker stop sbot` +3. remove sbot container: `docker rm sbot` +4. [create `~/ssb-pub-data/config`](#step-2-setup-ssb-config) +5. [re-create `./create-sbot`](#step-3-run-the-container) +6. `./create-sbot` + +check things are working with `docker logs sbot` and `./sbot whoami` :tada: