Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Implement lighthouse beacon service #394

Merged
merged 3 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Docs: Add Lighthouse Beacon Getting Started
  • Loading branch information
scottbot95 committed Oct 9, 2023
commit 38632b6355beae85e75df1cb93ee0e5a87da936d
84 changes: 84 additions & 0 deletions docs/getting-started/running-lighthouse-beacon.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Running Lighthouse Beacon

One or more [Lighthouse Beacon](https://lighthouse-book.sigmaprime.io/intro.html) services can be configured with the `services.ethereum.lighthouse-beacon` prefix.

```nix title="server.nix"
{ pkgs, ...}: {
services.ethereum.lighthouse-beacon.sepolia = {
enable = true;
openFirewall = true;
args = {
network = "sepolia"; # (Optional) defaults to beacon name
execution-jwt = secrets.lighthouse_jwt_secret.path;
checkpoint-sync-url = "https://sepolia.checkpoint-sync.ethdevops.io";
genesis-state-url = "https://sepolia.checkpoint-sync.ethdevops.io";
};
http-address = "0.0.0.0";
};

services.ethereum.lighthouse-beacon.goerli = {
enable = true;
...
};
}
```

**Note:** It is recommended to use an attribute name that matches the network that Lighthouse Beacon is configured for.

## Configuration

Many of Lighthouse Beacon's process arguments have been mapped to NixOS types and can be provided via the `args` section of the config.
For a detailed list please refer to the [NixOS Options](../reference/module-options/lighthouse-beacon.md) reference.

Additional arguments can be provided in a list directly to the Lighthouse Beacon process via the `extraArgs` attribute as shown above.

## Systemd service

For each instance that is configured a corresponding [Systemd](https://systemd.io/) service is created. The service name
follows a convention of `lighthouse-beacon-${name}.service`.

| Config | Name | Service name |
| :-------------------------------------------- | :------ | :---------------------------------- |
| `services.ethereum.lighthouse-beacon.sepolia` | sepolia | `lighthouse-beacon-sepolia.service` |
| `services.ethereum.lighthouse-beacon.goerli` | goerli | `lighthouse-beacon-goerli.service` |
| `services.ethereum.lighthouse-beacon.mainnet` | mainnet | `lighthouse-beacon-mainnet.service` |

The service that is created can then be introspected and managed via the standard Systemd toolset.

| Action | Command |
| :------ | :---------------------------------------------------- |
| Status | `systemctl status lighthouse-beacon-sepolia.service` |
| Stop | `systemctl stop lighthouse-beacon-sepolia.service` |
| Start | `systemctl start lighthouse-beacon-sepolia.service` |
| Restart | `systemctl restart lighthouse-beacon-sepolia.service` |
| Logs | `journalctl -xefu lighthouse-beacon-sepolia.service` |

## Using a Lighthouse Beacon fork

A different version of Lighthouse Beacon can be configured via the [package](../reference/module-options/lighthouse-beacon.md#servicesethereumlighthouse-beaconnamepackage) option.

To configure a custom fork for example:

```nix title="server.nix"
{ pkgs, ...}: {
services.ethereum.lighthouse-beacon.sepolia = {
enable = true;
package = pkgs.my-lighthouse-beacon;
...
};
}
```

## Opening ports

By default, [openFirewall](../reference/module-options/lighthouse-beacon.md#servicesethereumlighthouse-beaconnameopenfirewall) is set to `false`.
If set to `true` firewall rules are added which will expose the following ports:

| Protocol | Config | Default value |
| :------- | :------------------------------------------------------------------------------------------------------------------------- | :------------ |
| UDP | [discovery-port](../reference/module-options/lighthouse-beacon.md#servicesethereumlighthouse-beaconnameargsdiscovery-port) | 9000 |
| UDP/TCP | [quic-port](../reference/module-options/lighthouse-beacon.md#servicesethereumlighthouse-beaconnameargsquic-port) | 9001 |
| TCP | [http-port](../reference/module-options/lighthouse-beacon.md#servicesethereumlighthouse-beaconnameargshttp-port) | 5052 |

**Note:** it is important when running multiple instances of Lighthouse Beacon on the same machine that you ensure they are configured
with different ports.
2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ nav:
- getting-started/installation.md
- getting-started/running-geth.md
- getting-started/running-prysm-beacon.md
- getting-started/running-lighthouse-beacon.md
- getting-started/backup-and-restore.md
- Reference:
- NixOS Module Options:
Expand All @@ -74,6 +75,7 @@ nav:
- reference/module-options/geth-bootnode.md
- reference/module-options/nethermind.md
- reference/module-options/prysm-beacon.md
- reference/module-options/lighthouse-beacon.md

extra:
homepage: https://nix-community.github.io/ethereum.nix
Expand Down