Hi all,
I created a service in the web console and it’s perfectly working. In the console I see a “View more” link that displays a nice deployment definition in JSON. How could I use that file to reproduce the deployment using CLI or Pulumi (Python)?
Thanks in advance.
Framco
Hi,
In the Koyeb Pulumi provider documentation, you can find a way to reuse the JSON definition. Here is how it looks like:
service_resource = koyeb.Service("serviceResource",
app_name="string",
definition={
"instance_types": [{
"type": "string",
"scopes": ["string"],
}],
"scalings": [{
"max": 0,
"min": 0,
"scopes": ["string"],
"targets": [{
"average_cpus": [{
"value": 0,
}],
"average_mems": [{
"value": 0,
}],
"concurrent_requests": [{
"value": 0,
}],
"request_response_times": [{
"value": 0,
}],
"requests_per_seconds": [{
"value": 0,
}],
}],
}],
"regions": ["string"],
"name": "string",
"health_checks": [{
"grace_period": 0,
"http": {
"path": "string",
"port": 0,
"headers": [{
"key": "string",
"value": "string",
}],
"method": "string",
},
"interval": 0,
"restart_limit": 0,
"tcp": {
"port": 0,
},
"timeout": 0,
}],
"docker": {
"image": "string",
"args": ["string"],
"command": "string",
"entrypoints": ["string"],
"image_registry_secret": "string",
"privileged": False,
},
"ports": [{
"port": 0,
"protocol": "string",
}],
"git": {
"branch": "string",
"repository": "string",
"buildpack": {
"build_command": "string",
"privileged": False,
"run_command": "string",
},
"dockerfile": {
"args": ["string"],
"command": "string",
"dockerfile": "string",
"entrypoints": ["string"],
"privileged": False,
"target": "string",
},
"no_deploy_on_push": False,
"workdir": "string",
},
"routes": [{
"path": "string",
"port": 0,
}],
"envs": [{
"key": "string",
"scopes": ["string"],
"secret": "string",
"value": "string",
}],
"skip_cache": False,
"type": "string",
"volumes": [{
"id": "string",
"path": "string",
"replica_index": 0,
"scopes": ["string"],
}],
},
messages="string")
Hi @David , first of all thank you for your answer. Using Pulumi is nice, even if I’ve seen that there are some minor differences between the JSON parameters from the console and the parameter of the Python Service class. The main one is that I think the config_files
parameters are missing in Python. How could I setup this parameter with Pulumi or another IaC tool, such as Terraform, the CLI or an API call?
Thank you.
Franco
With the CLI you can use the follwing command:
koyeb services create %app_name% --config-file etc/data.yaml:/etc/data.yaml
using the format LOCAL_FILE:PATH:[PERMISSIONS]. Permissions are optional.
You can also do it with the API.
So, with the API I just could use the JSON file as the POST payload, isn’t it?
Thank you.
Yes, you could do that as well.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.