From 7e83b0c3c200375e6683e46957b578557e9227a1 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 14 Jun 2018 21:13:09 +0000 Subject: [PATCH 1/7] whitespace --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4530d17..de0fae8 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "sni": "^1.0.0", "ws": "^5.1.1" }, - "engineStrict" : true, + "engineStrict": true, "engines": { "node": "10.2.1" } From 4a3a395c142d94026a49e7f4c7306c8c872141f7 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 14 Jun 2018 20:51:50 +0000 Subject: [PATCH 2/7] de-hard-code TELEBIT_RELAY_PATH --- installer/get.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/installer/get.sh b/installer/get.sh index db16649..4e9e17d 100644 --- a/installer/get.sh +++ b/installer/get.sh @@ -121,8 +121,8 @@ mkdir -p $my_tmp echo "sudo mkdir -p '$TELEBIT_RELAY_PATH'" sudo mkdir -p "$TELEBIT_RELAY_PATH" -echo "sudo mkdir -p '/opt/$my_app/etc'" -sudo mkdir -p "/opt/$my_app/etc/" +echo "sudo mkdir -p '$TELEBIT_RELAY_PATH/etc'" +sudo mkdir -p "$TELEBIT_RELAY_PATH/etc/" set +e #https://git.coolaj86.com/coolaj86/telebit-relay.js.git @@ -173,17 +173,17 @@ if [ -z "$(cat /etc/passwd | grep $my_user)" ]; then sudo adduser --home $TELEBIT_RELAY_PATH --gecos '' --disabled-password $my_user >/dev/null 2>&1 fi -if [ ! -f "/opt/$my_app/etc/$my_app.yml" ]; then +if [ ! -f "$TELEBIT_RELAY_PATH/etc/$my_app.yml" ]; then echo "### Creating config file from template. sudo may be required" - #echo "sudo rsync -a examples/$my_app.yml /opt/$my_app/etc/$my_app.yml" - sudo bash -c "echo 'email: $my_email' >> /opt/$my_app/etc/$my_app.yml" - sudo bash -c "echo 'secret: $my_secret' >> /opt/$my_app/etc/$my_app.yml" - sudo bash -c "echo 'servernames: [ $my_servername ]' >> /opt/$my_app/etc/$my_app.yml" - sudo bash -c "cat examples/$my_app.yml.tpl >> /opt/$my_app/etc/$my_app.yml" + #echo "sudo rsync -a examples/$my_app.yml $TELEBIT_RELAY_PATH/etc/$my_app.yml" + sudo bash -c "echo 'email: $my_email' >> $TELEBIT_RELAY_PATH/etc/$my_app.yml" + sudo bash -c "echo 'secret: $my_secret' >> $TELEBIT_RELAY_PATH/etc/$my_app.yml" + sudo bash -c "echo 'servernames: [ $my_servername ]' >> $TELEBIT_RELAY_PATH/etc/$my_app.yml" + sudo bash -c "cat $TELEBIT_RELAY_PATH/examples/$my_app.yml.tpl >> $TELEBIT_RELAY_PATH/etc/$my_app.yml" fi -echo "sudo chown -R $my_user '$TELEBIT_RELAY_PATH' '/opt/$my_app/etc'" -sudo chown -R $my_user "$TELEBIT_RELAY_PATH" "/opt/$my_app/etc" +echo "sudo chown -R $my_user '$TELEBIT_RELAY_PATH'" +sudo chown -R $my_user "$TELEBIT_RELAY_PATH" echo "### Adding $my_app is a system service" echo "sudo rsync -a $TELEBIT_RELAY_PATH/dist/etc/systemd/system/$my_app.service /etc/systemd/system/$my_app.service" @@ -202,7 +202,7 @@ echo "==============================================" echo " Privacy Settings in Config" echo "==============================================" echo "" -echo "The example config file /opt/$my_app/etc/$my_app.yml opts-in to" +echo "The example config file $TELEBIT_RELAY_PATH/etc/$my_app.yml opts-in to" echo "contributing telemetrics and receiving infrequent relevant updates" echo "(probably once per quarter or less) such as important notes on" echo "a new release, an important API change, etc. No spam." @@ -219,13 +219,13 @@ echo "==============================================" echo "" echo "Edit the config and restart, if desired:" echo "" -echo " sudo vim /opt/$my_app/etc/$my_app.yml" +echo " sudo vim $TELEBIT_RELAY_PATH/etc/$my_app.yml" echo " sudo systemctl restart $my_app" echo "" echo "Or disabled the service and start manually:" echo "" echo " sudo systemctl stop $my_app" echo " sudo systemctl disable $my_app" -echo " $my_app --config /opt/$my_app/etc/$my_app.yml" +echo " $my_app --config $TELEBIT_RELAY_PATH/etc/$my_app.yml" echo "" sleep 1 From 39b01fca47d751a66da40fb580599cf981eaf788 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 14 Jun 2018 21:19:27 +0000 Subject: [PATCH 3/7] rename telebitd => telebit-relay --- examples/{telebitd.yml => telebit-relay.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename examples/{telebitd.yml => telebit-relay.yml} (100%) diff --git a/examples/telebitd.yml b/examples/telebit-relay.yml similarity index 100% rename from examples/telebitd.yml rename to examples/telebit-relay.yml From 24b42e1ed9cc564d6ceffe40f488d21ddcd1e883 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 14 Jun 2018 21:21:48 +0000 Subject: [PATCH 4/7] manual install instructions for linux --- README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/README.md b/README.md index d0e6645..71eceef 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,37 @@ Windows & Node.js There is [a bug](https://github.com/nodejs/node/issues/20241) in node v9.x that causes telebit-relay to crash. +Manually Install +----------- + +```bash +git clone https://git.coolaj86.com/coolaj86/telebit-relay.js.git telebit-relay + +# we're very picky to due to bugs in various versions of v8, v9, and v10 +export NODEJS_VER="v10.2.1" + +# We can keep everything self-contained +export NPM_CONFIG_PREFIX=/opt/telebit-relay +export NODE_PATH=/opt/telebit-relay/lib/node_modules + +curl -fsSL https://bit.ly/node-installer | bash -s -- --no-dev-deps + +pushd /opt/telebit-relay + bin/node bin/npm install + rsync -a examples/telebit-relay.yml etc/telebit-relay.yml + rsync -a dist/etc/systemd/system/telebit-relay.service /etc/systemd/system/telebit-relay.service +popd + +# IMPORTANT: Season to taste +edit /opt/telebit-relay/etc/telebit-relay.yml + +systemctl daemon-reload +systemctl restart telebit-relay + +systemctl status telebit-relay +journalctl -xefu telebit-relay +``` + Usage ==== From 6cfad96323e94b31c74c99f2c930308ce9199932 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 14 Jun 2018 21:23:08 +0000 Subject: [PATCH 5/7] adduser telebit --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 71eceef..d3e8396 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,8 @@ popd # IMPORTANT: Season to taste edit /opt/telebit-relay/etc/telebit-relay.yml +adduser --home /opt/telebit-relay --gecos '' --disabled-password telebit >/dev/null 2>&1 + systemctl daemon-reload systemctl restart telebit-relay From 02c3836883508ad315c0b6d068ec953c7f850e25 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 14 Jun 2018 22:22:58 +0000 Subject: [PATCH 6/7] change user permissions --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d3e8396..49bd481 100644 --- a/README.md +++ b/README.md @@ -84,10 +84,12 @@ pushd /opt/telebit-relay rsync -a dist/etc/systemd/system/telebit-relay.service /etc/systemd/system/telebit-relay.service popd -# IMPORTANT: Season to taste +# IMPORTANT: Season the config file to taste +# IMPORTANT: change your email address and domain edit /opt/telebit-relay/etc/telebit-relay.yml adduser --home /opt/telebit-relay --gecos '' --disabled-password telebit >/dev/null 2>&1 +sudo chown -R telebit:telebit /opt/telebit-relay/ systemctl daemon-reload systemctl restart telebit-relay From f2cd8158f7d27e7c6ddbefc44548387e80d47198 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 15 Jun 2018 05:16:23 +0000 Subject: [PATCH 7/7] ignore node files --- .gitignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index 7184f26..271d15d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,10 @@ node_modules.* +include +bin/node +bin/npm +bin/npx +share +etc # Logs logs