Skip to main content

Visual Studio Code extension

Overview

The Barbara Visual Studio Code Extension simplifies the development process by providing a single, integrated environment for creating, building, and deploying applications to the Barbara platform.

Barbara VSCode Extension

Barbara VSCode Extension

note

Install Barbara Visual Studio Code Extension from Visual Studio Marketplace.

Features

The extension provides the following features:

  • Project creation: Create new projects for Node.js or Python applications. The extension includes sample code and configuration files to help you get started.
  • Application upload: Upload your applications to the Barbara application library. This allows you to share your applications with other users and deploy them to edge nodes.
  • Application deployment: Deploy your applications to edge nodes managed by the Barbara platform. The extension handles the configuration and deployment process, so you can focus on developing your application.

Prerequisites

To use the extension, you must have the following:

  1. Visual Studio Code installed on your computer
  2. A Barbara platform account
  3. Barbara API credentials.
Barbara API Credentials

API Credentials are only available with Enterprise License.
Get in contact with our Support Team (support@barbara.tech) to upgrade your license if necessary.

Installation

In order to install the Barbara VSCode Extension you must follow next steps:

  1. Open the Extensions View: Launch Visual Studio Code and open the Extensions view. You can find it by going to the Extensions tab in the left sidebar or by using the shortcut Ctrl+Shift+X (Windows/Linux) or Cmd+Shift+X (macOS).

Open Extensions

Open Extensions

  1. Search and Install the Barbara Extension: Within the Extensions view, type Barbara in the search form. Once it appears, click the Install button.

Install VSIX file

Install VSIX file

  1. Open the Extension Settings: Click the Settings button (gear icon) and select Extension Settings in the expandable menu that appears once the button is clicked.

Click on extension settings

Click on extension settings

  1. Configure the Extension: You might need to enter the following details provided by the Barbara Support Team:

    • Client ID
    • Client Secret

    Your personal login credentials for Barbara Panel are also required:

    • Barbara Panel User
    • Barbara Password

Click on extension settings

Click on extension settings

  1. Verify Installation: To confirm successful installation, open the Command Palette (use Ctrl+Shift+P or Cmd+Shift+P) and type "Barbara".

Check Plugin Installation

Check Plugin Installation

You should see commands like:

  • Upload to Panel Library
  • Create a Python boilerplate
  • Create a NodeJS boilerplate

These commands indicate that the Barbara Extension is installed and ready to use.

Create a Sample Project (NodeJS or Python)

This extension simplifies project setup by generating boilerplate code for your Barbara application in either Node.js or Python. This boilerplate includes all the necessary files to get you started quickly.

Steps

  1. Open Visual Studio Code: Navigate to the desired folder where you want to create your application project.
  2. Access Barbara Commands: Open the Command Palette (use Ctrl+Shift+P or Cmd+Shift+P) and type "Barbara". This will display available extension commands.
  3. Choose Project Type: Select either Barbara: Create sample project Python or Barbara: Create sample project NodeJS depending on your preferred language.
  4. Specify Project Location (Optional): If you want to create the project in a different folder, choose "yes" when prompted and provide the desired folder name.
  5. Explore Project Structure: Open the Explorer (usually on the left sidebar) to see your newly created project. It will contain the following files:

NodeJS Boilerplate structure

NodeJS Boilerplate structure

  • docker-compose.yml: This file defines the production version of your application for deployment to the Barbara library.
  • docker-compose_dev.yml: This file configures Docker for development purposes, including links to development files and environment variables.
  • barbarasecrets.env: This file stores environment variables in a key-value format.
  • appconfigDev: This folder contains your application configuration files:
    1. appconfig.json: This file holds your application-specific configurations.
    2. globalconfig.json: This file contains global configuration settings.
  • imageSource: This folder houses the source code for your application, along with the Dockerfile that specifies base images, files to copy, and build instructions.
  • README.md: This file provides documentation for your application, including its functionality and configuration options.

Developing Your Application

Now you can modify the source code within the boilerplate to implement your application logic in your chosen language.

Development Tips
  • To expose communication ports in your application, declare them within the docker-compose file for external access.
  • If your application requires additional files within the generated Docker container, you'll need to add them to the Dockerfile to make them accessible to your application.

Deploying Applications with the Barbara Extension

This section explains how to use the Barbara extension to upload a new version of your application to the Panel Library and deploy it to your Edge Computing nodes.

tip
  • This extension allows uploading new versions of existing applications. You cannot create entirely new applications from the extension.
  • The target application you wish to update must already be available in the Panel.
See also...

Learn how to create applications in Panel Library in this guide.

To upload a new version to the target application we must follow next steps:

  1. Open the Command Palette: In the VSCode top bar, select the Show and Run Commands option and type barbara. A list of available commands will appear.
  2. Select "Barbara: Upload to apps": This will display a list of all applications created in your Panel. Choose the desired application and click Next.

Select Application

Select Application

  1. Define Version Name: Enter the name for this new version and press OK.

Select Version

Select Version

  1. Add Release Notes (Optional): Briefly describe any changes or updates included in this version.

Add Release Notes

Add Release Notes

  1. Select Upload Folder: Choose the directory containing your application. The extension will automatically detect folders with a docker-compose.ymlfile inside, indicating a deployable version.

Select folder to upload

Select folder to upload

  1. Deploy to a Node (Optional): Once the upload is complete, the extension will ask if you want to deploy the new version to a specific Edge Node.

Deploy new version?

Deploy new version?

Selecting NO finalizes the upload process. Selecting YES will display a list of all nodes available in your organization. Choose the target node for deployment.

Select device to deploy

Select device to deploy

tip

Following a successful upload using the Upload to Panel Library command, the extension will prompt a confirmation dialog for repeat actions with an automatically incremented version. This feature is designed to streamline your development workflow.

  • Repeat Action: Uploads the same folder to the Panel Library again, but with a version number automatically incremented. This option is ideal for quick iterations during development. The uploaded file will also be deployed to the previously selected device.
  • Start from the Beginning: Initiates the entire upload process from scratch, including folder selection and device targeting.