Skip to content

Commit

Permalink
working omada support
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoffWilliams committed Dec 7, 2023
1 parent 78444ea commit 84fac31
Show file tree
Hide file tree
Showing 9 changed files with 141 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
deploy/*
work/*
config
postrun.sh
SKIP
SKIP_IMAGES
Expand Down
67 changes: 67 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,70 @@
# omadapi

## Whats this?
A fork of []pi-gen](https://github.com/RPi-Distro/pi-gen/) to build a custom image for omada on raspberry pi (~4)

Features:
* [MongoDB 4.4.26](https://github.com/GeoffWilliams/mongodb-raspberrypi-binaries/releases/tag/v4.4.26)
* OpenJDK 17
* Plug and play - just burn the image ssh in on ethernet (look for IP address on router)
* Omada 5.12.7 is already installed and set to start automatically
* Default username: `omada`
* Default password: `omada`
* Default hostname `omadapi` (your router may register this if you run something good like OpenWrt)
* Access via ssh
* **CHANGE THE PASSWORD!!!**

## Omada
When booted, omada will be available at:
* http: [http://omadapi:8088](http://omadapi:8088) (redirects to TLS port)
* https: [https://omadapi:8043](https://omadapi:8043)

Ehere `omadapi` is the hostname or IP address of the pi. TLS certificate is self-signed so you have to click-through the browser security warning.

## Start/stop omada

```shell
/etc/init.d/tpeap start
/etc/init.d/tpeap stop
```

## Logs?

In `/opt/tplink/EAPController/logs/`

## Start/stop mongodb

Dont - its controlled automatically by omada

## Upgrades

Follow the vendor instructions to update the omada debian package. Once installed you have a regular Linux system with the package installed (no docker, etc - although that might be worth looking at).

## Testing

What testing have you done?

* Basically none - it boots and the login screen loads
* Im waiting to unpack and setup my access points

## Gotchas
* Probably have to tweak the JVM args to set max heap on a low memory pi. This starts for me on a Pi 4 1gb but its not been running long yet
* Might need a big-ish SD card (32gb?)
* From tp-link? Please feel free to make some raspbery pi image for the community based on this!

## Status
Just for fun :) I dont have much time to maintain this so im "donating this to the community".

Interested to help? Please open a ticket...






# Upstream docs below


# pi-gen

Tool used to create Raspberry Pi OS images. (Previously known as Raspbian).
Expand Down
16 changes: 16 additions & 0 deletions config
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
IMG_NAME=omadapi
# no mongo builds for bookworm
RELEASE=bookworm
LOCALE_DEFAULT="en_US.UTF-8"
TARGET_HOSTNAME="omadapi"
KEYBOARD_KEYMAP=us
KEYBOARD_LAYOUT="English (US)"
TIMEZONE_DEFAULT=UTC
FIRST_USER_NAME=omada
FIRST_USER_PASS=omada
ENABLE_SSH=1
STAGE_LIST="stage0 stage1 stage2 stageomada"
# this is my home apt cache - get lots of failing builds without a cache...
# im running squid-deb-proxy
APT_PROXY=http://squid.lan.asio:8000
DISABLE_FIRST_BOOT_USER_RENAME=1
2 changes: 2 additions & 0 deletions stageomada/00-mongodb/00-packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
gnupg
curl
15 changes: 15 additions & 0 deletions stageomada/00-mongodb/01-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
#
# https://github.com/themattman/mongodb-raspberrypi-binaries provides arm64 binaries but not for 4.4:
# * https://github.com/themattman/mongodb-raspberrypi-binaries/issues/6
#
# So i create my own package (USE AT OWN RISK!)
# * https://github.com/GeoffWilliams/mongodb-raspberrypi-binaries/releases/tag/v4.4.26

on_chroot << EOF
mkdir -p /packages
cd /packages
curl -LO https://github.com/GeoffWilliams/mongodb-raspberrypi-binaries/releases/download/v4.4.26/mongodb-org-server-raspberrypi_4.4.26_arm64.deb
apt install -y /packages/mongodb-org-server-raspberrypi_4.4.26_arm64.deb
EOF

4 changes: 4 additions & 0 deletions stageomada/00-packages/00-packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
wget
openjdk-17-jdk-headless
jsvc
chromium
28 changes: 28 additions & 0 deletions stageomada/10-omada/00-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
# https://www.tp-link.com/au/support/download/omada-software-controller/#Controller_Software
on_chroot << EOF
mkdir -p /packages
cd /packages
wget https://static.tp-link.com/upload/software/2023/202309/20230920/Omada_SDN_Controller_v5.12.7_Linux_x64.deb
# wonder why this is needed...?
# https://superuser.com/questions/1469602/tp-link-omada-controller-cannot-find-any-vm-in-java-home-usr-lib-jvm-default
mkdir /usr/lib/jvm/java-17-openjdk-arm64/lib/arm64
ln -s /usr/lib/jvm/java-17-openjdk-arm64/lib/server /usr/lib/jvm/java-17-openjdk-arm64/lib/arm64/
# nasty hack to prevent trying to run omada in quemu
mv /usr/bin/jsvc /usr/bin/jsvc.nouse
echo "exit 0" >> /usr/bin/jsvc
apt install -y ./Omada_SDN_Controller_v5.12.7_Linux_x64.deb
mv /usr/bin/jsvc.nouse /usr/bin/jsvc
# omada does something strange with the mongod binary
if [ -e /mongod ] ; then
rm /mongod
fi
ln -s /usr/local/bin/mongod /opt/tplink/EAPController/bin/mongod
# omada self enables on boot so were done
EOF
4 changes: 4 additions & 0 deletions stageomada/EXPORT_IMAGE
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
IMG_SUFFIX="-full"
if [ "${USE_QEMU}" = "1" ]; then
export IMG_SUFFIX="${IMG_SUFFIX}-qemu"
fi
5 changes: 5 additions & 0 deletions stageomada/prerun.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash -e

if [ ! -d "${ROOTFS_DIR}" ]; then
copy_previous
fi

0 comments on commit 84fac31

Please sign in to comment.