dimaatmelodromru
4 years ago
committed by
GitHub
4 changed files with 534 additions and 118 deletions
@ -0,0 +1,80 @@ |
|||
## Using Docker on Raspberry Pi |
|||
|
|||
Install docker-compose: https://medium.com/@techiebouncer/install-docker-and-docker-compose-on-raspberry-pi-4-raspbian-buster-c5b78b9a0d08 |
|||
|
|||
Clone this repo. |
|||
``` |
|||
git clone https://github.com/stakwork/sphinx-relay.git |
|||
``` |
|||
|
|||
Copy your id_rsa to clone the private lnd-lean repo. |
|||
|
|||
``` |
|||
cp ~/.ssh/id_rsa . |
|||
``` |
|||
|
|||
Build it. |
|||
|
|||
``` |
|||
docker-compose build |
|||
``` |
|||
|
|||
Edit your docker-compose.yml file replacing NODE_IP and NODE_ALIAS. |
|||
|
|||
Relay will run on port 3000 local. You would need to point your router's port forwarding from 80 to 3000 to your docker machine. |
|||
|
|||
Start up LND separately first. |
|||
|
|||
``` |
|||
docker-compose up lnd |
|||
``` |
|||
|
|||
- In another terminal, go to the project folder and run. |
|||
|
|||
``` |
|||
docker-compose exec lnd bash |
|||
``` |
|||
|
|||
Once you're given a bash, run `ping lnd` and take note of the IP, this is because we need to tell Relay where lnd is via the IP, this is a temporary measure due to the limitation of the grpc connection can only be done via IP and not domain name. |
|||
|
|||
Edit your app.json file inside config and on the `production` key replace `node_ip` with the one from the ping. |
|||
|
|||
Run Relay. |
|||
|
|||
``` |
|||
docker-compose up node_server |
|||
``` |
|||
|
|||
Create / Unlock your wallet |
|||
|
|||
``` |
|||
docker-compose exec lnd lncli create |
|||
|
|||
docker-compose exec lnd lncli unlock |
|||
``` |
|||
|
|||
NOTE: All lncli commands need to be prepended with `docker-compose exec lnd`, this tells docker to execute **something** on the lnd container. |
|||
|
|||
|
|||
### Configure |
|||
|
|||
Make sure your LND is running with the `--accept-keysend` flag! If you are using lnd.conf file, add `accept-keysend=1`, if necessary |
|||
|
|||
Edit the "production" section of config/app.json: |
|||
- Change `macaroon_location` to the location of your LND admin macaroon |
|||
- Change `tls_location` to the location of your LND cert |
|||
|
|||
Edit the "production" section of config/config.json |
|||
- Update "storage" to point to where you want your DB file to live |
|||
|
|||
To connect to your app |
|||
- `export NODE_IP=x.x.x.x` (you can use a domain name instead if you have that set up) |
|||
- For extra security, `export USE_PASSWORD=true` |
|||
|
|||
### run |
|||
|
|||
`npm run prod` |
|||
|
|||
When Relay starts up, it will print a QR in the terminal. You can scan this in your app (Android & iOS) to connect! |
|||
|
|||
[Back to README](https://github.com/dimaatmelodromru/sphinx-relay/tree/docs-edit#connecting-a-mobile-client) |
@ -0,0 +1,298 @@ |
|||
# Deployment to myNode |
|||
|
|||
This guide is focused on installing Sphinx-relay on top of myNode. Information about myNode can be found at: https://mynodebtc.com/. |
|||
|
|||
### Preparations |
|||
|
|||
* Be able to connect with your node through SSH. |
|||
* Connect to myNode as `admin`: |
|||
```sh |
|||
$ ssh admin@mynode.local |
|||
``` |
|||
Use password `bolt` unless you have already changed it. |
|||
|
|||
### Install dependencies |
|||
|
|||
sqlite3: `$ sudo apt install sqlite3` |
|||
|
|||
python2 (if not present): `$ sudo apt install python2` |
|||
|
|||
### Open port 3001 on myNode |
|||
|
|||
Open up a console window with SSH. And login as root |
|||
```sh |
|||
$ sudo su |
|||
``` |
|||
Open up port 3001 on your machine and make sure it has been added to the list. |
|||
```sh |
|||
# ufw allow 3001 comment 'allow Sphinx-Chat' |
|||
# ufw status |
|||
|
|||
> Status: active |
|||
> |
|||
> To Action From |
|||
> -- ------ ---- |
|||
> 3001 (v6) ALLOW Anywhere (v6) # Sphinx-Chat |
|||
``` |
|||
|
|||
### Download |
|||
|
|||
login as user bitcoin. |
|||
```sh |
|||
$ sudo su bitcoin |
|||
$ cd |
|||
``` |
|||
Clone the repository from Github and install the package. |
|||
```sh |
|||
$ git clone https://github.com/stakwork/sphinx-relay |
|||
$ cd sphinx-relay |
|||
$ npm install |
|||
``` |
|||
|
|||
### Configure |
|||
|
|||
Edit the "production" section of config/app.json. |
|||
```sh |
|||
$ cd |
|||
$ cd sphinx-relay/config/ |
|||
$ nano app.json |
|||
``` |
|||
Change the following 4 lines: |
|||
|
|||
``` |
|||
"macaroon_location": "/home/bitcoin/.lnd/data/chain/bitcoin/mainnet/admin.macaroon", |
|||
"tls_location": "/mnt/hdd/mynode/lnd/tls.cert", |
|||
"lnd_log_location": "/home/bitcoin/.lnd/logs/bitcoin/mainnet/lnd.log", |
|||
``` |
|||
|
|||
Save and exit: |
|||
`Ctrl + X` |
|||
|
|||
`Y` |
|||
|
|||
`Enter` |
|||
|
|||
Edit the "production" section of config/config.json |
|||
```sh |
|||
$ nano config.json |
|||
``` |
|||
Change the following line to: |
|||
``` |
|||
"storage": "/home/bitcoin/sphinx.db" |
|||
``` |
|||
Save and exit: |
|||
`Ctrl + X` |
|||
|
|||
`Y` |
|||
|
|||
`Enter` |
|||
|
|||
#### If you want to use your Sphinx client within the same local network |
|||
|
|||
```sh |
|||
$ cd |
|||
$ cd sphinx-relay/config/ |
|||
$ export NODE_IP=x.x.x.x:3001 |
|||
``` |
|||
where `x.x.x.x` is the local IP address of the machine running your Sphinx-Relay on your local network. |
|||
|
|||
#### If you want to connect to your Sphinx-Relay from outside of your local network |
|||
|
|||
```sh |
|||
$ cd |
|||
$ cd sphinx-relay/config/ |
|||
$ export NODE_IP=x.x.x.x:3001 |
|||
``` |
|||
where `x.x.x.x` is the permanent public IP address of your router. |
|||
|
|||
Make sure that port 3001 forwarding is properly set up. |
|||
|
|||
For extra security: |
|||
```sh |
|||
$ export USE_PASSWORD=true |
|||
``` |
|||
|
|||
### Activate keysend |
|||
|
|||
We need LND to run with keysend activated. First, we check if it is already enabled on your node. |
|||
|
|||
Go to http://mynode.local/lnd/config and check if the line `accept-keysend=True` (or `accept-keysend=1`) is included somewhere in the text. |
|||
|
|||
If `accept-keysend=True` is already included you can continue without changing anything. If `accept-keysend=True` is not included, add it to a new line and click the `Save` button. This will restart your device. (Restarting could take up to several minutes but also hours, so be patient.) |
|||
|
|||
### Run |
|||
|
|||
Now it's time to run the software. |
|||
|
|||
```sh |
|||
$ cd |
|||
$ cd sphinx-relay/config/ |
|||
$ npm run prod |
|||
``` |
|||
When Relay starts up, it will print a QR in the terminal. You can scan this in your app (Android or iOS) to connect! |
|||
|
|||
### To make Relay run continuously (also after a restart). |
|||
|
|||
Before you start this part, make sure your app is connected and that you are able to send & receive messages. |
|||
|
|||
Login as admin. |
|||
```sh |
|||
$ sudo su admin |
|||
``` |
|||
Create a file named sphinx-relay.service |
|||
```sh |
|||
$ sudo nano /etc/systemd/system/sphinx-relay.service |
|||
``` |
|||
Copy and paste the following text to add it to the file: |
|||
```sh |
|||
[Unit] |
|||
Description=Sphinx Relay Service |
|||
After=network.target |
|||
|
|||
[Service] |
|||
Type=simple |
|||
User=bitcoin |
|||
WorkingDirectory=/home/bitcoin/sphinx-relay/config/ |
|||
ExecStart=npm run prod |
|||
Restart=always |
|||
RestartSec=5 |
|||
StandardOutput=syslog |
|||
StandardError=syslog |
|||
SyslogIdentifier=sphinx-relay |
|||
|
|||
[Install] |
|||
WantedBy=multi-user.target |
|||
``` |
|||
Save and exit: |
|||
`Ctrl + X` |
|||
|
|||
`Y` |
|||
|
|||
`Enter` |
|||
|
|||
Let's run! |
|||
```sh |
|||
$ sudo systemctl enable sphinx-relay |
|||
$ sudo systemctl start sphinx-relay |
|||
``` |
|||
Check if Relay successfully started. |
|||
```sh |
|||
$ sudo systemctl status sphinx-relay |
|||
``` |
|||
### To stop the program |
|||
|
|||
```sh |
|||
$ sudo systemctl stop sphinx-relay |
|||
``` |
|||
|
|||
# To update Sphinx-Relay |
|||
|
|||
> This probably is not the most efficient way to update. But it works, so we got that going, which is nice. Feel free to optimize the process and contribute. :) |
|||
|
|||
Login as `admin` and stop the program. |
|||
```sh |
|||
$ sudo systemctl stop sphinx-relay |
|||
``` |
|||
login as user `bitcoin`. |
|||
|
|||
```sh |
|||
$ sudo su bitcoin |
|||
$ cd |
|||
``` |
|||
## Remove the old version |
|||
|
|||
```sh |
|||
$ rm -rf sphinx-relay |
|||
``` |
|||
## Download the new version |
|||
|
|||
Clone the repository from Github and install the package. |
|||
```sh |
|||
$ git clone https://github.com/stakwork/sphinx-relay |
|||
$ cd sphinx-relay |
|||
$ npm install |
|||
``` |
|||
### Configure |
|||
|
|||
Edit the "production" section of config/app.json. |
|||
```sh |
|||
$ cd |
|||
$ cd sphinx-relay/config/ |
|||
$ nano app.json |
|||
``` |
|||
Change the following 4 lines: |
|||
|
|||
``` |
|||
"macaroon_location": "/home/bitcoin/.lnd/data/chain/bitcoin/mainnet/admin.macaroon", |
|||
"tls_location": "/mnt/hdd/mynode/lnd/tls.cert", |
|||
"lnd_log_location": "/home/bitcoin/.lnd/logs/bitcoin/mainnet/lnd.log", |
|||
"lncli_location": "/home/bitcoin/go/bin", |
|||
``` |
|||
|
|||
Save and exit: |
|||
`Ctrl + X` |
|||
|
|||
`Y` |
|||
|
|||
`Enter` |
|||
|
|||
Edit the "production" section of config/config.json |
|||
```sh |
|||
$ nano config.json |
|||
``` |
|||
Change the following line to: |
|||
``` |
|||
"storage": "/home/bitcoin/sphinx.db" |
|||
``` |
|||
Save and exit: |
|||
`Ctrl + X` |
|||
|
|||
`Y` |
|||
|
|||
`Enter` |
|||
|
|||
#### If you want to use your Sphinx client within the same local network |
|||
|
|||
```sh |
|||
$ cd |
|||
$ cd sphinx-relay/config/ |
|||
$ export NODE_IP=x.x.x.x:3001 |
|||
``` |
|||
where `x.x.x.x` is the local IP address of the machine running your Sphinx-Relay on your local network. |
|||
|
|||
#### If you want to connect to your Sphinx-Relay from outside of your local network |
|||
|
|||
```sh |
|||
$ cd |
|||
$ cd sphinx-relay/config/ |
|||
$ export NODE_IP=x.x.x.x:3001 |
|||
``` |
|||
where `x.x.x.x` is the permanent public IP address of your router. |
|||
|
|||
> Make sure that port 3001 forwarding is properly set up. |
|||
|
|||
For extra security: |
|||
```sh |
|||
$ export USE_PASSWORD=true |
|||
``` |
|||
### Turn on the service. |
|||
Login as admin. |
|||
```sh |
|||
$ su admin |
|||
``` |
|||
Or |
|||
```sh |
|||
$ exit |
|||
``` |
|||
Turn the service on and check the status. |
|||
```sh |
|||
$ sudo systemctl enable sphinx-relay |
|||
$ sudo systemctl start sphinx-relay |
|||
``` |
|||
|
|||
### tail logs |
|||
|
|||
`journalctl -u sphinx-relay -f` |
|||
|
|||
|
|||
[Back to README](https://github.com/dimaatmelodromru/sphinx-relay/tree/docs-edit#connecting-a-mobile-client) |
Loading…
Reference in new issue