Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hetzner: Add shared vCPU instance types; EUR -> USD #835

Merged
merged 15 commits into from
Dec 12, 2024
Merged
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions console/db/migrations/20241205103951_2.1.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,59 @@ WHERE extension_name IN (
'timescaledb'
);

-- Adds shared_cpu BOOLEAN field to cloud_instances
-- ref: https://github.com/vitabaks/autobase/issues/784
ALTER TABLE ONLY public.cloud_instances
ADD COLUMN 'shared_cpu' BOOLEAN DEFAULT FALSE;
vitabaks marked this conversation as resolved.
Show resolved Hide resolved

vitabaks marked this conversation as resolved.
Show resolved Hide resolved
-- Update AWS shared vCPU instances
UPDATE public.cloud_instances
SET shared_cpu = true
WHERE cloud_provider = 'aws' AND instance_name IN ('t3.small', 't3.medium');

-- Update GCP shared vCPU instances
UPDATE public.cloud_instances
SET shared_cpu = true
WHERE cloud_provider = 'gcp' AND instance_name IN ('e2-small', 'e2-medium');

-- Update Azure shared vCPU instances
UPDATE public.cloud_instances
SET shared_cpu = true
WHERE cloud_provider = 'azure' AND instance_name IN ('Standard_B1ms', 'Standard_B2s');

-- Update DigitalOcean shared vCPU instances
UPDATE public.cloud_instances
SET shared_cpu = true
WHERE cloud_provider = 'digitalocean' AND instance_name IN ('s-2vcpu-2gb', 's-2vcpu-4gb');

-- Extends 20240520144338_2.0.0_initial_scheme_setup.sql#L217 with more cloud instance types
-- Heztner price is for the region 'Geremany / Finland', other regions may vary in price.
INSERT INTO public.cloud_instances (cloud_provider, instance_group, instance_name, cpu, ram, price_hourly, price_monthly, currency, updated_at, shared_cpu) VALUES
('hetzner', 'Small Size', 'CX22', 2, 4, 0.0074 , 4.59, '$', '2024-12-10', true),
('hetzner', 'Small Size', 'CX32', 4, 8, 0.0127 , 7.59, '$', '2024-12-10', true),
('hetzner', 'Medium Size', 'CX42', 8, 16, 0.0304 , 18.59, '$', '2024-12-10', true),
('hetzner', 'Medium Size', 'CX52', 16, 32, 0.0611 , 36.09, '$', '2024-12-10', true),
('hetzner', 'Small Size', 'CPX31', 4, 8, 0.025 , 15.59, '$', '2024-12-10', true),
('hetzner', 'Medium Size', 'CPX41', 8, 16, 0.0464 , 28.09, '$', '2024-12-10', true),
('hetzner', 'Medium Size', 'CPX51', 16, 32, 0.0979 , 61.09, '$', '2024-12-10', true);


-- Update all existing Hetzner instances to use USD instead of EUR for easy comparison to other IaaS Providers.
-- cloud_instances
-- Update prices and other relevant fields for Hetzner cloud instances indludes an IPv4 address
UPDATE public.cloud_instances SET price_hourly = 0.0082, price_monthly = 5.09, currency = '$', updated_at = '2024-12-10', shared_cpu = true WHERE cloud_provider = 'hetzner' AND instance_name = 'CPX11';
UPDATE public.cloud_instances SET price_hourly = 0.0138, price_monthly = 8.59, currency = '$', updated_at = '2024-12-10', shared_cpu = true WHERE cloud_provider = 'hetzner' AND instance_name = 'CPX21';
UPDATE public.cloud_instances SET price_hourly = 0.0226, price_monthly = 14.09, currency = '$', updated_at = '2024-12-10', shared_cpu = false WHERE cloud_provider = 'hetzner' AND instance_name = 'CCX13';
UPDATE public.cloud_instances SET price_hourly = 0.0435, price_monthly = 27.09, currency = '$', updated_at = '2024-12-10', shared_cpu = false WHERE cloud_provider = 'hetzner' AND instance_name = 'CCX23';
UPDATE public.cloud_instances SET price_hourly = 0.0867, price_monthly = 54.09, currency = '$', updated_at = '2024-12-10', shared_cpu = false WHERE cloud_provider = 'hetzner' AND instance_name = 'CCX33';
UPDATE public.cloud_instances SET price_hourly = 0.1725, price_monthly = 107.59, currency = '$', updated_at = '2024-12-10', shared_cpu = false WHERE cloud_provider = 'hetzner' AND instance_name = 'CCX43';
UPDATE public.cloud_instances SET price_hourly = 0.3431, price_monthly = 214.09, currency = '$', updated_at = '2024-12-10', shared_cpu = false WHERE cloud_provider = 'hetzner' AND instance_name = 'CCX53';
UPDATE public.cloud_instances SET price_hourly = 0.5138, price_monthly = 320.59, currency = '$', updated_at = '2024-12-10', shared_cpu = false WHERE cloud_provider = 'hetzner' AND instance_name = 'CCX63';

-- cloud_volumes
-- Update prices and other relevant fields for Hetzner cloud volume
UPDATE public.cloud_volumes SET price_monthly = 0.05, currency = '$', updated_at = '2024-12-10' WHERE cloud_provider = 'hetzner';

-- +goose Down
DELETE FROM public.postgres_versions
WHERE major_version = 17;
Loading