add calibrationnet

This commit is contained in:
Cory Schwartz 2021-02-17 00:49:07 -08:00
parent de80b1e433
commit cec0a6e790
6 changed files with 68 additions and 21 deletions

View File

@ -278,6 +278,11 @@ jobs:
- install-deps - install-deps
- prepare - prepare
- run: make calibnet - run: make calibnet
- run: mkdir linux-calibnet && mv lotus lotus-miner lotus-worker linux-calibnet
- persist_to_workspace:
root: "."
paths:
- linux-calibnet
build-lotus-soup: build-lotus-soup:
description: | description: |
Compile `lotus-soup` Testground test plan Compile `lotus-soup` Testground test plan
@ -595,6 +600,10 @@ jobs:
at: "." at: "."
- packer/build: - packer/build:
template: tools/packer/lotus.pkr.hcl template: tools/packer/lotus.pkr.hcl
args: "-var ci_workspace_bins=./linux -var lotus_network=mainnet -var git_tag=$CIRCLE_TAG"
- packer/build:
template: tools/packer/lotus.pkr.hcl
args: "-var ci_workspace_bins=./linux-calibnet -var lotus_network=calibrationnet -var git_tag=$CIRCLE_TAG"
workflows: workflows:
version: 2.1 version: 2.1
@ -699,10 +708,12 @@ workflows:
- publish-packer: - publish-packer:
requires: requires:
- build-all - build-all
filters: - build-ntwk-calibration
branches: filters:
ignore: branches:
- /.*/ ignore:
tags: - /.*/
only: tags:
- /^v\d+\.\d+\.\d+$/ only:
- /^v\d+\.\d+\.\d+$/

View File

@ -1,7 +1,24 @@
locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") } variable "ci_workspace_bins" {
type = string
default = "./linux"
}
source "amazon-ebs" "lotus-mainnet" { variable "lotus_network" {
ami_name = "lotus-mainnet-${local.timestamp}" type = string
default = "mainnet"
}
variable "git_tag" {
type = string
default = ""
}
locals {
timestamp = regex_replace(timestamp(), "[- TZ:]", "")
}
source "amazon-ebs" "lotus" {
ami_name = "lotus-${var.lotus_network}-${var.git_tag}-${local.timestamp}"
ami_regions = [ ami_regions = [
"us-east-1", "us-east-1",
"us-west-2", "us-west-2",
@ -21,33 +38,33 @@ source "amazon-ebs" "lotus-mainnet" {
ssh_username = "ubuntu" ssh_username = "ubuntu"
} }
source "digitalocean" "lotus-mainnet" { source "digitalocean" "lotus" {
droplet_name = "lotus-mainnet" droplet_name = "lotus-${var.lotus_network}"
size = "s-1vcpu-1gb" size = "s-1vcpu-1gb"
region = "nyc3" region = "nyc3"
image = "ubuntu-20-04-x64" image = "ubuntu-20-04-x64"
snapshot_name = "lotus-mainnet-${local.timestamp}" snapshot_name = "lotus-${var.lotus_network}-${local.timestamp}"
ssh_username = "root" ssh_username = "root"
} }
build { build {
sources = [ sources = [
"source.amazon-ebs.lotus-mainnet", "source.amazon-ebs.lotus",
"source.digitalocean.lotus-mainnet", "source.digitalocean.lotus",
] ]
# Lotus software (from CI workspace) # Lotus software (from CI workspace)
provisioner "file" { provisioner "file" {
source = "./linux/lotus" source = "${var.ci_workspace_bins}/lotus"
destination = "lotus" destination = "lotus"
} }
provisioner "file" { provisioner "file" {
source = "./linux/lotus-miner" source = "${var.ci_workspace_bins}/lotus-miner"
destination = "lotus-miner" destination = "lotus-miner"
} }
# First run script # First run script
provisioner "file" { provisioner "file" {
source = "./tools/packer/scripts/lotus-init.sh" source = "./tools/packer/scripts/${var.lotus_network}/lotus-init.sh"
destination = "lotus-init.sh" destination = "lotus-init.sh"
} }
# Systemd service units. # Systemd service units.
@ -64,16 +81,15 @@ build {
destination = "lotus-init.service" destination = "lotus-init.service"
} }
provisioner "file" { provisioner "file" {
source = "./tools/packer/LOTUS.txt" source = "./tools/packer/homedir/LOTUS.txt"
destination = "LOTUS.txt" destination = "LOTUS.txt"
} }
provisioner "file" { provisioner "file" {
source = "./tools/packer/bashrc" source = "./tools/packer/homedir/bashrc"
destination = ".bashrc" destination = ".bashrc"
} }
# build it. # build it.
provisioner "shell" { provisioner "shell" {
script = "./tools/packer/setup.sh" script = "./tools/packer/setup.sh"
} }
} }

View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
# This script sets up an initial configuraiton for the lotus daemon and miner
# It will only run once.
GATE="$LOTUS_PATH"/date_initialized
# Don't init if already initialized.
if [ -f "GATE" ]; then
echo lotus already initialized.
exit 0
fi
# Not importing snapshot on calibrationnet.
#
# echo importing minimal snapshot
# lotus daemon --import-snapshot https://fil-chain-snapshots-fallback.s3.amazonaws.com/mainnet/minimal_finality_stateroots_latest.car --halt-after-import
# Block future inits
date > "$GATE"