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

[feature] Build AMI with packer #853

Closed
wants to merge 7 commits into from
Closed

[feature] Build AMI with packer #853

wants to merge 7 commits into from

Conversation

MCJOHN974
Copy link
Collaborator

Description

Closes: #826

Changes

Adds packer file for creating an image

Testing Information

Checklist:

WIP

Copy link
Contributor

@djordon djordon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a quick read through, this looks great. I just had a few questions.

"sudo usermod -aG docker ubuntu",
"git clone https://github.com/stacks-network/sbtc.git",
"cd sbtc",
"",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary?

"cd sbtc",
"",
"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",
Copy link
Contributor

Choose a reason for hiding this comment

The 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?

"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",
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also checkout to a specific commit here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also checkout to a specific commit here.

Hmm, which one? I guess it will be some "release" commit which we don't have yet

region = var.aws_region
source_ami_filter {
filters = {
name = "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"
Copy link
Contributor

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.

ssh_username = "ubuntu"
ami_block_device_mappings {
device_name = "/dev/sda1"
volume_size = 100
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this GB? I know Notion says 100 but I'd maybe opt for making it a bit bigger (eg 200GB).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that the hiro archive testnet data seems to grow at a rate of about 100mb/day (stacks chainstate) -- just fyi

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah but we will be storing logs, etc. Disk is cheap and it seems like a no-brainer to add more just in case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Afaic in hashicorp languages GB is default for disk sizes (which I find quite reasonable).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, can you make it 200GB?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

"git clone https://github.com/stacks-network/sbtc.git",
"cd sbtc",
"sudo docker-compose -f docker/docker-compose.yml pull",
"curl -O https://archive.hiro.so/testnet/stacks-blockchain/testnet-stacks-blockchain-2.5.0.0.7-20240917.tar.gz",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thank you

@MCJOHN974
Copy link
Collaborator Author

It is quite raw, but after #813 lands it will create some AMI, so if we want continue with building AMI, I think it is ok to merge it as an iteration and open some tickets to follow-up

cc @aldur @djordon @AshtonStephens

@MCJOHN974 MCJOHN974 marked this pull request as ready for review November 18, 2024 16:05
@aldur aldur closed this Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Create AWS machine image
4 participants