Server installation guide (#2091)

This commit is contained in:
rorp 2020-10-02 08:29:49 -07:00 committed by GitHub
parent 88f6759f5d
commit 1f4678afee

View File

@ -22,15 +22,89 @@ The native packager offers [numerous ways to package the project](https://github
In this example we are going to use `stage` which will produce bash scripts we can easily execute. You can stage the server with the following command.
```bash
$ sbt appServer/universal:stage
sbt appServer/universal:stage
```
This will produce a script to execute bitcoin-s which you can start with
```bash
$ ./app/server/target/universal/stage/bin/bitcoin-s-server
./app/server/target/universal/stage/bin/bitcoin-s-server
```
### Installation
#### Linux
For server side installation you'll need to install a Java Virtual Machine first.
```bash
sudo apt install openjdk-11-jdk-headless
```
Then build a Bitcoin-S server as described above and copy it into `/usr/local`:
```bash
sudo cp -r app/server/target/universal/stage /usr/local/bitcoin-s
sudo chmod +x /usr/local/bitcoin-s/bin/bitcoin-s-server
```
The server process will run in the background and use a separate user for security reasons.
This user does not have admin rights and cannot change the system configuration.
```bash
sudo adduser bitcoins
```
In this case you'll need to put the config file into `/home/bitcoins/.bitcoin-s/bitcoin-s.conf`.
To start the server as a daemon on system startup we'll need to configure a `systemd` service.
Create `bitcoin-s.service` file using your favorite text editor.
```bash
sudo nano /etc/systemd/system/bitcoin-s.service
```
Then copy this script into the editor, then save end exit.
```bash
[Unit]
Description=Bitcoin-S Node
After=network.target
[Service]
ExecStart=/usr/local/bitcoin-s/bin/bitcoin-s-server
User=bitcoins
Group=bitcoins
Type=simple
Restart=always
RestartSec=60
PrivateTmp=true
ProtectSystem=full
NoNewPrivileges=true
PrivateDevices=true
[Install]
WantedBy=multi-user.target
```
Enable the service:
```bash
sudo systemctl enable bitcoin-s.service
```
Start the server.
```bash
sudo systemctl start bitcoin-s.service
```
The server will write all logs into `/var/log/syslog`.
### Configuration
If you would like to pass in a custom datadir for your server, you can do