From fb892fa31efa7c7615f32c95e5f6c403b3444ad9 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Sun, 18 Feb 2024 02:01:21 +0000 Subject: [PATCH] set up DO --- server/ecosystem.config.js | 6 +++--- server/vm/base.ts | 4 ++-- server/vm/digitalocean.ts | 9 ++++++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/server/ecosystem.config.js b/server/ecosystem.config.js index a2270c8cdb..11efe95c67 100644 --- a/server/ecosystem.config.js +++ b/server/ecosystem.config.js @@ -45,9 +45,9 @@ module.exports = { HETZNER_IMAGE: '145986216', SCW_GATEWAY: 'gateway2.watchparty.me', SCW_IMAGE: '172bd9df-eba5-44e7-add0-f6edbb0f9c64', - DO_GATEWAY: 'gateway4.watchparty.me', - DO_IMAGE: '', - DO_SSH_KEYS: '', + DO_GATEWAY: 'gateway2.watchparty.me', + DO_IMAGE: '150334605', + DO_SSH_KEYS: 'cc:3d:a7:d3:99:17:fe:b7:dd:59:c4:78:14:d4:02:d1', }, }, { diff --git a/server/vm/base.ts b/server/vm/base.ts index 07ec8229f8..1ff2109642 100644 --- a/server/vm/base.ts +++ b/server/vm/base.ts @@ -46,7 +46,7 @@ export abstract class VMManager { }; public getMinBuffer = () => { - return this.limitSize * 0.05; + return this.limitSize * 0.04; }; public getCurrentSize = async () => { @@ -299,7 +299,7 @@ export abstract class VMManager { // filter to only VMs eligible for deletion // they must be up for long enough // keep the oldest min pool size number of VMs - // Hetzner rounds up to nearest hour + // Hetzner/DO rounds up to nearest hour let modulo = 3600; if (this.id === 'Scaleway') { // Scaleway just charges by the minute with a min of 60 min so don't modulo diff --git a/server/vm/digitalocean.ts b/server/vm/digitalocean.ts index 0451225a73..c0b4e3a0b6 100644 --- a/server/vm/digitalocean.ts +++ b/server/vm/digitalocean.ts @@ -10,8 +10,8 @@ const imageId = Number(config.DO_IMAGE); const sshKeys = config.DO_SSH_KEYS.split(','); export class DigitalOcean extends VMManager { - size = 's-1vcpu-2gb'; // s-1vcpu-1gb, s-1vcpu-2gb, s-2vcpu-2gb, s-2vcpu-4gb, c-2 - largeSize = 's-2vcpu-4gb'; + size = 's-2vcpu-2gb'; // s-1vcpu-1gb, s-1vcpu-2gb, s-2vcpu-2gb, s-2vcpu-4gb, c-2, s-4vcpu-8gb + largeSize = 's-4vcpu-8gb'; minRetries = 20; reuseVMs = true; id = 'DO'; @@ -154,8 +154,11 @@ export class DigitalOcean extends VMManager { }; mapServerObject = (server: any): VM => { + // const ip = server.networks.v4.find( + // (network: any) => network.type === 'private', + // )?.ip_address; const ip = server.networks.v4.find( - (network: any) => network.type === 'private', + (network: any) => network.type === 'public', )?.ip_address; return { id: server.id?.toString(),