Skip to content

Instantly share code, notes, and snippets.

@DieterReuter
Created October 30, 2017 17:41
Show Gist options
  • Save DieterReuter/6edbef339e05d44e803128ca3f78e781 to your computer and use it in GitHub Desktop.
Save DieterReuter/6edbef339e05d44e803128ca3f78e781 to your computer and use it in GitHub Desktop.
Deploy HypriotOS/arm64 for RPi3 with OpenFaas the DevOps/Automation way
#cloud-config
# vim: syntax=yaml
#
# The current version of cloud-init in the Hypriot rpi-64 is 0.7.9
# When dealing with cloud-init, it is SUPER important to know the version
# I have wasted many hours creating servers to find out the module I was trying to use wasn't in the cloud-init version I had
# Documentation: http://cloudinit.readthedocs.io/en/0.7.9/index.html
# Set your hostname here, the manage_etc_hosts will update the hosts file entries as well
hostname: openfaas-rpi64
manage_etc_hosts: true
# You could modify this for your own user information
users:
- name: pirate
gecos: "Hypriot Pirate"
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
groups: users,docker,video
plain_text_passwd: hypriot
lock_passwd: false
ssh_pwauth: true
chpasswd: { expire: false }
# Set the locale of the system
locale: "en_US.UTF-8"
# Set the timezone
# Value of 'timezone' must exist in /usr/share/zoneinfo
timezone: "Europe/London"
# These commands will be ran once on first boot only
runcmd:
# Pickup the hostname changes
- 'systemctl restart avahi-daemon'
# Init a Docker Swarm, because we need it
- 'docker swarm init'
# Clone OpenFaas repo into /home/pirate
- 'su - -c "git clone https://github.com/alexellis/faas/" pirate'
# Deploy OpenFaas as Docker Swarm services
- 'su - -c "cd faas; ./deploy_stack.armhf.sh" pirate'
@DieterReuter
Copy link
Author

DieterReuter commented Oct 30, 2017

How to flash HypriotOS including this user-data YAML file

Install flash utility (for macOS and Linux)

wget https://raw.githubusercontent.com/hypriot/flash/master/$(uname -s)/flash
chmod +x flash
sudo mv flash /usr/local/bin/flash

Download the user-data YAML file

wget https://gist.github.com/DieterReuter/6edbef339e05d44e803128ca3f78e781/raw/87e7aff94376c89bdb632d14041554ffdd4dc534/user-data-openfaas-1node.yml

Flash a SD card

flash --userdata ./user-data-openfaas-1node.yml \
   https://github.com/DieterReuter/image-builder-rpi64/releases/download/v20171013-172949/hypriotos-rpi64-v20171013-172949.img.zip

Insert SD card into RPi3 and boot it

Done.
OK, you have to wait approx. 3-4 minutes. Then OpenFaas should be automatically deployed and you can easily reach it.

open http://openfaas-rpi64.local:8080

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment