Skip to content

Commit

Permalink
set up DO
Browse files Browse the repository at this point in the history
  • Loading branch information
howardchung committed Feb 18, 2024
1 parent 0f0b099 commit fb892fa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions server/ecosystem.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
},
{
Expand Down
4 changes: 2 additions & 2 deletions server/vm/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export abstract class VMManager {
};

public getMinBuffer = () => {
return this.limitSize * 0.05;
return this.limitSize * 0.04;
};

public getCurrentSize = async () => {
Expand Down Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions server/vm/digitalocean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit fb892fa

Please sign in to comment.