-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1590 from FlowFuse/gdziuba-blog-balena-how-to
Blog balena and FlowFuse
- Loading branch information
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
src/blog/2024/01/how-to-deploy-node-red-with-flowfuse-to-balenacloud.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
--- | ||
title: Step-by-Step Guide to Deploying Node-RED with FlowFuse in balena Cloud | ||
subtitle: Fleet management made easier with FlowFuse and balena. | ||
description: Fleet management made easier with FlowFuse and balena. | ||
date: 2024-01-30 | ||
authors: ["grey-dziuba"] | ||
image: blog/2024/01/images/balena-and-flowfuse.png | ||
tags: | ||
- posts | ||
- flowfuse | ||
- how-to | ||
--- | ||
|
||
In a [recent webinar with balena](https://flowfuse.com/webinars/2024/balena/), we explored the dynamic capabilities of deploying FlowFuse to a fleet of devices using balena Cloud. This blog post serves as a practical guide to replicate that process, specifically tailored for those aiming to streamline their deployment of FlowFuse in an efficient and user-friendly manner. | ||
|
||
<!--more--> | ||
|
||
# How to Implement FlowFuse with balena Cloud on a Fleet of devices | ||
|
||
[![Deploying Node-RED with FlowFuse in balena Cloud](https://i.ytimg.com/vi/cKFu1ljUlKE/hqdefault.jpg)](https://www.youtube.com/watch?v=cKFu1ljUlKE "Deploying Node-RED with FlowFuse in balena Cloud") | ||
|
||
|
||
## Preparation Steps | ||
Before diving into the deployment process, it's crucial to familiarize yourself with key resources. We recommend reviewing our previous [blog post](https://flowfuse.com/blog/2023/11/device-agent-balena/) on deploying the FlowFuse Device Agent via balena. This post contains a vital link to the GitHub repository, essential for deploying FlowFuse with balena, laying the groundwork for the steps ahead. | ||
|
||
## Creating a New Fleet in balena Cloud | ||
1. Navigate to the [FlowFuse git](https://github.com/FlowFuse/balena-device-agent) repository. Click on the **Deploy with balena** button. | ||
2. Name your fleet. | ||
3. Select your default device. | ||
4. Click **Create and Deploy**. | ||
|
||
## Adding Devices to the Fleet | ||
Once your fleet is created, the next step is to add devices. To add a device to your fleet, follow these [instructions](https://docs.balena.io/learn/getting-started/var-som-mx6/rust/#add-a-device-and-download-os). | ||
|
||
## Setting Up FlowFuse | ||
Setting up FlowFuse correctly is essential for seamless operation: | ||
1. Create a new instance within FlowFuse or use an existing one if you prefer. Follow these [instructions](https://flowfuse.com/docs/user/introduction/#creating-a-node-red-instance) to create a new instance. | ||
2. Create a **Device Provisioning Token** by following these [instructions](https://flowfuse.com/docs/device-agent/register/#generating-%22provisioning-configuration%22). | ||
3. Ensure you add the FlowFuse Node-RED application you want the devices to provision. If left at default, devices will need to be manually added to applications. | ||
|
||
## Using the Device Provisioning Token | ||
1. First, convert the contents of the Device Provisioning Token to base64. Follow these [instructions](https://flowfuse.com/blog/2023/11/device-agent-balena/#environment-variable) to convert the file to base64. | ||
2. Once converted, import this string into balena as a **Fleet** level variable, not a device level variable. Follow these [instructions](https://docs.balena.io/learn/manage/variables/#fleet-wide-variables) to import the Fleet level variable with the Name `FF_DEVICE_YML`. | ||
3. This action will provision any new device added to the fleet with the yaml file configuration, automatically adding the device to a FlowFuse instance. | ||
|
||
## Deploying and Testing the FlowFuse Instance | ||
Deploying the FlowFuse instance brings everything together: | ||
1. Navigate to your FlowFuse application created earlier. | ||
2. Go to your devices and you should now see your newly provisioned devices from balena. | ||
3. If this is your first time setting up your fleet, the device will not have a snapshot. You will need to deploy a snapshot. Follow these [instructions](https://flowfuse.com/docs/user/snapshots/#create-a-snapshot) to do so. Ensure that you select **Set Target Snapshot**. | ||
4. Once complete, the FlowFuse instance will deploy to your device(s). | ||
|
||
# Integrating InfluxDB (Optional) | ||
Integrating InfluxDB enables effective data storage and management: | ||
1. Similar to the previous steps, navigate to this [Github repository](https://github.com/mpous/flowfuse-agent-influx-balena/tree/main?tab=readme-ov-file) and click **Deploy with balena**. | ||
2. This time, instead of creating a new fleet, select **Use an existing fleet instead**. | ||
3. Choose your fleet for deployment and select **Deploy to fleet**. | ||
|
||
## Data Generation and Management | ||
For testing, we have created a flow to get you started. Follow this [link](https://flows.nodered.org/flow/66f37bb739b6cdb0c7ad3a4e2edd68ef) and import it. There are four sets of flows for you to begin with. The first is for data generation. The second is a manual data generation flow. The third is key as it initiates the creation of a database, in this case, **mydb**. The last flow is a simple query that pulls data from InfluxDB. | ||
1. Import the flows into your FlowFuse instance of Node-RED and deploy. Follow these [instructions](https://flowfuse.com/blog/2023/03/3-quick-node-red-tips-5/#2.-import-helpful-example-flows-provided-with-custom-nodes) for importing and exporting. | ||
2. Return to Flowfuse, go to your instance, and create another [snapshot](https://flowfuse.com/docs/user/snapshots/#create-a-snapshot). | ||
3. Ensure that you **Set Target Snapshot**. | ||
|
||
## Finalizing and Testing the Setup | ||
The final steps ensure that your setup is fully operational: | ||
1. Once deployed, navigate to the device. | ||
2. [Enable Developer Mode](https://flowfuse.com/docs/device-agent/deploy/#editing-the-node-red-flows-on-a-device-that-is-assigned-to-an-application). | ||
3. Next, click the newly revealed button, **Open Editor**, to access the deployed Flow. | ||
|
||
## Conclusion | ||
Implementing FlowFuse with balena Cloud significantly enhances your device management and data processing capabilities. This guide provides a foundational approach, but don't hesitate to delve deeper into each step to tailor the setup to your specific needs. | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.