Kakawa
Português
Português
  • Overview
    • Introduction
      • Features
      • Use cases
      • FAQ
    • Getting started
  • Device usage
    • First steps
      • Connecting to the internet
      • Syncing content
      • Exploring content
    • Bundled applications
      • Mapeo Data Hub
        • Syncing with Hub
        • Observations map
        • Mapeo Observations as Terrastories Places
        • Customization
      • Pataka
      • Terrastories
      • File management
        • Storing locally
        • Sharing locally
      • Content syncronization
      • Application installers
      • Tile server
    • Managing device
    • Customizing experience
  • Device setup
    • Introduction
    • Choosing a device
    • Single-board-computers
    • Regular computers
    • Using Balena Cloud
    • Using Docker
    • Troubleshooting
  • Support Team
    • Onboarding new device
    • Devices dashboard
    • Online Cloud
      • Services
      • Customizing synced content
      • Managing EDT Cloud
      • Setting up EDT Cloud
  • For developers
    • Architecture overview
    • Repositories
    • Development workflow
    • Development devices
  • Translating
  • Support
  • Earth Defenders Toolkit Deploy
  • EDT Offline Demo
  • Latest Releases
Powered by GitBook
On this page
  • Tunneling to a development device
  • Using remote device
  • Setting up a virtual-machine
Export as PDF
  1. For developers

Development devices

PreviousDevelopment workflowNextTranslating

Last updated 1 year ago

Tunneling to a development device

In order to make it easier to debug and do QA testing on a feature or a release, it's helpful to expose the virtual device's services. We can use for that.

SSH into the virtual Balena device using the UUID which can be obtained from the Balena dashboard:

balena ssh <uuid>

Within the virtual Balena environment, run:

balena run -d \
    --name=tailscaled \
    --restart always \
    -e TS_STATE_DIR=/var/lib/tailscale \
    -v tailscale-state:/var/lib/tailscale \
    -v /dev/net/tun:/dev/net/tun \
    --network=host \
    --privileged \
    tailscale/tailscale tailscaled

And to start the tailscale service, run:

balena exec tailscaled tailscale up --advertise-routes=10.0.3.0/24 --accept-routes --reset

The Tailscale container will provide you a URL to access that adds the device to your Tailscale account.

Then from your Tailscale admin panel to be able to use all the devices locally through the IP addresses they are assigned by Balena Virt.

On your own machine run:

docker run -d \
    --name=tailscaled \
    --restart always \
    -e TS_STATE_DIR=/var/lib/tailscale \
    -v tailscale-state:/var/lib/tailscale \
    -v /dev/net/tun:/dev/net/tun \
    --network=host \
    --privileged \
    tailscale/tailscale tailscaled

And to start tailscale:

docker exec tailscaled tailscale up --advertise-routes=10.0.3.0/24 --accept-routes --reset

Don't forget to also enable the subnets. And now on your machine you should be able to access services on the balena device's ip.

Using remote device

In order for Terrastories and the offline map on both Terrastories and Observations Map to work remotely you'll need to set the device's variables to use the tunneled ip:

  • HOST_HOSTNAME ex.: 100.96.14.113

  • OFFLINE_MAP_STYLE ex.: http://100.96.14.113:8085/styles/terrastories-map/style.json

Setting up a virtual-machine

Make sure you have a Balena Fleet with generic x86_64 (GPT) as the Default device type.

On a Digital Ocean droplet with at least 25Gbs of storage and 1Gb of ram, and latest Docker pre-installed, run:

docker run -it \
    -d \
    --restart always \
    -v bv_pid:/app/pid \
    --device=/dev/kvm \
    --cap-add=net_admin \
    -e API_TOKEN="your_balena_token" \
    -e FLEET="your_balena_fleet" \
    -e MEM=1024M \
    -e DISK=20G \
    -e DEV_MODE=true \
    --network host \
    ghcr.io/balena-labs-research/balena-virt:latest

After a few seconds a new device should appear on your amd64 and should start updating itself with latest release for the Fleet.

Read details on the .

tailscale
enable the subnets
official repository