-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from blockpane/develop
more docs, attempt to fix 'go install' ... again.
- Loading branch information
Showing
10 changed files
with
165 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,168 @@ | ||
# Installing | ||
|
||
This documentation is incomplete. But will cover Docker, Systemd, and hopefully Akash options. For now ... | ||
* [Docker](#docker-container) | ||
* [Docker Compose](#docker-compose) | ||
* [Build From Source](#building-from-source) | ||
* [Systemd Service](#run-as-a-systemd-service-on-ubuntu) | ||
|
||
if you'd prefer to containerize and not build locally, you can: | ||
Contributions and corrections are welcomed here. Would be nice to add a section on Akash deployments too. | ||
|
||
``` | ||
## Docker Container | ||
|
||
```shell | ||
mkdir tenderduty && cd tenderduty | ||
docker run --rm ghcr.io/blockpane/tenderduty:latest -example-config >config.yml | ||
# edit config.yml and add chains, notification methods etc. | ||
docker run -d --name tenderduty -p "8888:8888" -p "28686:28686" --restart unless-stopped -v $(pwd)/config.yml:/var/lib/tenderduty/config.yml ghcr.io/blockpane/tenderduty:latest | ||
docker logs -f --tail 20 tenderduty | ||
``` | ||
|
||
Or if building from source: | ||
## Docker Compose | ||
|
||
```shell | ||
mkdir tenderduty && cd tenderduty | ||
|
||
cat > docker-compose.yml << EOF | ||
--- | ||
version: '3.2' | ||
services: | ||
v2: | ||
image: ghcr.io/blockpane/tenderduty:latest | ||
command: "" | ||
ports: | ||
- "8888:8888" # Dashboard | ||
- "28686:28686" # Prometheus exporter | ||
volumes: | ||
- home:/var/lib/tenderduty | ||
- ./config.yml:/var/lib/tenderduty/config.yml | ||
logging: | ||
driver: "json-file" | ||
options: | ||
max-size: "20m" | ||
max-file: "10" | ||
restart: unless-stopped | ||
volumes: | ||
home: | ||
EOF | ||
|
||
docker-compose pull | ||
docker run --rm ghcr.io/blockpane/tenderduty:latest -example-config >config.yml | ||
|
||
# Edit the config.yml file, and then start the container | ||
docker-compose up -d | ||
docker-compose logs -f --tail 20 | ||
``` | ||
|
||
## Building from source | ||
|
||
*Note: building tenderduty requires go v1.18 or later* | ||
|
||
### Installing Go | ||
|
||
If you intend to build from source, you will need to install Go. There are many choices on how to do this. **The most common method is to use the official installation instructions at [go.dev](https://go.dev/doc/install),** but there are a couple of shortcuts that can also be used: | ||
|
||
Ubuntu: | ||
```shell | ||
sudo apt-get install -y snapd | ||
sudo snap install go --classic | ||
``` | ||
|
||
MacOS: using [Homebrew](https://brew.sh) | ||
```shell | ||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | ||
brew install go | ||
``` | ||
|
||
### Building | ||
|
||
The fastest way is to just let go do all the work: | ||
|
||
```shell | ||
go install github.com/blockpane/tenderduty@latest | ||
~/go/bin/tenderduty -example-config > config.yml | ||
# edit config.yml | ||
~/go/bin/tenderduty | ||
``` | ||
|
||
If you want to hack on the source, it's easier to clone the repo: | ||
|
||
``` | ||
git clone https://github.com/blockpane/tenderduty | ||
cd tenderduty | ||
git checkout release/v2 | ||
cp example-config.yml config.yml | ||
# edit config.yml | ||
# edit config.yml with your favorite editor | ||
go get ./... | ||
go install | ||
~/go/bin/tenderduty | ||
go run main.go | ||
``` | ||
|
||
## Run as a systemd service on Ubuntu | ||
|
||
First, create a new user | ||
|
||
```shell | ||
sudo addgroup --system tenderduty | ||
sudo adduser --ingroup tenderduty --system --home /var/lib/tenderduty tenderduty | ||
``` | ||
|
||
Install Go: see [the instructions above](#installing-go). | ||
|
||
Install the binaries | ||
|
||
```shell | ||
sudo -su tenderduty | ||
cd ~ | ||
echo 'export PATH=$PATH:~/go/bin' >> .bashrc | ||
. .bashrc | ||
go install github.com/blockpane/tenderduty@latest | ||
tenderduty --example-config > config.yml | ||
# Edit the config.yml with your editor of choice | ||
exit | ||
``` | ||
|
||
Now create and enable the service | ||
|
||
```shell | ||
# Create the service file | ||
sudo tee /etc/systemd/system/tenderduty.service << EOF | ||
[Unit] | ||
Description=Tenderduty | ||
After=network.target | ||
ConditionPathExists=/var/lib/tenderduty/go/bin/tenderduty | ||
[Service] | ||
Type=simple | ||
Restart=on-failure | ||
RestartSec=120 | ||
TimeoutSec=180 | ||
User=tenderduty | ||
WorkingDirectory=/var/lib/tenderduty | ||
ExecStart=/var/lib/tenderduty/go/bin/tenderduty | ||
# there may be a large number of network connections if a lot of chains | ||
LimitNOFILE=infinity | ||
# extra process isolation | ||
NoNewPrivileges=true | ||
ProtectSystem=strict | ||
RestrictSUIDSGID=true | ||
LockPersonality=true | ||
PrivateUsers=true | ||
PrivateDevices=true | ||
PrivateTmp=true | ||
[Install] | ||
WantedBy=multi-user.target | ||
EOF | ||
|
||
# Enable and start the service | ||
sudo systemctl daemon-reload | ||
sudo systemctl enable tenderduty | ||
sudo systemctl start tenderduty | ||
|
||
# and to watch the logs, press CTRL-C to stop watching | ||
sudo journalctl -fu tenderduty | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module github.com/blockpane/tenderduty | ||
module github.com/blockpane/tenderduty/v2 | ||
|
||
go 1.18 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters