class nodo::yacy inherits nodo::vserver {
  class { 'onion': }

  package { 'yacy':
    ensure => installed,
  }

  service { 'yacy':
    ensure  => running,
    require => Package['yacy'],
  }

  # Gracefully restart yacy everyday
  cron { "yacy-restart":
    command  => "/etc/init.d/yacy restart > /dev/null 2>&1",
    user     => root,
    hour     => "*/4",
    minute   => "0",
    ensure   => present,
    require  => Service['yacy'],
  }

  tor::daemon::hidden_service { 'yacy':
    ports    => [ '8090 127.0.0.1:8090', '80 127.0.0.1:8090' ],
    data_dir => "$tor::daemon::data_dir/hidden",
    ensure   => present,
  }
}