- Celestia Salt Deployment
- Prerequisites
- Automation Overview
- Step-by-Step Installation Instructions
- Failover Setup
- Upgrade Operations
- Contribution
This repository provides an automated solution for installing Celestia App (celestia-appd) and Celestia Node (celestia-bridge) using SaltStack. The deployment process supports both the mainnet and testnet (Mocha) versions.
- Flexible Configuration: Manage Celestia settings through the
celestia_config.slsfile located in the Salt pillar folder. - Modular Installation: Independent processes for deploying
celestia-appdandcelestia-bridge. - Optimized Syncing: Snapshot integration to accelerate blockchain node synchronization.
- Ease of Maintenance: Structured Salt states for improved clarity and updates.
- Failover option: When backup nodes (
celestia-appdandcelestia-bridge) are deployed.
Ensure that your SaltStack environment is properly configured.
- Copy
celestia_config.slsto your Salt pillar folder. - Update
top.slsin the pillar directory to includecelestia_configunder the base environment:
base:
'*':
- celestia_configThis guide explains how to configure Salt grains to automatically determine whether the testnet or mainnet version should be installed on a minion. By setting the celestia grain, Salt states can dynamically adapt and apply the appropriate configuration based on the grain value.
To assign the testnet value to the celestia grain for a specific minion, use the following command:
sudo salt <minion> grains.append celestia testnetTo remove the testnet value from the celestia grain, use the following command:
sudo salt <minion> grains.remove celestia testnetPlace the repository files in the directory: celestia.
- Run the following command to refresh the Salt pillar data:
sudo salt '*' saltutil.refresh_pillarNote: Any changes made to celestia_config.sls require a pillar refresh.
The deployment process includes two main components:
- Celestia-Appd: Installs and configures the blockchain application node.
- Celestia-Bridge: Installs and configures the bridge node.
Important
These states do not modify iptables or UFW rules for security reasons. Please use your own implementation for this.
The celestia-appd installation process includes these steps:
- A new Linux user is created with a home folder and shell.
- The
celestia-apprepository is cloned from GitHub. - The binary is installed and moved to
<home_folder>/bin. - The cloned repository is cleaned up.
- The
celestia-appd.servicefile is created and configured. - The systemd daemon is reloaded.
- The service is initialized.
- The genesis file is downloaded.
- Seed nodes are updated.
- The
~/.celestia-app/config/config.tomlfile is updated. - A blockchain snapshot is downloaded from
snapshots.bwarelabs.com.
- A new wallet is created, with keys saved at
~/celestia_keys/validator_key_output.txt.
- The
celestia-appdservice is started. - Logs are saved in the
celestia_logs/directory:celestia-appd-status.logcelestia-appd-journal.log
These steps are grouped together in deploy_celestia_appd.sls:
$ cat deploy_celestia_appd.sls
include:
- celestia.modules.modules.common.check_grains
- celestia.modules.modules.common.create_user
- celestia.modules.modules.common.install_pkg
- celestia.modules.celestia_appd.install_celestia_appd
- celestia.modules.celestia_appd.update_celestia_appd_config
- celestia.modules.celestia_appd.get_celestia_appd_snapshot
- celestia.modules.celestia_appd.celestia_app_wallet
- celestia.modules.celestia_appd.start_celestia_appdThe celestia-bridge installation process includes these steps:
- A new Linux user is created with a home folder and shell.
- The
celestia-bridgerepository is cloned from GitHub. - The binary and
cel-keyfile are moved to<home_folder>/bin. - The repository is cleaned up.
- The
celestia-bridge.servicefile is created and configured. - The systemd daemon is reloaded.
- The
celestia bridge initcommand generates keys saved in~/celestia_keys/bridge_key.txt.
- The
~/.celestia-app/config/config.tomlfile is updated for consensus-bridge connectivity.
- The
celestia-bridgeservice is started. - Logs are saved in the
celestia_logs/directory:celestia-bridge-status.logcelestia-bridge-journal.log
These steps are grouped together in deploy_celestia_bridge.sls:
$ cat deploy_celestia_bridge.sls
include:
- celestia.modules.modules.common.check_grains
- celestia.modules.modules.common.create_user
- celestia.modules.modules.common.install_pkg
- celestia.modules.celestia_bridge.install_celestia_node
- celestia.modules.celestia_bridge.connect_consensus_bridge
- celestia.modules.celestia_bridge.start_celestia_bridgeBefore deploying the services, validate your Salt environment by running the following commands with the test=True flag:
sudo salt <minion_name> state.apply celestia.deploy_celestia_appd test=True
sudo salt <minion_name> state.apply celestia.deploy_celestia_bridge test=TrueIf the commands execute successfully, your Salt environment is ready for deployment.
Once validation is complete, deploy the Celestia node by running:
sudo salt <minion_name> state.apply celestia.deploy_celestia_appdOnce validation is complete, deploy the Celestia bridge by running:
sudo salt <minion_name> state.apply celestia.deploy_celestia_bridgeFor users running two independent instances of celestia-appd or celestia-bridge, follow these steps:
Copy the following files to the Salt server under the keys/appd folder:
.celestia-app/config/priv_validator_key.json
.celestia-app/config/node_key.jsonCopy the keys directory from .celestia-bridge-mocha-4/keys/ to the Salt server under the keys/bridge/keys/ folder.
celestia/active$ ls -lR
.:
total 8
drwxrwxr-x 2 salt salt 4096 Dec 27 17:21 celestia-appd
drwxrwxr-x 3 salt salt 4096 Dec 27 17:30 celestia-bridge
./celestia-appd:
total 8
-rwxrwx--- 1 salt salt 148 Nov 27 16:29 node_key.json
-rwxrwx--- 1 salt salt 345 Nov 27 16:29 priv_validator_key.json
./celestia-bridge:
total 4
drwxr-xr-x 3 salt salt 4096 Nov 27 20:53 keys
./celestia-bridge/keys:
total 12
drwx------ 2 salt salt 4096 Nov 27 20:52 keyring-test
-rw------- 1 salt salt 55 Nov 27 20:53 NJ3XILLTMSFWWSXEZLUFZVHO5A
-rw------- 1 salt salt 103 Nov 27 20:53 OASSSDFFLLLMV4Q
./celestia-bridge/keys/keyring-test:
total 8
-rw------- 1 salt salt 546 Nov 27 20:52 181c0c722752a17e6b13c666f7734ce1i1ksmc1.address
-rw------- 1 salt salt 760 Nov 27 20:52 my_celes_key.infoTo verify the failover configuration, use the test=True flag with these commands:
sudo salt <current_server> state.apply celestia.backup_bridge test=True
sudo salt <current_server> state.apply celestia.backup_app test=Truesudo salt <backup_server> state.apply celestia.active_app test=True
sudo salt <backup_server> state.apply celestia.active_bridge test=TrueCaution
Double-sign risk Setting Backup instance as active before making Current instance as backup will result in dual-active condition, which might result in double-sign slashing!
Ensure that your double_sign_check_height config setting is set to a non-zero value to prevent double-slashing during accidental switchover.
Once verified, remove the test=True flag and rerun the commands to proceed with production failover.
Follow the steps below to upgrade celestia-appd and celestia-bridge.
-
Update the Pillar File
Edit the pillar filecelestia_config.slsto include the latest configuration values. -
Refresh Salt Pillar Data
After updating the pillar file, refresh the Salt pillar data across your nodes:sudo salt '*' saltutil.refresh_pillar
The upgrade_celestia_appd.sls state performs the following steps:
-
Stop the Service
- The
celestia-appdservice is stopped to prepare for the upgrade.
- The
-
Repository Cloning and Binary Installation
- The
celestia-apprepository is cloned from GitHub. - The binary is built and moved to
<home_folder>/bin. - The cloned repository is cleaned up after installation.
- The
-
Service Launch
- The
celestia-appdservice is started. - Logs are saved in the
celestia_logs/directory:celestia-appd-status.logcelestia-appd-journal.log
- The
The upgrade_celestia_bridge.sls state performs the following steps:
-
Stop the Service
- The
celestia-bridgeservice is stopped to prepare for the upgrade.
- The
-
Repository Cloning and Binary Installation
- The
celestia-bridgerepository is cloned from GitHub. - The binary is built and moved to
<home_folder>/bin. - The cloned repository is cleaned up after installation.
- The
-
Service Launch
- The
celestia-bridgeservice is started. - Logs are saved in the
celestia_logs/directory:celestia-bridge-status.logcelestia-bridge-journal.log
- The
The following steps outline how to test and execute version upgrades.
Use the test=True flag to simulate the upgrade process without applying any changes. This allows you to validate the configuration and ensure there are no errors:
sudo salt <minion_name> state.apply celestia.upgrade_appd_version test=True
sudo salt <minion_name> state.apply celestia.upgrade_bridge_version test=TrueOnce the test run is successful, apply the changes to perform the upgrade:
sudo salt <minion_name> state.apply celestia.upgrade_appd_version
sudo salt <minion_name> state.apply celestia.upgrade_bridge_versionContributions are welcome! Feel free to submit pull requests or report issues to help improve this repository.