Giter VIP home page Giter VIP logo

balena-multiapp-project's Introduction

Balena multi-app sample

This project demonstrates how to deploy an app that combines multiple existing balena apps into a single docker-compose.yml file.

We want to build an application that has the following features:

  • Bluetooth audio capabilities (as seen in the bluetooth-audio container on the balenaSound project)
  • Turn device into a hotspot to configure WiFi if no active connection (as seen in the wifi-connect project)
  • Simple nodejs server (as seen in the simple-server-node project)

We can achieve this quite easily in two steps:

  1. Get code from existing repositories
  2. Build the docker-compose file

1. Get code from existing repositories

By using git submodules we can pull code from multiple repositories into our main repo. If you are not familiar with git submodules, please check out the section below.

From our project's root path we do:

git submodule add https://github.com/balena-io-projects/balena-sound/
git submodule add https://github.com/balena-io/wifi-connect
git submodule add https://github.com/balena-io-projects/simple-server-node

This will pull the code from our dependant repositories and link our project to the specific commit we want (current on master branch by default).

2. Build the docker-compose file

With the code already in place, we only need to create a docker-compose file that ties everything together. Note that we don't need to pull containers from apps if we don't need them. For example, we only need bluetooth-audio from balenaSound.

version: '2'

services:

  simple-server-node:
    build: ./simple-server-node
    ports:
      - 8080:80
    restart: always

  wifi-connect:
    build: ./wifi-connect
    network_mode: host
    privileged: true
    restart: always
    labels:
      io.balena.features.dbus: '1'

  bluetooth-audio:
    build: ./balena-sound/bluetooth-audio
    network_mode: host
    restart: always
    privileged: true
    labels:
      io.balena.features.dbus: 1
    volumes:
      - bluetoothcache:/var/cache/bluetooth

volumes:
  bluetoothcache:

Git submodules

Git allows you to include other Git repositories called submodules into a repository. This allows you to track changes in several repositories via a central one. Submodules are Git repositories nested inside a parent Git repository at a specific path in the parent repository’s working directory. A submodule can be located anywhere in a parent Git repository’s working directory and is configured via a .gitmodules file located at the root of the parent repository. This file contains which paths are submodules and what URL should be used when cloning and fetching for that submodule. Submodule support includes support for adding, updating, synchronizing, and cloning submodules. Git allows you to commit, pull and push to these repositories independently. Submodules allow you to keep projects in separate repositories but still be able to reference them as folders in the working directory of other repositories.

For more information check out this links:

balena-multiapp-project's People

Contributors

tmigone avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.