Hi all,
I’am just getting started on Balena here. Using BalenaCloud and the BalenaCLI on my Mac to get the files together and push this to builder to create the images.
My idea was to make a generic image for some RPIs, while they not all need the same apps running as they have different purposes. So I can just run the apps I need. This way, I have one fleet with 3 to 5 devices. Otherwise, I need to make more fleets as each RPI has slightly different purpose and requires slightly different apps to run (let me know if this would be a better approach then my thought)
So, I want to run multiple apps on a single device. I followed this tutorial and manages to get it working. Well, the port-mapping didn’t work yet but I think I forgot some quotes
Now, this tutorial talks about the docker-compose.yml
file and how you should modify this. And here is the catch. I want to run besides other apps, the app Anthias (former Screenly OSE). In the installation guide from Anthias you’ll use a script to start the installation rather then a docker-compose file:
$ ./bin/deploy_to_balena.sh \ --board $BOARD_TYPE \ --fleet $FLEET_NAME \
How do I go about and incorporate one into the other? I am clearly lacking knowledge here! Ie, how do I use the docker-compose.yml
that other apps need to be installed and these ‘starting lines’ at the same time?
Any help would be much appreciated.
Should it make any difference, I am running a RPI3 at the moment but a RPI4 is on its way. The whole fleet should be RPI4’s in the future.
Best regards,
Arjan
Solved it by further examining the bash script. It composes a .yml
file after all but puts some environmental variables in it.
Will test next week but I should be ok
Ok, if someone could be of any help that would be appreciated.
Starting back off at the basic guide to merge two apps on one system I mentioned earlier (this one).
This guide seems to be written on an older version of Balena. It mentiones merging two .yml
files into one. I’ve come to the conclusion that there are under services:
a hostname
section in both .yml
files and that does not get mentioned in the guide.
How would I combine those into one? I’ve tried to leave one out but that does not seem to work. Only half of the services are up (the sound-part). I can’t reach the pihole side of things anywhere.
For reference
pihole yml
version: "2.1"
volumes:
pihole_config: {}
dnsmasq_config: {}
tailscale: {}
services:
pihole:
build: pihole
cap_add:
- SYS_TTY_CONFIG
- NET_ADMIN
volumes:
- "pihole_config:/etc/pihole"
- "dnsmasq_config:/etc/dnsmasq.d"
dns:
- "127.0.0.1"
- "1.1.1.1"
network_mode: host
labels:
io.balena.features.dbus: "1"
devices:
- /dev/tty0
- /dev/tty1
tmpfs:
- /var/log/pihole
environment:
DNSMASQ_LISTENING: all
PIHOLE_DNS_: 1.1.1.1;1.0.0.1
FONTFACE: Terminus
FONTSIZE: 8x14
WEBPASSWORD: balena
VIRTUAL_HOST: balena-devices.com
WEB_BIND_ADDR: 0.0.0.0
unbound:
build: unbound
cap_add:
- NET_ADMIN
ports:
- "5053:5053/tcp"
- "5053:5053/udp"
# https://github.com/balena-labs-projects/fbcp
# https://hub.balena.io/blocks/1792683/fbcp
fbcp:
image: bh.cr/balenalabs/fbcp/1.0.4
privileged: true
# https://github.com/balenablocks/hostname
# https://hub.balena.io/blocks/1918776/hostname-rpi
hostname:
image: bh.cr/g_tomas_migone1/hostname-rpi/0.2.1
restart: no
labels:
io.balena.features.supervisor-api: 1
environment:
SET_HOSTNAME: pihole
# https://hub.docker.com/r/tailscale/tailscale
# https://github.com/tailscale/tailscale/blob/main/cmd/containerboot/main.go
# https://tailscale.com/kb/1282/docker
# https://tailscale.com/kb/1278/tailscaled
# https://tailscale.com/kb/1241/tailscale-up
# https://tailscale.com/kb/1242/tailscale-serve
# https://tailscale.com/kb/1311/tailscale-funnel
tailscale:
image: tailscale/tailscale:v1.70.0@sha256:19c66f261912cd19fa5362d36cf6f4770ad6f273b410f940a0eba39b376fe326
restart: unless-stopped
environment:
TS_STATE_DIR: /var/lib/tailscale
TS_SOCKET: /var/run/tailscale/tailscaled.sock
TS_USERSPACE: false
TS_AUTH_ONCE: false
TS_HOSTNAME: pi-hole
TS_EXTRA_ARGS: --accept-dns=false --reset
network_mode: host
cap_add:
- NET_ADMIN
- NET_RAW
- SYS_MODULE
labels:
io.balena.features.kernel-modules: 1
tmpfs:
- /tmp
- /run
volumes:
- tailscale:/var/lib/tailscale
entrypoint:
- /bin/sh
- -c
command:
- |
modprobe tun || true
modprobe wireguard || true
mkdir -p /dev/net
[ ! -c /dev/net/tun ] && mknod /dev/net/tun c 10 200
/usr/local/bin/containerboot
Balena-sound yml
version: "2"
volumes:
spotifycache:
services:
# Core services
# -- Required for a fully featured installation of balenaSound
# -- Mutiroom services can be removed if not using multiroom mode
audio:
build: ./core/audio
privileged: true
labels:
io.balena.features.dbus: 1
ports:
- 4317:4317
sound-supervisor:
build:
context: .
dockerfile: ./core/sound-supervisor/Dockerfile.template
network_mode: host
labels:
io.balena.features.balena-api: "1"
io.balena.features.supervisor-api: 1
multiroom-server:
build: ./core/multiroom/server
restart: on-failure
ports:
- 1704:1704
- 1705:1705
- 1780:1780
multiroom-client:
build: ./core/multiroom/client
restart: on-failure
# Plugins
# -- Additional plugins can be added. See https://balena-sound.pages.dev/plugins
# -- Remove unwanted plugins as needed
bluetooth:
build: ./plugins/bluetooth
restart: on-failure
network_mode: host
cap_add:
- NET_ADMIN
labels:
io.balena.features.dbus: 1
airplay:
build: ./plugins/airplay
restart: on-failure
network_mode: host
privileged: true
labels:
io.balena.features.dbus: 1
spotify:
build: ./plugins/spotify
restart: on-failure
privileged: true
network_mode: host
volumes:
- spotifycache:/var/cache/raspotify
# https://github.com/balenablocks/hostname
hostname:
build: ./core/hostname
restart: no
labels:
io.balena.features.supervisor-api: 1
environment:
SET_HOSTNAME: balena
Any help appreciated! Thanks