-
Notifications
You must be signed in to change notification settings - Fork 7
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
[feature] Build AMI with packer #853
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
packer { | ||
required_version = ">= 1.7.0" | ||
required_plugins { | ||
amazon = { | ||
version = ">= 1.0.0" | ||
source = "github.com/hashicorp/amazon" | ||
} | ||
} | ||
} | ||
|
||
variable "aws_region" { | ||
type = string | ||
default = "us-west-2" | ||
} | ||
|
||
source "amazon-ebs" "ubuntu" { | ||
ami_name = "sbtc-signer-image-{{timestamp}}" | ||
instance_type = "c6i.xlarge" | ||
region = var.aws_region | ||
source_ami_filter { | ||
filters = { | ||
name = "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*" | ||
root-device-type = "ebs" | ||
virtualization-type = "hvm" | ||
} | ||
owners = ["099720109477"] # Canonical | ||
most_recent = true | ||
} | ||
ssh_username = "ubuntu" | ||
ami_block_device_mappings { | ||
device_name = "/dev/sda1" | ||
volume_size = 100 | ||
volume_type = "gp3" | ||
delete_on_termination = true | ||
} | ||
} | ||
|
||
build { | ||
sources = ["source.amazon-ebs.ubuntu"] | ||
|
||
provisioner "shell" { | ||
inline = [ | ||
"sudo apt-get update", | ||
"sudo apt-get install -y docker.io docker-compose git", | ||
"sudo usermod -aG docker ubuntu", | ||
"git clone https://github.com/stacks-network/sbtc.git", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As a follow up to this, we can now use a proper "testnet" docker-compose file that points to the latest images. Then no more building the docker images as part of the AMI creation. |
||
"cd sbtc", | ||
"", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this necessary? |
||
"curl -O https://archive.hiro.so/testnet/stacks-blockchain/testnet-stacks-blockchain-2.5.0.0.7-20240917.tar.gz", | ||
"sudo docker-compose -f docker/docker-compose.yml --profile sbtc-signer up", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You probably want to run this in detached mode, does it work without? |
||
] | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to consider using ubuntu 24.04 at this point, unless there is a good reason not to.