- Enable wsl2
- Set default wsl version to 2
wsl --set-default-version 2
- Install Ubuntu for Windows (make sure to run it once to initialize and create an account)
- Once installed, make sure the version is correct:
wsl --list -v NAME STATE VERSION Ubuntu Running 2 ...
- Set Ubuntu as your default distribution:
wsl --setdefault Ubuntu
- Restart Docker (so it will pickup Ubuntu as default WSL)
- Run the disto:
wsl
- Make sure docker is installed
docker --version
- Install the dependencies inside the distro:
-
Create the cluster
./Scripts/CreateCluster.sh
-
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).
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.
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
- 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) - 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.
-
Create a new folder inside
Sources/{framework}/Services
with the name of the new servicemkdir Sources/{framework}/Services/{NewServiceName}
Make sure you follow the naming convention of PascalCase
-
Navigate to the folder
SystemCharts/ServiceChart/ServicesValues
and add a values file for the service- Clone one of the other files and change the service name to the new service name (PascalCase)
serviceName: {ServiceName}
- 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"
- If you need kafka:
- Clone one of the other files and change the service name to the new service name (PascalCase)
This is a work in progress and more documentation will follow.