Nerdy Drunk

Drunk on technology

User Tools

Site Tools


vyos:build_iso_ami

VyOS Build ISO and AMI

Description

Rundown

Prepare builder VM

##
## on builder VM as root
##
apt update && apt dist-upgrade -y
apt install -y sudo git-all curl unzip python3 python3-pystache live-build pbuilder vim tmux
apt install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common
apt install -y awscli ansible
apt install -y python3-boto python3-botocore python3-boto3 python3-setuptools
apt install -y python-boto python-botocore python-boto3 python-pip python-setuptools
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
apt update
apt install -y docker-ce
adduser USERNAME sudo
adduser USERNAME docker
visudo
    # USERNAME ALL=(ALL) NOPASSWD: ALL

Create and start VyOS builder container

##
## on builder VM as USERNAME
##
git clone -b current --single-branch https://github.com/vyos/vyos-build
# for future run cd into directory and use git pull instead of git clone
cd vyos-build/
docker build -t vyos/vyos-build:current docker
docker run --rm -it --privileged -v $(pwd):/vyos -w /vyos vyos/vyos-build:current bash

Build VyOS ISO

##
## on builder docker container
##
./configure --architecture amd64 --build-by "USERNAME@DOMAIN.TLD"
sudo make AWS
ls -l build/

Upload ISO to S3 and convert to AMI.
You will want to make sure you upload the file to a public bucket, or make the object public after upload.

##
## on builder VM as USERNAME
##
git clone https://github.com/vyos/build-ami.git
# for future run cd into directory and use git pull instead of git clone
aws configure
    AWS Access Key ID [None]: ********************
    AWS Secret Access Key [None]: ****************************************
    Default region name [None]: us-east-1
    Default output format [None]: json
aws s3 ls
aws s3 cp ./vyos-build/build/vyos-1.3-rolling-202011112135-amd64.iso s3://S3-BUCKET-NAME/vyos-1.3-rolling-202011112135-amd64.iso
aws s3api put-object-acl --bucket S3-BUCKET-NAME --key vyos-1.3-rolling-202011112135-amd64.iso --acl public-read
curl -I https://s3.AWS-REGION-NAME.amazonaws.com/S3-BUCKET-NAME/vyos-1.3-rolling-202011112135-amd64.iso
./build-ami/vyos-build-ami https://S3-BUCKET-NAME/vyos-1.3-rolling-202011112135-amd64.iso

Cleanup for a future build.

tingalls@debian:~$ docker image ls
REPOSITORY        TAG       IMAGE ID       CREATED          SIZE
vyos/vyos-build   current   29af929b13bd   46 minutes ago   3.4GB
debian            buster    1510e8501783   5 months ago     114MB
tingalls@debian:~$ docker image rm 29af929b13bd
tingalls@debian:~$ docker image rm 1510e8501783
tingalls@debian:~$ docker image ls
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE
tingalls@debian:~$ sudo rm -rf ./vyos-build/build/
vyos/build_iso_ami.txt · Last modified: 2022/07/21 10:41 by 127.0.0.1