Giter Club home page Giter Club logo

pinner's Introduction

pinner

Ensures that relevant skyfiles will be properly pinned by the portal even when individual servers are removed

Environment variables

Required

  • SERVER_DOMAIN: current server name, e.g. eu-ger-1.siasky.net
  • SKYNET_DB_USER: database user
  • SKYNET_DB_PASS: database password
  • SKYNET_DB_HOST: database host, e.g. mongo
  • SKYNET_DB_PORT: database port, e.g. 27017
  • SIA_API_PASSWORD: API password for the local skyd instance. Typically available in the /home/user/skynet-webportal/docker/data/sia/apipassword file.

Optional

  • SKYNET_ACCOUNTS_HOST: the host where accounts service is running, e.g. 10.10.10.70
  • SKYNET_ACCOUNTS_PORT: the port on which accounts service is running, e.g. 3000
  • PINNER_LOG_FILE: path to pinner's log file, relative to /home/user/skynet-webportal/docker/data/pinner/logs/ directory. Directory traversal (e.g. ../) is not allowed. If this value is empty, pinner won't log to disk!
  • PINNER_LOG_LEVEL: log level, defaults to info
  • PINNER_SCANNER_THREADS: number of parallel threads pinning files, defaults to 5
  • PINNER_SLEEP_BETWEEN_SCANS: defines the time to wait between initiating new scans, e.g. if this value is 10 hours and a scan was triggered at 10:00, the next scan will be triggered at 20:00 regardless of how long the first scan took. If there is a scan running when the next scan is scheduled to start the new scan doesn't start (we don't overlap scans). This value is given in seconds and it defaults to 19 hours.
  • API_HOST: host on which skyd is running, e.g. 10.10.10.10
  • API_PORT: port on which skyd is running, e.g. 9980

pinner's People

Contributors

dependabot[bot] avatar kwypchlo avatar mrcnski avatar msevey avatar ro-tex avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

pinner's Issues

It is still being used as the default sleep time in case we fail to fetch the size of the skyfile from `skyd`.

It is still being used as the default sleep time in case we fail to fetch the size of the skyfile from skyd.

I don't particularly like this approach, so if someone has a suggestion for improving https://github.com/SkynetLabs/pinner/pull/7/files#diff-febdfba77f54946ad0c77a437167750d33fe4aa988fdd0c8935f2fd90cb84442R216, I'd be happy to have it. After we remove it from there, we can remove it completely.

Originally posted by @ro-tex in #7 (comment)

Pinner Endpoint to trigger a manual pin

Overview

We want the ability to ask the pinner to pin a skylink.

Ivaylo:

This needs to be further specified.

My suggested implementation is to introduce a new concept to Pinner which is unhealthy skylinks. This will be a flag on the given skylink which would require that it's pinned to an additional server, regardless of the current number of pinning servers. The flag will be lowered as soon as the skylink is pinned to a new server.

Matt:

agreed, should have a new flag. I would make it generic, like manualRequest instead of unhealthy because I could see this being used for highly important skylinks that we want extra redundancy on.

Design or Proposal

Batch skylinks on /sweep

Overview

The POST /sweep action is rather slow (~2.25 hours for ~145k files on dev1). The main reason for that is that we need to lock each skylink individually and then update it individually. That's both many function calls but mostly many calls to MongoDB.

What we can do about this is add an optional batch mode which we can use when sweeping. When using that we can either lock the files individually (safer) or all at once (potentially disrupts* other servers). Once we have the files locked, we can update and unlock them in batches of 100 or even more.

*: The potential disruption to other servers is important because it will not just delay them until it's done. If we lock all skylinks and another server checks for skylinks it needs to work with it won't find any and it will assume that it's done with its sweep/scan and it won't perform a new one until the following day or a manual request. This is potentially problematic and it should be avoided.

Design or Proposal

Improve Tester Shutdown

Note: This also needs to happen in accounts.

f/u This is not very graceful because the goroutines might just be terminated when the test ends without making sure the http server actually shut down. One way to do that gracefully is something like this

tester.externShutdownDone = make(chan error)
go func() {
  tester.externShutdownErr = srv.ListenAndServe()
  close(tester.externShutdownDone)
}()

and then

func (t *Tester) Close() error {
  if err := t.staticSRV.Shutdown(someCtx); err != nil {
    return err
  }
  <-tester.externShutdownDone
  return tester.externShutdownErr
}

Originally posted by @ChrisSchinnerl in #1 (comment)

Dry Run Follow-ups

Not sure if I should have put the missing packages here or in integration-pkgs.

Originally posted by @m-cat in #30 (comment)

This is way too long. We should replace it with build.Retry. We should actually replace all of these sleeps with that.

Originally posted by @ro-tex in #30 (comment)

Detailed information in `GET /sweep/status`

Overview

Additionally, we want the status endpoint to return information about start and finish times for the sweep, number of unknown and missing skylinks handled, etc.

https://github.com/SkynetLabs/pinner/pull/22/files#r875785159

Something else that is part of this effort is keeping track of all rebuilds across the cluster. Otherwise calling this endpoint will return unreliable information because the caller might hit a different server.

More thoughts: #22 (comment)

Design or Proposal

SKY-279 Cluster-wide setting for underpinned threshold

we should make the underpinned value an environment variable so that we can increase/decrease the redundancy easily.

Originally posted by @MSevey in #2 (comment)

Proposal

As we want this to be a cluster-wide setting, we cannot use an environment variable for it because each server will have its own value and they will need to do a complicated negotiation in order to decide on a common, cluster-wide number.

That's why we should add a configuration or settings collection in Mongo and use that to store all cluster-wide settings, similar to what we do in accounts when we need to disable registrations on a given cluster.

Configuration race conditions

f/u

I think there was a misunderstanding. It's fine for this to be exposed as DefaultConfiguration for testing or whatever.
But we should never assign to global vars like we do in LoadConf.

Right now we got an unnecessary race condition in LoadConf when we call it from 2 threads because both are assigning to a global var. During a test which spins up 2 pinners this will fail with a race condition.

So we don't need func Conf() Config. Just a func LoadConf() (Config, error) { which creates a new Conf instance. That way we can call it a million times in parallel without the race detector going off because we are assigning to the same var.

Originally posted by @ChrisSchinnerl in #1 (comment)

Also: #1 (comment)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.