var img = document.createElement('img'); img.src = "https://terradocs.matomo.cloud//piwik.php?idsite=1&rec=1&url=https://docs.terra.money" + location.pathname; img.style = "border:0"; img.alt = "tracker"; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(img,s);
Skip to main content

Set up a production environment

Use this guide to set up and manage a production-level full Terra node.

For information about running a validator node, visit the validator guide.

Create a dedicated user

Although Terrad does not require a super user account, during the setup process you'll need super user permissions to create and modify some files. It is strongly recommended to use a normal user when running Terrad.

Increase limit of file descriptors per process

Linux systems set the maximum number of file descriptors that a process may open to 1024 by default. It is recommended that you increase this amount.

Modify /etc/security/limits.conf* to increase the amount, where nofile is the number of files a process may open at a time.


_5
# If you have never changed this system config or your system is fresh, most of this file will be commented
_5
# ...
_5
* soft nofile 65535 # Uncomment the following two lines at the bottom
_5
* hard nofile 65535 # Change the default values to ~65535
_5
# ...

Run the server as a daemon

Terrad must be running at all times. It is recommended that you register Terrad as a systemd service so that it will be started automatically when the system reboots.

Register Terrad as a service

  1. Create a service definition file in /etc/systemd/system/terrad.service.

    Example:


    _15
    [Unit]
    _15
    Description=Terra Daemon
    _15
    After=network.target
    _15
    _15
    [Service]
    _15
    Type=simple
    _15
    User=<TERRA_USER>
    _15
    ExecStart=<PATH_TO_TERRAD>/terrad start
    _15
    Restart=on-abort
    _15
    _15
    [Install]
    _15
    WantedBy=multi-user.target
    _15
    _15
    [Service]
    _15
    LimitNOFILE=65535

  2. Modify the Service section according to your environment:

    • Enter the user (likely your username, unless you created a user specifically for Terrad).
    • Enter the path to the Terrad executable. <PATH_TO_TERRAD> is likely /home/<YOUR_USER>/go/bin/terrad or /usr/go/bin. Confirm this with whereis terrad.
    • Make sure you made the correct edits to /etc/security/limits.conf.
  3. Run systemctl daemon-reload followed by systemctl enable terrad. This will register Terrad as a system service and run the program upon startup.

  4. Now start the serivce with systemctl start terrad.

Controlling the service

Use systemctl to start, stop, and restart the service:


_8
# Check health
_8
systemctl status terrad
_8
# Start
_8
systemctl start terrad
_8
# Stop
_8
systemctl stop terrad
_8
# Restart
_8
systemctl restart terrad

Access logs

Use journalctl -t to access entire logs, entire logs in reverse, and the latest and continuous log.


_6
# Entire log reversed
_6
journalctl -t terrad -r
_6
# Entire log
_6
journalctl -t terrad
_6
# Latest and continuous
_6
journalctl -t terrad -f