Skip to content

gionapaolini/ImprovedDevExperienceDemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Table of contents

Getting started

If you have Windows, you need additional steps first.

  1. Enable wsl2
  2. Set default wsl version to 2
    wsl --set-default-version 2
    
  3. Install Ubuntu for Windows (make sure to run it once to initialize and create an account)
  4. Once installed, make sure the version is correct:
    wsl --list -v
    
    
      NAME        STATE       VERSION
      Ubuntu      Running     2 
      ...
    
  5. Set Ubuntu as your default distribution:
    wsl --setdefault Ubuntu
    
  6. Restart Docker (so it will pickup Ubuntu as default WSL)
  7. Run the disto:
    wsl
    
  8. Make sure docker is installed
    docker --version
    
  9. Install the dependencies inside the distro:

Requirements

Setup

Initialize the platform

  1. Create the cluster

    ./Scripts/CreateCluster.sh
    
  2. Start the development environment

    ./Scripts/DeploySystem.sh
    

    The first time it will take more time (10-15m) because it needs to download all the images and install all the module dependencies (included 2 heavy ML models), after which it will take significantly less time (unless you destroy and re-create the cluster again, in that case it will need to re-pull all the images).

Development

This development environment is set up in such a way that the entire codebase (Source folder) is shared directly with the running containers within Kubernetes. This means that whatever change you do to the code, will automatically be synced.

How to restart a service

We use a watch tool to listen for changes to the filesystem, if a change is detected the service is automatically restarted.

With many services you might notice a decrease in performance if there are too many files to be watched. For this reason, when possible, we decide to watch only a single file, and modify that in case we want to restart the service. For example: for NodeJS applications we use nodemon to listen to one file only. You can just add a space, save, and nodemon will automatically restart the service without killing the entire pod.

For example by modifying Source/NodeJS/Services/IntentEditor/app.js you will restart the IntentEditor service

How to debug

Debug services

  1. From inside vscode, press Ctrl+Shift+D to open the Run and Debug window (Or click on the button with the play icon on the left menu)
  2. Select which Service you want to attach your debugger to, and press play.

You can attach to multiple service at the same time to debug multiple services.

How to create a new service

  1. Create a new folder inside Sources/{framework}/Services with the name of the new service

    mkdir Sources/{framework}/Services/{NewServiceName}
    

    Make sure you follow the naming convention of PascalCase

  2. Navigate to the folder SystemCharts/ServiceChart/ServicesValues and add a values file for the service

    1. Clone one of the other files and change the service name to the new service name (PascalCase)
      serviceName: {ServiceName}
      
    2. Add the environment variables that you need
      • If you need kafka:
        - name: KAFKA_SERVER_URL
          value: "cluster-resources-kafka:9092"
        - name: KAFKA_CLIENT_ID
          value: "{servicename}"            
        - name: KAFKA_CONSUMER_GROUP
          value: "{servicename}"
        
      • If you need mongodb:
        - name: MONGODB_SERVER_URL
          value: "mongodb://cluster-resources-mongodb:27017"
        
      And for anything else you might need just add it to the env list.

 

This is a work in progress and more documentation will follow.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published