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

Run wirestewrad binary directly, default to arm64 arch #246

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions terraform/aws/io.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ variable "ignition" {
description = "The ignition configuration for the wiresteward instances. The length of this list determines the number of instances launched. Output of the ignition module."
}

variable "instance_type" {
type = string
description = "Instance type for wiresteward service nodes"
default = "t4g.micro"
}

variable "subnet_ids" {
type = list(string)
description = "AWS VPC subnet IDs in which the wiresteward instances will be deployed"
Expand Down
2 changes: 1 addition & 1 deletion terraform/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ resource "aws_eip_association" "peer" {
resource "aws_instance" "peer" {
count = local.instance_count
ami = var.ami_id != "" ? var.ami_id : data.aws_ami.flatcar_stable.id
instance_type = "t3a.micro"
instance_type = var.instance_type
vpc_security_group_ids = concat([aws_security_group.wiresteward.id], var.additional_security_group_ids)
subnet_id = var.subnet_ids[count.index]
source_dest_check = false
Expand Down
10 changes: 10 additions & 0 deletions terraform/ignition/ignition.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
# wiresteward
data "ignition_file" "wiresteward_bin" {
mode = 493
path = "/opt/bin/wiresteward"

source {
source = "https://github.com/utilitywarehouse/wiresteward/releases/download/${var.wiresteward_version}/wiresteward_${var.wiresteward_version}_${var.arch}_${var.os}"
}
}

data "ignition_file" "wiresteward_config" {
count = local.instance_count
path = "/etc/wiresteward/config.json"
Expand Down Expand Up @@ -88,6 +97,7 @@ data "ignition_config" "wiresteward" {

files = concat([
data.ignition_file.traefik_config[count.index].rendered,
data.ignition_file.wiresteward_bin.rendered,
data.ignition_file.wiresteward_config[count.index].rendered,
], var.additional_ignition_files)

Expand Down
20 changes: 20 additions & 0 deletions terraform/ignition/io.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
variable "arch" {
type = string
description = "Wiresteward binary arch to fetch"
default = "arm64"
validation {
condition = contains(["386", "amd64", "arm64", "armv6", "mips_softfloat"], var.arch)
error_message = "Arch should be one of: 386, amd64, arm64, armv6, mips_softfloat"
}
}

variable "os" {
type = string
description = "Wiresteward binary os to fetch"
default = "linux"
validation {
condition = contains(["darwin", "linux"], var.os)
error_message = "OS should be darwin or linux"
}
}

variable "additional_ignition_files" {
type = list(string)
description = "Additional ignition files to include in the ignition config"
Expand Down
11 changes: 2 additions & 9 deletions terraform/ignition/resources/wiresteward.service.tmpl
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
[Unit]
Description=wiresteward server
After=docker.service network-online.target nss-lookup.target
Requires=docker.service
After=network-online.target nss-lookup.target
Wants=network-online.target nss-lookup.target
[Service]
Restart=on-failure
ExecStart=/bin/sh -c 'docker run --name=%p_$(uuidgen) --rm \
--net=host \
--cap-add=NET_ADMIN \
-v /etc/wiresteward/:/etc/wiresteward/:rw \
-v /var/lib/wiresteward/:/var/lib/wiresteward/:rw \
quay.io/utilitywarehouse/wiresteward:${wiresteward_version} -server'
ExecStop=/bin/sh -c 'docker stop -t 3 "$(docker ps -q --filter=name=%p_)"'
ExecStart=/opt/bin/wiresteward -server
[Install]
WantedBy=multi-user.target