Compare commits

..

5 Commits

Author SHA1 Message Date
Noah Masur
566a654f5b
don't enable dyndns for services not running 2024-03-30 14:48:56 -04:00
Noah Masur
1462214a8e remove league of legends option 2024-03-30 14:47:49 -04:00
Noah Masur
efc7daf5fc fix: don't enable thelounge dyndns everywhere 2024-03-30 14:40:24 -04:00
Noah Masur
fa582fcc34 fix: chained ternary operator in workflow 2024-03-30 14:32:30 -04:00
Noah Masur
c66cedf146 use variable for vultr plan 2024-03-30 14:30:02 -04:00
7 changed files with 36 additions and 7 deletions

View File

@ -1,6 +1,6 @@
name: Arrow name: Arrow
run-name: Arrow - ${{ inputs.rebuild && 'Rebuild and ' || '' }}${{ inputs.action == 'create' && 'Create' || ( ${{ inputs.action == 'destroy' && 'Destroy' || 'No Action' ) }} run-name: Arrow - ${{ inputs.rebuild && 'Rebuild and ' || '' }}${{ inputs.action == 'create' && 'Create' || ( inputs.action == 'destroy' && 'Destroy' || 'No Action' ) }}
env: env:
TERRAFORM_DIRECTORY: hosts/arrow TERRAFORM_DIRECTORY: hosts/arrow
@ -27,6 +27,16 @@ on:
- create - create
- destroy - destroy
- nothing - nothing
plan:
type: choice
required: false
options:
- vc2-1c-1gb # 25 GB / $5
- vc2-1c-2gb # 55 GB / $10 (default)
- vc2-2c-2gb # 65 GB / $15
- vc2-2c-4gb # 80 GB / $20
- vc2-4c-8gb # 160 GB / $40
- vc2-6c-16gb # 320 GB / $80
jobs: jobs:
build-deploy: build-deploy:
@ -92,6 +102,8 @@ jobs:
- name: Terraform Apply - name: Terraform Apply
if: inputs.action == 'create' if: inputs.action == 'create'
working-directory: ${{ env.TERRAFORM_DIRECTORY }} working-directory: ${{ env.TERRAFORM_DIRECTORY }}
env:
TF_VAR_vultr_plan: ${{ inputs.plan }}
run: | run: |
terraform apply \ terraform apply \
-auto-approve \ -auto-approve \

View File

@ -45,6 +45,13 @@ variable "vultr_api_key" {
sensitive = true sensitive = true
} }
# https://api.vultr.com/v2/plans
variable "vultr_plan" {
type = string
description = "Size of instance to launch"
default = "vc2-1c-2gb" # 55 GB SSD ($10/mo)
}
provider "aws" { provider "aws" {
region = "auto" region = "auto"
skip_credentials_validation = true skip_credentials_validation = true
@ -75,7 +82,7 @@ resource "vultr_iso_private" "image" {
} }
resource "vultr_instance" "arrow" { resource "vultr_instance" "arrow" {
plan = "vc2-1c-2gb" plan = var.vultr_plan
region = "ewr" region = "ewr"
iso_id = vultr_iso_private.image.id iso_id = vultr_iso_private.image.id
label = "arrow" label = "arrow"

View File

@ -111,7 +111,6 @@ inputs.nixpkgs.lib.nixosSystem {
steam.enable = true; steam.enable = true;
legendary.enable = true; legendary.enable = true;
lutris.enable = true; lutris.enable = true;
leagueoflegends.enable = true;
ryujinx.enable = true; ryujinx.enable = true;
}; };
services.vmagent.enable = true; # Enables Prometheus metrics services.vmagent.enable = true; # Enables Prometheus metrics

View File

@ -5,7 +5,7 @@
{ config, lib, ... }: { { config, lib, ... }: {
config = { config = lib.mkIf config.services.influxdb2.enable {
services.influxdb2 = { services.influxdb2 = {
provision = { provision = {

View File

@ -1,6 +1,6 @@
{ config, ... }: { { config, lib, ... }: {
config = { config = lib.mkIf config.services.thelounge.enable {
services.thelounge = { services.thelounge = {
public = false; public = false;

View File

@ -108,7 +108,11 @@
}]; }];
# Configure Cloudflare DNS to point to this machine # Configure Cloudflare DNS to point to this machine
services.cloudflare-dyndns.domains = [ config.hostnames.prometheus ]; services.cloudflare-dyndns.domains =
if (config.services.prometheus.enable && isServer) then
[ config.hostnames.prometheus ]
else
[ ];
}; };

View File

@ -69,6 +69,13 @@ in {
}]; }];
}]; }];
# Configure Cloudflare DNS to point to this machine
services.cloudflare-dyndns.domains =
if config.services.victoriametrics.enable then
[ config.hostnames.prometheus ]
else
[ ];
# VMAgent # VMAgent
services.vmagent.prometheusConfig = prometheusConfig; # Overwritten below services.vmagent.prometheusConfig = prometheusConfig; # Overwritten below