Skip to content

Commit 7eaa0c2

Browse files
authored
Add starter interface (#28) should solve #8 #7 #29
* feat: add starter interface * chore: add Dockerfile and config.yml * fix: logo.svg within context * fix: cleanup of interface Dockerfile * chore: remove wifi-connect * fix: add python-wifi-connect, set custom title and link interface folders to other services * fix: add bridge mode to starter interface * feat: add standalone python captive-portal * fix: right path for captive-portal service * Revert "feat: add standalone python captive-portal" This reverts commit 9fba3c3 * Revert "fix: right path for captive-portal service" This reverts commit 4fb1d26. * fix: svg customization for interface * feat: switch to image of own fork of balena interface * chore: add PORTAL_PORT var to balena-interface * fix: expose port 8079 por balena interface * chore: up version to v0.4.3 and set appropriate envs to balena.yml * fix: hardcoded DBUS_SYSTEM_BUS_ADDRESS for python-wifi-connect * chore: set PORTAL_PORT on balena.yml * fix: set NETWORK_MODE on docker-compose environment directly * feat: switch to using edt-offline-portal full nightly image * fix: correct docker image for edt-offline-portal
1 parent 8c2d06d commit 7eaa0c2

15 files changed

+389
-17
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Cloud crawler
2+
on:
3+
push:
4+
tags:
5+
- 'v[0-9]+.[0-9]+.[0-9]+'
6+
jobs:
7+
crawl:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v2
12+
- name: Generate .env file
13+
run: cp docker/cloud/.env.example docker/cloud/.env
14+
- name: Build the stack
15+
run: sh ./scripts/crawl.sh
16+
- name: Upload files
17+
uses: actions/upload-artifact@v3
18+
with:
19+
name: edt-warcz
20+
path: /opt/app/*.warcz

balena.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: "Earth Defender's Toolkit Offline"
22
type: "sw.application"
3-
version: 0.4.2
3+
version: 0.4.3
44
description: "A low-energy device that creates an access-point serving applications, bridging them and exposing curated content offline.
55
Software stack and content are automatically updated while online, and can be updated offline."
66
assets:
@@ -16,8 +16,15 @@ data:
1616
applicationConfigVariables:
1717
- BALENA_HOST_CONFIG_gpu_mem: 64
1818
applicationEnvironmentVariables:
19+
# BALENA INTERFACE
20+
SET_HOSTNAME: "edt"
21+
UDEV: on # Enables ability to auto mount USB drives in to the container
22+
PORTAL_PORT: 8080
1923
# WIFI
20-
PORTAL_SSID: Earth_Defenders_Toolkit
24+
PWC_HOTSPOT_SSID: "Earth_Defenders_Toolkit" # Name as it appears in list of WiFi networks
25+
PWC_PORT: 9090
26+
# PWC_HOTSPOT_PASSWORD: "balena01" # Optional. Must be 8 characters or more
27+
# PWC_INTERFACE: "wlan0"
2128
# MAPEO BRIDGE
2229
MAPEO_PROJECT_KEY: af43cbdb6827d3ddc5b39b20df174bf5c3e44d9bbcdccfe034af090440cebf69
2330
MAPEO_STORAGE_PATH: /usr/src/output

docker-compose.yml

+32-13
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,48 @@ volumes:
1515
terrastories-data:
1616
terrastories-media:
1717
terrastories-import:
18+
bdi_db:
19+
pwc_db:
1820
services:
19-
# https://github.com/balenablocks/hostname
20-
hostname:
21-
image: balenablocks/hostname:latest
22-
restart: "no"
21+
# https://github.com/digidem/starter-interface
22+
balena-interface:
23+
build: services/interface
24+
restart: always
25+
environment:
26+
NETWORK_MODE: bridge
27+
ports:
28+
- "80:80"
29+
- "8079:8079"
30+
volumes:
31+
- "bdi_db:/app/db" # Stores UI database files
32+
- crawls:/app/storage/websites
33+
- mapeo:/app/storage/mapeo
34+
- fdroid:/app/storage/fdroid
35+
- installers:/app/storage/installers
36+
- terrastories-import:/app/storage/terrastories/import
37+
- terrastories-media:/app/storage/terrastories/media
38+
privileged: true # This can be removed if not using the USB mounting feature
2339
labels:
2440
io.balena.features.supervisor-api: 1
41+
io.balena.features.balena-api: 1
42+
# https://github.com/balena-labs-research/python-wifi-connect
43+
python-wifi-connect:
44+
image: ghcr.io/balena-labs-research/python-wifi-connect:latest
2545
environment:
26-
SET_HOSTNAME: edt
27-
# https://github.com/balena-os/wifi-connect
28-
wifi:
29-
restart: always
30-
build: services/wifi-connect
46+
PWC_HOST: bridge
47+
DBUS_SYSTEM_BUS_ADDRESS: "unix:path=/host/run/dbus/system_bus_socket"
3148
network_mode: "host"
49+
restart: on-failure
50+
volumes:
51+
- "pwc_db:/app/db" # Optional if not setting the hotspot ssid and password via the API
3252
labels:
3353
io.balena.features.dbus: "1"
3454
cap_add:
3555
- NET_ADMIN
36-
environment:
37-
DBUS_SYSTEM_BUS_ADDRESS: "unix:path=/host/run/dbus/system_bus_socket"
38-
# https://hub.docker.com/_/httpd
56+
privileged: true # This can be removed if you do not need the LED connectivity indicator.
57+
# https://hub.docker.com/r/communityfirst/edt-offline-portal
3958
portal:
40-
build: services/portal
59+
image: communityfirst/edt-offline-portal:nightly-full
4160
restart: always
4261
volumes:
4362
- "portal:/usr/local/apache2/htdocs"

docker/demo/docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ volumes:
1818
terrastories-import:
1919
services:
2020
portal:
21-
build: ../../services/portal
21+
image: communityfirst/edt-offline-portal:nightly-full
2222
restart: always
2323
volumes:
2424
- 'portal:/usr/local/apache2/htdocs'

docker/demo/reset_services.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
( crontab -l 2>/dev/null | grep -Fv ntpdate ; printf -- "*/3 * * * * /usr/sbin/ntpdate 192.168.2.3" ) | crontab
3+
4+
docker compose -f $PATH/docker/demo/docker-compose.yml down -v
5+
docker compose up -d

docker/local/docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ services:
3030
PORTAL_SSID: ${PORTAL_SSID}
3131
# https://hub.docker.com/_/httpd
3232
portal:
33-
build: ../../services/portal
33+
image: communityfirst/edt-offline-portal:nightly-full
3434
restart: always
3535
volumes:
3636
- 'portal:/usr/local/apache2/htdocs'

scripts/generate-local-docker.sh

Whitespace-only changes.

scripts/generate-server-docker.sh

Whitespace-only changes.

scripts/update_demo.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
git pull origin main
4+
docker compose -f docker/demo up -d --build

services/interface/Dockerfile

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM communityfirst/balena-interface:latest
2+
3+
COPY config.yml .
4+
5+
# Optionally copy in your own header logo to replace the default.
6+
COPY ./custom/logo_colour.svg public/logo_colour.svg
7+
COPY ./custom/logo_white.svg public/logo_white.svg
8+

services/interface/config.yml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
pages:
2+
#####
3+
# A list of pages from ui/src/pages to load and the ui/src/components to show on each one.
4+
#
5+
# Example that creates an Environment Variable configuration interface:
6+
#
7+
# ----------------------------------------------------------------------------------------------------
8+
# IndexPage:
9+
# frames:
10+
# 1:
11+
# components: [SystemEnvConfig]
12+
# icon: settings # The label from Google Material Icons to display in the sidebar: https://fonts.google.com/icons
13+
# label: yml_config.environment_variables # The i18n key from ui/src/i18n/en-US.json to use as sidebar text. Only use `yml_config` keys!
14+
# ----------------------------------------------------------------------------------------------------
15+
#
16+
# All the other sections are removed so you only see the environment variable configuration
17+
#
18+
#####
19+
IndexPage: # This page cannot be removed
20+
frames:
21+
1:
22+
components: [SystemDeviceInfo]
23+
# Path will always be '/'
24+
icon: visibility
25+
label: yml_config.device_info
26+
FileManager:
27+
frames:
28+
1:
29+
components: [ToolsFileManager]
30+
path: filemanager
31+
icon: folder
32+
label: yml_config.file_manager
33+
Configuration:
34+
frames:
35+
1:
36+
components: [SystemChangeHostname]
37+
title: yml_config.network_config
38+
2:
39+
components: [SystemEnvConfig]
40+
title: yml_config.environment_variables
41+
path: configuration
42+
icon: settings
43+
label: yml_config.configuration
44+
ContainerManager:
45+
frames:
46+
1:
47+
components: [ToolsContainerManager]
48+
path: containermanager
49+
icon: all_inbox
50+
label: yml_config.container_manager
51+
Networking:
52+
frames:
53+
1:
54+
components: [WifiConnect]
55+
path: networking
56+
icon: router
57+
label: yml_config.networking
58+
SystemInfo:
59+
frames:
60+
1:
61+
components: [SystemJournalDLogs, ToolsSystemInfo]
62+
path: systeminfo
63+
icon: info
64+
label: yml_config.system_info
65+
captive_portal:
66+
welcome_page: true
67+
styles:
68+
header:
69+
visible: true # Whether the header logo should be visible
70+
language_selector: true # Show the language selector in the header bar
71+
reboot_icon: true # Show the reboot icon in the header bar
72+
shutdown_icon: true # Show the shutdown icon in the header bar
73+
title: "EDT Offline"

0 commit comments

Comments
 (0)