Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 58 additions & 8 deletions agentuity.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,22 @@
},
"development": {
"type": "object",
"required": ["port", "watch", "command"],
"required": [
"port",
"watch",
"command"
],
"properties": {
"port": {
"type": "integer",
"description": "The port to run the development server on which can be overridden by setting the PORT environment variable"
},
"watch": {
"type": "object",
"required": ["enabled", "files"],
"required": [
"enabled",
"files"
],
"properties": {
"enabled": {
"type": "boolean",
Expand Down Expand Up @@ -71,7 +78,10 @@
},
"deployment": {
"type": "object",
"required": ["command", "resources"],
"required": [
"command",
"resources"
],
"properties": {
"command": {
"type": "string",
Expand All @@ -84,9 +94,39 @@
},
"description": "The arguments to pass to the command when running in the cloud deployment"
},
"mode": {
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"on-demand",
"provisioned"
]
},
"idle": {
"type": "string",
"description": "The duration as a formatted string such as 1m, 10m, 1h, etc. This is only used if the mode is on-demand. If not provided, the default and the minimum idle period is 10m."
}
}
},
"dependencies": {
"type": "array",
"items": {
"type": "string"
},
"description": "The apt package dependencies to install before running the deployment"
},
"resources": {
"type": "object",
"required": ["memory", "cpu", "disk"],
"required": [
"memory",
"cpu",
"disk"
],
"properties": {
"memory": {
"type": "string",
Expand All @@ -109,7 +149,12 @@
},
"bundler": {
"type": "object",
"required": ["enabled", "identifier", "language", "agents"],
"required": [
"enabled",
"identifier",
"language",
"agents"
],
"properties": {
"enabled": {
"type": "boolean",
Expand All @@ -129,7 +174,9 @@
},
"agents": {
"type": "object",
"required": ["dir"],
"required": [
"dir"
],
"properties": {
"dir": {
"type": "string",
Expand All @@ -150,7 +197,10 @@
"type": "array",
"items": {
"type": "object",
"required": ["id", "name"],
"required": [
"id",
"name"
],
"properties": {
"id": {
"type": "string",
Expand All @@ -170,4 +220,4 @@
"description": "The agents that are part of this project"
}
}
}
}
3 changes: 3 additions & 0 deletions cmd/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ func initProject(ctx context.Context, logger logger.Logger, args InitProjectArgs
proj.Deployment.Resources.CPU = args.Provider.Deployment.Resources.CPU
proj.Deployment.Resources.Memory = args.Provider.Deployment.Resources.Memory
proj.Deployment.Resources.Disk = args.Provider.Deployment.Resources.Disk
proj.Deployment.Mode = &project.Mode{
Type: "on-demand",
}

// set the agents from the result
proj.Agents = result.Agents
Expand Down
18 changes: 15 additions & 3 deletions internal/project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,17 @@ type Resources struct {
DiskQuantity resource.Quantity `json:"-" yaml:"-"`
}

type Mode struct {
Type string `json:"type" yaml:"type" hc:"on-demand or provisioned"` // on-demand or provisioned
Idle *string `json:"idle,omitempty" yaml:"idle,omitempty" hc:"duration in seconds if on-demand, optional"` // duration in seconds if on-demand, optional
}

type Deployment struct {
Command string `json:"command" yaml:"command"`
Args []string `json:"args" yaml:"args"`
Resources *Resources `json:"resources" yaml:"resources" hc:"You should tune the resources for the deployment"`
Command string `json:"command" yaml:"command"`
Args []string `json:"args" yaml:"args"`
Resources *Resources `json:"resources" yaml:"resources" hc:"You should tune the resources for the deployment"`
Mode *Mode `json:"mode,omitempty" yaml:"mode,omitempty" hc:"The deployment mode"`
Dependencies []string `json:"dependencies,omitempty" yaml:"dependencies,omitempty" hc:"The dependencies to install before running the deployment"`
}

type Watch struct {
Expand Down Expand Up @@ -217,6 +224,11 @@ func (p *Project) Load(dir string) error {
}
p.Deployment.Resources.DiskQuantity = val
}
if p.Deployment.Mode != nil {
if p.Deployment.Mode.Type != "on-demand" && p.Deployment.Mode.Type != "provisioned" {
return fmt.Errorf("invalid deployment mode value: %s. only on-demand or provisioned are supported", p.Deployment.Mode.Type)
}
}
}
return nil
}
Expand Down
Loading