AppSuite:Deployment with Chef for Raspbian
AppSuite on Raspberry Pi
Introduction
This setup will allow you to automatically install the Open-Xchange App Suite to a Raspberry Pi 3.
Requirements
- Raspberry Pi 3
- External SSD
- Everything to run a Raspberry properly (Power supply, MircoSD Card, etc.)
- MicroSD adapter
Why do you need a SSD? A normal SD Card is quite limited in lifetime and an SSD is much faster.
Preparation
First, we need the MicroSD to have a bootable Raspbian image written onto it. If you bought a complete bundle you may have gotten a card that is already prepared. If so, feel free to skip the next steps. If not, the first step is to create such a card. Please check the official raspberry pi guides for this.
When your SD Card is ready, plug it in along with all of your periphery, and boot the Pi up. If all went well your screen should show a menu where you can choose to install Raspbian. After the installation, download this script
wget https://software.open-xchange.com/raspbian/SD2SSD.sh
to the raspberry pi. Start a shell session on the pi, navigate to the script and execute it AS ROOT.
sudo bash SD2SSD.sh
Follow the instructions provided by the script and reboot your Pi after the script has finished. Now, your Raspberry Pi will Boot from SSD. Please confirm this by taking a look into the file manager.
Chef
Now, that the Pi boots from SSD we are able to start our OX installation.
Go to the computer which you want to start the installation to the raspberry. Visit chef.io and download/install the appropriate chef-dk for your operating system.
lgrunau@open-xchange:~$ sudo dpkg -i chefdk.deb
Also please install kitchen-ssh gem.
lgrunau@open-xchange:~$ chef gem install kitchen-ssh
To verify the installation, type;
lgrunau@open-xchange:~$ chef verify
Git
All of our cookbooks are versioned via git, so you'll need to have git installed.
lgrunau@open-xchange:~$ sudo apt-get install git
Deploy from cookbook
Get cookbooks from git
lgrunau@open-xchange:~$ git clone https://code.open-xchange.com/git/deployment/raspbian lgrunau@open-xchange:~$ cd raspbian/
Update cookbooks from git
This is only necessary if there if a new update.
lgrunau@open-xchange:~$ git pull lgrunau@open-xchange:~$ berks update
NOTICE: You might have to do
berks install
first.
Edit preferences
To edit your preferences, navigate to the .kitchen.yml file and set the hostname/IP, username and password to your variables.
lgrunau@open-xchange:~$ vim .kitchen.yml
Deploy
Deploying the software is quite simple. Just type;
lgrunau@open-xchange:~$ kitchen converge default-pi
Now, chef will create a connection to your raspberry pi, will log on and execute the cookbook.
For a complete explaination what chef does, please take a look at the official chef documentation.