I am experimenting with davinci-code-edit as a way to tune a kubernetes manifest file (in yaml) based on input from the user. The manifest is used to load and run a containerized application.
The application in question can have up to three containers that the manifest will load; which parts should be loaded depend on what the user requests.
For instance, there is a section of the file which is used to spin up a server to access a camera, and an matching section which makes that camera server available as a service to the other program components. If there is no camera, both those sections of the manifest should be deleted.
I can successfully use the Codex editing api to remove first one section (“remove the camera-deployment section”), and then the second section (“remove the camera-service section”), by doing successive calls to the API. I can change all the time-zone environment variables in the manifest with a 3rd call.
Is there a way to combine edit requests into a single instruction? A way to “&” two edits together, e.g. “remove the camera-deployment section AND remove the camera-service section” ? I’ve tried a number of phrasings in the playground but only one of the editing requests actually gets processed.
I’ve written a python program that successfully customizes the manifest via serial calls, but it tends to run into rate-limiting errors.
iarflam
2
Hi, you can write what you want in the comments (line by line).
Example:
/*
* Generate bash script for Docker
* Three containers: Apache2, Portainer and MySQL
* Start a website (test.myawesome.fr), the source code is locate in ~/pouet
*/
#!/bin/bash
And Codex complete with:
# Create a network
docker network create myawesome
# Create a container for Apache2
docker run -d --name apache2 --network myawesome -p 80:80 -v ~/pouet:/var/www/html/ -v ~/pouet/apache2/sites-enabled:/etc/apache2/sites-enabled/ -v ~/pouet/apache2/logs:/var/log/apache2/ -v ~/pouet/apache2/conf:/etc/apache2/conf-enabled/ httpd:2.4
# Create a container for Portainer
docker run -d --name portainer --network myawesome -p 9000:9000 -v ~/pouet/portainer/data:/data portainer/portainer
# Create a container for MySQL
docker run -d --name mysql --network myawesome -p 3306:3306 -v ~/pouet/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=root mysql:5.7
It should be noted that he understood the link between the web site and Apache2. 