HOWTO Run Sia host on headless Linux server (Ubuntu)


  • admins

    yes, you do. Would also be good to see a tutorial here for setting up dydns



  • very valuable

    just how to push files to sia headless ?


  • admins

    When working with headless machines, you are going to be using siac to interact with all files. It's strongly recommended that you make use of the help dialogs.

    siac -h will give a list of commands.

    Sia Client v0.5.0
    
    Usage:
      siac [flags]
      siac [command]
    
    Available Commands:
      version     Print version information
      stop        Stop the Sia daemon
      hoSia Client v0.5.0
    
    Usage:
      siac [flags]
      siac [command]
    
    Available Commands:
      version     Print version information
      stop        Stop the Sia daemon
      host        Perform host actions
      hostdb      List active hosts on the network
      miner       Perform miner actions
      wallet      Perform wallet actions
      renter      Perform renter actions
      gateway     Perform gateway actions
      status      Print the current state of the daemon
    
    Flags:
      -a, --addr string   which host/port to communicate with (i.e. the host/port siad is listening on) (default "localhost:9980")
    
    Use "siac [command] --help" for more information about a command.
    st        Perform host actions
      hostdb      List active hosts on the network
      miner       Perform miner actions
      wallet      Perform wallet actions
      renter      Perform renter actions
      gateway     Perform gateway actions
      status      Print the current state of the daemon
    
    Flags:
      -a, --addr string   which host/port to communicate with (i.e. the host/port siad is listening on) (default "localhost:9980")
    
    Use "siac [command] --help" for more information about a command.
    
    

    Subcommands also give help

    siac renter -h

    Upload, download, rename, delete, load, or share files.
    
    Usage:
      siac renter [flags]
      siac renter [command]
    
    Available Commands:
      queue       View the download queue
      delete      Delete a file
      download    Download a file
      list        List the status of all files
      load        Load a .sia file
      loadascii   Load an ASCII-encoded .sia file
      rename      Rename a file
      share       Export a file to a .sia for sharing
      shareascii  Export a file as an ASCII-encoded .sia file
      upload      Upload a file
    
    Global Flags:
      -a, --addr string   which host/port to communicate with (i.e. the host/port siad is listening on) (default "localhost:9980")
    
    Use "siac renter [command] --help" for more information about a command.
    

    To upload a file, siac renter upload [source] [siapath], for more information run siac renter upload -h



  • I like systemd (oddly enough), so I've set up my sia host using systemd directly instead of employing supervisord to make sure it stays running.

    It is enough to create a user I called "sia", as described above, copy siad in /usr/local/bin, and then put the following in /etc/systemd/system/sia.service:

    [Unit]
    Description=Sia daemon
    After=network.target

    [Service]
    Type=simple
    User=sia
    Nice=5
    WorkingDirectory=/home/sia/my-host-directory
    ExecStart=/usr/local/bin/siad
    Restart=on-failure
    RestartSec=30

    [Install]
    WantedBy=multi-user.target

    Then issue "systemctl daemon-reload".

    This will start siad automatically after boot, and restart it if it fails.



  • This link is not working anymore:
    Configure your host settings:
    See http://blog.sia.tech/2016/05/26/how-to-run-a-host-on-sia/

    Probably URL structure on the blog changed and this is it:
    https://blog.sia.tech/how-to-run-a-host-on-sia-2159ebc4725


  • admins

    I went ahead and updated the link in the parent post. Should be noted that this guide is over a year old and hosting looks a lot different now. It's mostly still going to be relevant, but we're due for another guide soon.



  • I was able to set up a node following that post and haven't encountered any problem. So seems ok to me.



  • one short question about
    ./siac host announce
    do I have to execute this after every sytsem reboot?



  • @menace_one: you have to execute this only once after setting up a new host. But you have to unlock your wallet after each restart.



  • What is the way to auto-unlock the hosting wallet?
    My siad is working fine on the headless box. But to be a good host it needs to come up as soon as possible after a reboot or downtime. Sometimes it happens that I even do not notice that there was a power outage, as the server comes up and all services are started.
    So, how to automate the wallet unlocking for the hosting service to be operational after starting?



  • One way to to it would be to put a watch into cron like evry 5 minute or so using siac,

    If ! wallet unlocked
    ulock it.



  • @brisk
    My question was more about feeding the password to siac...
    Can I do it on command line (in batch file/shell script)?



  • sure easy peasy
    (echo "lakes romance ... ) | siac wallet unlock



  • @brisk
    Oh, thanks. It works this way.
    I thought there should be a command line parameter for siac such as siac wallet unlock -p <password> .

    From the other side it wouldn't be more secure as echoing from a script.
    As I don't like storing cleartext passwords in script files, there should be a more elegant way to do this.
    I know, most of database accessing software is storing the cleartext db access password in a conf file and it may be even less secure than storing it in the startup script.

    So, perhaps, when the devs have more time... Could a key file be generated from something machine specific and the wallet password? So the user should generate such key file from his wallet password when the wallet is moved to another machine.
    Or better, the hosting process should be capable to run on a "partially locked" wallet, as no user approval is needed for from the hosting process originating transactions anyway. The collateral would be locked at the moment the user makes changes to his hosting parameters -price, size etc or/and turns accepting contracts on (which can happen only when the wallet is already unlocked). And these locked SC are accessible for the hosting process even if the wallet is locked.



  • I dont know if an attacker is in he (or she) is in. Imo best to do here is to make sure the online wallet always have pretty limited funds and you make a process of refilling/draining it when needed.

    Also it a general bad practice to send passwds as arguments, anyone can see them using tools like top then ( my echo just as bad) better would be to read it from a file or env variable on ly accessable to current user.



  • Hello @brisk thanks for your thoughts,
    can you explain how an attacker, which overtook a local (non root) user, could read the echo from your suggested command line?
    Would it make a difference wheather script is executed by root or a non-root user?

    greetings





  • What about

    Could not announce host: insufficient balance

    when trying to annouce ?


Log in to reply