- Setting up the Environment
This document walks you through the setup of your development environment on your main machine (desktop or laptop) and the Raspbian OS (Debian) operating system environment on the Raspberry Pi for the Saluminator®. Setup on your workstation involves configuring the development toolchain (everything that is needed to edit/iterate/build/deploy the software) and on the Raspberry Pi, the latest versions and the virtual environment for isolation of the Saluminator® software when you are testing and running the applications.
NOTE: This is not a comprehensive and there are a number of issues you may encounter with versioning and other little nits. That is what the interwebs are for :)
I used the generic term "Workstation" as a way to differentiate that this is the main computer (workstation, laptop, etc.) that you use to do your primary development work. We assume it exists on the same network (if using an ethernet connection) and you can install the tools that will allow you to connect and develop code remotely on the Raspberry Pi.
Git is the tool we use for version control and management of software assets. Our workshop will use it to clone the modules and also to merege and contribute to the respository.
Validate that Git is installed and check the version...
git --version
Open a Powershell window...
git update-git-for-windows
Open a terminal window and install Homebrew...
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Install/Update Git
brew upgrade gitOpen a Terminal window...
sudo apt update
sudo apt upgrade
This is the IDE we will use to write code, deploy to the RPi, etc.
LINK: Visual Studio Code Installation Page
Pyhon is the language we will use to build applications for the Raspberry Pi
From the Python Org:
- Python is powerful... and fast;
- plays well with others;
- runs everywhere;
- is friendly & easy to learn;
- is Open.
LINK: Python 3 Installation Page
Pip is the package manager we will use to download packages
On Linux or macOS (Open Terminal):
pip install -U pip
On Windows (from a CMD window or Powershell):
python -m pip install -U pipThese are a set of tools we will use to develop our apps on the Raspberry Pi. You can open the Extensions sidebar with "Shift+Ctrl+X) or click the icon in the side navigator bar.
The next step is to bring this repository to your development machine so you can work with all of the code and scripts. If you want to contribute, you can also create and submit Oull Requests!
Open up a Powershell window and type in the following...
cd \
mkdir Projects
cd Projects
git clone https://github.com/Larouex/open-fermentation-project.git
cd open-fermentation-project
dirYou should see something similar to the following output...
Directory: C:\Projects\open-fermentation-project
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 4/4/2022 10:52 AM assets
d----- 3/29/2022 8:57 AM cloud
d----- 3/29/2022 8:57 AM hardware
d----- 4/11/2022 10:48 AM software
-a---- 3/14/2022 8:47 AM 6148 .DS_Store
-a---- 4/11/2022 11:49 AM 52 .gitignore
-a---- 3/14/2022 2:48 PM 35497 LICENSE.md
-a---- 3/29/2022 8:57 AM 6611 README.mdOpen up a Terminal window and type in the following...
cd \
mkdir Projects
cd Projects
git clone https://github.com/Larouex/open-fermentation-project.git
cd open-fermentation-project
ls -lYou should see something similar to the following output...
total 84
drwxr-xr-x 1 larryj 1049089 0 Oct 3 13:47 assets/
drwxr-xr-x 1 larryj 1049089 0 Oct 3 13:45 assets-editing/
drwxr-xr-x 1 larryj 1049089 0 Mar 29 2022 cloud/
drwxr-xr-x 1 larryj 1049089 0 May 26 12:52 hardware/
-rw-r--r-- 1 larryj 1049089 35497 Mar 14 2022 LICENSE.md
-rw-r--r-- 1 larryj 1049089 6573 Oct 3 13:45 README.md
drwxr-xr-x 1 larryj 1049089 0 Oct 18 09:34 software/This next set of steps are all executed from the command line and will result in a virtual environment that supports the running of the Saluminator® scripts and modifications, etc.
First, open a powershell terminal in Visual Studio Code and set the powershell execution policy to allow scripts...
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUserNext, let's make sure we are in the right folder structure...
cd \
cd .\Projects\open-fermentation-project\software\Next, install the Python Virtual Environment...
python -m pip install --user virtualenvCreate the virtual environment for the Saluminator® software..
python -m venv ./.saluminatorv4-venv/devStart (Activate) the virtual environment..
.\.saluminatorv4-venv\dev\Scripts\Activate.ps1Install the requirements...
python install.pyVerify the Environment...
cd src
python test-verify-env-dev.pyYou will see something similar to the output below...
-------------------------------------------------------------
APP NAME: SaluminatorV4
APP DESC: Monitoring of Saluminator Fermentation System
SCRIPT: test-verify-env-dev.py
METHOD: main()
-------------------------------------------------------------
Testing and Verifying the Environment...
(Config) SUCCESS: Loaded the Configuration File (config.json)
(DeviceCache) SUCCESS: Loaded the Device Cache File (devicecache.json)
(Secrets) SUCCESS: Loaded the Secrets File (secrets.json)
(Recipes) SUCCESS: Loaded the Recipes File (recipes.json)NOTE: You can examine the contents of the various json files by adding the --verbose option to the test-verify-env-dev.py script.
Open a bash terminal in Visual Studio Code and install the Python Virtual Environment support...
python -m pip install --user virtualenvNext, let's make sure we are in the right folder structure...
cd /
cd ./Projects/open-fermentation-project/software/NOTE: If you are running on Windows and have a mounted C drive, you may need to use "cd ./c/Projects/open-fermentation-project/software/"
Create the virtual environment for the Saluminator® software..
python -m venv ./.saluminatorv4-venv/devand then start the virtual environment..
source ./.saluminatorv4-venv/dev/Scripts/activateInstall the requirements...
python install.pyVerify the Environment...
cd src
python test-verify-env-dev.pyYou will see something similar to the output below...
-------------------------------------------------------------
APP NAME: SaluminatorV4
APP DESC: Monitoring of Saluminator Fermentation System
SCRIPT: test-verify-env-dev.py
METHOD: main()
-------------------------------------------------------------
Testing and Verifying the Environment...
(Config) SUCCESS: Loaded the Configuration File (config.json)
(DeviceCache) SUCCESS: Loaded the Device Cache File (devicecache.json)
(Secrets) SUCCESS: Loaded the Secrets File (secrets.json)
(Recipes) SUCCESS: Loaded the Recipes File (recipes.json)NOTE: You can examine the contents of the various json files by adding the --verbose option to the test-verify-env-dev.py script.



