Thanks for considering developing for AmpliPi. We appreciate your support!
To develop for the webapp, you will need to install nodejs and any dependencies for ReactJS
This allows remote development with the ability to test changes on your AmpliPi
- Checkout this repo using git on a linux based system. You will need git-lfs installed as well to handle large files. A git bash shell on windows works fine as well, we suggest Windows Subsystem for Linux (WSL).
- Make changes with your favorite editor, we suggest vscode
- Use
scripts/deploy
to deploy the latest software. The pi must have access to the internet to successfully run this script.
scripts/deploy
attempts to install any dependencies automatically, except for Node.js.
AmpliPi is currently built with Node.js version 18.
TODO: Can Ubuntu 22.04 or Debian Bookworm use what's in their default apt repos?
For Ubuntu <=20.04, the version of Node.js from apt is outdated. We use Node Version Manager to install a newer version. A simple install that has been tested on Ubuntu 20.04 is below, if you run into issues see NVM's readme for more info. Before proceeding, verify no node/npm is already installed.
NVM_DIR="${HOME}/.nvm"
git clone --branch v0.39.7 https://github.com/nvm-sh/nvm.git "$NVM_DIR"
cat >> "${HOME}/.bashrc" << EOF
[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && source "$NVM_DIR/bash_completion" # This loads nvm bash_completion
EOF
source "$NVM_DIR/nvm.sh"
nvm install 18
If building directly on an AmpliPi, the npm run build
step must be set to limit its memory usage with
NODE_OPTIONS=--max_old_space_size=768 npm run build
.
Congratulations! The Amplipi is now running the software you deployed! You can stop now or continue in order to debug over SSH!
- ssh into the AmpliPi with
ssh pi@amplipi.local
, the default password is raspberry (you can change it to whatever) - Change directory to the development root
~/amplipi-dev
(this is wheredeploy
put the software) - To run the amplipi server in debug mode over an ssh connection, run
./scripts/run_debug_webserver
it will run a debug webserver on amplipi.local:5000. - Restart amplipi service (it was stopped by
./scripts/run_debug_webserver
) withsystemctl --user restart amplipi
.
- Make a git checkout at
~/amplipi-dev
usinggit checkout https://github.com/micro-nova/AmpliPi ~/amplipi-dev
(you may need to deleteamplipi-dev
if it already exists) - Change directory to amplipi-dev
cd ~/amplipi-dev
- Make changes using your favorite editor
- To run the amplipi server in debug mode, run
./scripts/run_debug_webserver
it will run a debug webserver on amplipi.local:5000. - Once you are comfortable with your changes, run
./scripts/configure.py --python-deps --os-deps --display --web
. This will install any required dependencies and reconfigure the amplipi web and display services.
See our remote vscode guide for more information.
You will need to install the following:
- git (you will need git bash)
- vscode (only recommended)
- python 3 and setup the python path (step 6 in the following guide) https://phoenixnap.com/kb/how-to-install-python-3-windows
Notes:
- The latest Windows 10 supports mDNS which we use to easily ssh into amplipi, however we had some problems using WiFi so we suggest a ethernet connection on windows.
Below are a couple of different ways you can start developing for the AmpliPi without an actual system:
-
Mocked out audio and mocked out controller (needs: debian based system such as Pi or Ubuntu)
Supports:
- Web interface development
- API testing
- Basic Streams testing
-
Mocked out controller (with 4 stereo audio channels), needs: something running Raspberry Pi OS (previously called raspbian)
Supports:
- Web interface development
- API testing
- Streams integration and testing
Requires:
- Raspberry Pi OS with ALSA support (any 32-bit image before December 2020) (we recommend: https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2020-08-24/)
- A cmedia based, usb, 7.1 channel audio device (we have tested with this connected: https://www.amazon.com/Vantec-NBA-200U-External-Channel-Adapter/dp/B004HXGJ3S)
-
Actual system
Supports:
- Web interface development
- API testing
- Streams integration and testing
- Group and zone configuration
- Analog Audio input
This is the simplest way to develop new features for AmpliPi without an AmpliPi controller. Optionally you can install some streaming sources for partial streaming testing.
- Checkout this repo
- (Optional) Install streaming os dependencies with
./scripts/configure.py --os-deps
. The dependencies will be installed globally with apt. This is optional since it installs many packages needed by the various streaming sources. It could potentially cause package conflicts on your system. - Install python dependencies to AmpliPi's virtual environment with
./scripts/configure.py --python-deps
- Use
./scripts/run_debug_webserver
to start the mock server, if the streaming deps were not installed add the --mock-streams flag like./scripts/run_debug_webserver --mock-streams
.
Developing with a mocked out controller (with 4 stereo channel audio) on something running Raspberry Pi OS
- Start with a 32-bit version of Rasberry Pi OS. This needs to be older than december 2020 since our system only supports the ALSA audio backend currently.
- Connect a cmedia based, usb, 7.1 channel audio device to the pi. We have tested using this one: https://www.amazon.com/Vantec-NBA-200U-External-Channel-Adapter/dp/B004HXGJ3S
- Checkout this repo on a linux based system (a git bash shell on windows works fine as well)
- Edit config/asound.conf. Uncomment the "Old Prototype" section at the bottom, and comment out the similar configuration above. This should be the configuration needed for the 7.1 channel USB audio card. Depending on the setup the card will either show up as #2 or #3. That needs to be changed on lines 27 and 32. Find the card # using
aplay -l | grep "USB Sound Device"
and edit those lines to include the correct #. - Execute
scripts/deploy USER@HOSTNAME --mock-ctrl
orscripts/deploy USER@IP_ADDRESS
replacing USER and HOSTNAME/IP_ADDRESS with the appropriate values for the pi device - Over ssh connection, run
scripts/run_debug_webserver --mock-ctrl
from the~/amplipi-dev
directory.
- For a fresh pi compute module, run
scripts/bootstrap-pi
. All pi compute modules shipped with AmpliPi's have already been configured using this script, so this step should not be necessary. Running the script without any arguments will print the instructions. After this step is done SSH is enabled from a fresh Raspberry Pi OS at [amplipi.local]. - [amplipi.local] should now be hosted on your network.