Cloud-init (advanced)

This will explain how to build images in advanced mode using cloud-init as bootstrap method. This way allows to produce re-usable images for mass usage or configure your device without access to it

Cloud-Init - autopilot install

Using this method you need bit more technical understanding how things works, but you get get your RPI running with no keyboard or mouse or even screen available to you. We will walk you through step by step how to do this. These scripts will work with any image, which supports cloud-init. But we recommend to use Ubuntu 20.04.2 LTS image.

Step 1: Clone helper scripts repository

Close our helper scripts repository:

$ git clone https://github.com/synpse-hq/image-tools && cd image-tools

Step 2: Download image to the assets directory

Download image into assets/images directory. This can be done manually or with make download-base

curl https://cdimage.ubuntu.com/releases/20.04.2/release/ubuntu-20.04.2-preinstalled-server-arm64+raspi.img.xz?_ga=2.31403323.502427891.1618417281-105156824.1616928492  -o assets/images/ubuntu-20.04.2.img.xz

Step 3: Decompress image

Extract image so we can use it:

unxz assets/images/ubuntu-20.04.2.img.xz

Step 4: Add your Synpse project details and wi-fi credentials

Create configuration for for you local home setup:

# copy env.example fine
cp env.example env

# update env file with your configuration
export HOSTNAME=synpse
export UNIX_USER=synpse
export UNIX_PASSWORD=<unix password of you choosing>
# generate ssh key for SSH access. You can generate one by running `go run ./hack/genssh`
export SSH_KEY=$(cat ./assets/id_rsa.pub)
export LOCALE="en_US.UTF-8"
export TIMEZONE="Europe/Vilnius"
export WIFI_ACCESS_POINT_NAME="<my_awesome_wifi_ssid>"
export WIFI_ACCESS_POINT_PASSWORD="<my_awesome_wifi_password>"

# get cloud.synpse.net project_id and registration_token for device registration
export AGENT_PROJECT=prj_xxxxxxxxxxxxxxxx
export AGENT_REGISTRATION_TOKEN=drt_xxxxxxxxxxxxxxxx

Step 5: Generate image

Generate cloud-init configuration and create pre-configured image for RPI:

make generate-image

Step 6: Write the image to an SD card

Once this done you can use any existing image "burning" tools to write this image into SD card.

We recommend to use one of these:

Last updated