def start(self, node: models.Node): b = Benchmarks( ram_size=1024 * 1024 * 500, # 500MB storage_size=1024 * 1024 * 1024 * 10, # 10GB cpu_cores=1, cpu_sysbench_multi=500, cpu_sysbench_single=500, net_download=1024 * 1024 * settings.NODE_DOWNLOAD, net_upload=1024 * 1024 * settings.NODE_UPLOAD, ) n = NetworkParams(incoming=True, outbound=True, overlay=True) bid = BidParams( duration=0, price='0.01 USD/h', counterparty=settings.COUNTERPARTY, identity=sonm.consts.IDENTITY_ANONYMOUS, tag='sonm-cdn-node', benchmarks=b, network=n, ) bid_id = self.sonm.order.create(bid=bid)['id'] node.external_id = bid_id node.throughput = settings.NODE_UPLOAD node.save() models.SonmBid.objects.create(node=node)
def start(self, node: Node): size_slug = 's-1vcpu-1gb' ssh_keys = self.get_ssh_keys() do_region = random.choice(REGIONS_MAP[node.region]) droplet = digitalocean.Droplet(token=settings.DO_TOKEN, name=node.name, region=do_region, image=self.get_image(), size_slug=size_slug, ssh_keys=ssh_keys, tags=[TAG_NAME], backups=False) droplet.create() node.external_id = droplet.id node.throughput = 100 # let's consider that maximum throughput 100 Mb/sec node.save()