As it sits right now this is what I’ve got:
dockercompose.yml
Located in /projectfolder
Inside the /projectfolder
are these files
CHANGELOG.md README.md docker-compose.yml
CONTRIBUTING.md VERSION wpe-browser
FAQ.md accelerometer repo.yml wifi-connect
dockercompose.yml looks like this:
version: '2'
services:
wpe-browser:
restart: always
build: ./wpe-browser
ports:
- 8080:8080
wifi-connect:
build: ./wifi-connect
restart: always
network_mode: host
privileged: true
labels:
io.balena.features.dbus: '1'
io.balena.features.firmware: '1'
dockerfile.template
located inside of /projectfolder/wifi-connect
Inside the /projectfolder
are these files:
CHANGELOG.md LICENSE rustfmt.toml ui
Cargo.lock ManualTests.md scripts versionist.conf.js
Cargo.toml README.md src
Dockerfile.template package-lock.json start.sh
The dockerfile.template looks like this:
FROM balenalib/%%BALENA_MACHINE_NAME%%-ubuntu:latest
RUN sudo apt-get -y update && \
sudo apt-get -y install bluez build-essential cmake git libglib2.0-dev dnsmasq openjdk-8-jdk pkg-config sqlite3 wireless-tools && \
sudo apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-arm64
WORKDIR /usr/src/wifi-connect
RUN curl https://api.github.com/repos/balena-io/wifi-connect/releases/latest -s \
| grep -hoP 'browser_download_url": "\K.*%%BALENA_ARCH%%\.tar\.gz' \
| xargs -n1 curl -Ls \
| tar -xvz -C /usr/src/wifi-connect/
WORKDIR /usr/src/wifi-connect/
COPY ./start.sh ./
CMD ./start.sh
I tried omitting the network-manager
line, however the problem was not solved and I received a new error saying nmcli: command not found
. This goes away if I change:
# 2. Is there Internet connectivity? #nmcli -t g | grep full
back to
# 3. Is there Internet connectivity via a google ping? wget --spider http://google.com 2>&1
Inside the start.sh file. This makes me think maybe the container isn’t accessing network-manager since nmcli
is part of the network-manager package.
start.sh
Also located in /projectfolder/wifi-connect
looks like this:
#!/usr/bin/env bash
export DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket
sleep 10
while [[ true ]]; do
# Choose a condition for running WiFi Connect according to your use case:
# 1. Is there a default gateway?
# ip route | grep default
# 2. Is there Internet connectivity?
#nmcli -t g | grep full
# 3. Is there Internet connectivity via a google ping?
wget --spider http://google.com 2>&1
# 4. Is there an active WiFi connection?
# iwgetid -r
if [ $? -eq 0 ]; then
printf 'Skipping Wifil Connect\n'
else
printf 'Starting Wifi Connect\n'
# UI directory, timeout, SSID, port
./wifi-connect -u /ui -a 600 -s SSID_NAME -o 80
fi
# wait 30 seconds before checking again for internet connectivity
sleep 30
done
As for ui changes, even if I don’t make changes, or even exclude the -u
option, it still doesn’t want to display the page, not when it’s inside the docker container. I can make it run by itself but even then cannot get -u
option to work. Perhaps my syntax above and below is wrong:
./wifi-connect -u /ui -a 600 -s SSID_NAME -o 80
And as to what changes I’m trying to implement, they are simple logo changes made by replacing the files with another file of the same name.
This is all for a raspberry pi 3B+
Perhaps we can start from the top, with everything that would need to be done to get this to work. I’m finding bits and pieces online but nothing coherent.