-
Notifications
You must be signed in to change notification settings - Fork 4
Implement coolify_service resource #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Implement coolify_service resource #53
Conversation
4a79419
to
56f9cb1
Compare
@SierraJC Can you please have a look if the code goes in the right direction ? Either way I am a bit stuck at the moment because the Coolify API has a issue where it does not return the application by uuid after creation. coollabsio/coolify#5330 |
The Coolify API has a lot of bugs unfortunately. I've submitted a few PRs to fix issues, and is why the OpenAPI overlay tool is being used in this project to fix the schema where possible. I'll give the code a more thorough review in the next day or two - had a quick look and it looks pretty good so far! 👍 |
@SierraJC Thank you for your review. I suspect that there is something wrong with the way teams are linked. Perhaps here: https://github.com/coollabsio/coolify/blob/676f616efa668e92e3adda7c87cdea685f1000a5/app/Models/Application.php#L185 |
I think you're right, the The created |
Pfff what a mess :). In the future we can support one click services in another way, although right now users will be able to just dump the docker compose in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, this should be represented as a coolify_dockerfile_service
Updating services via the API is not yet support but I think at first we can delete and recreate the service via de API.
FYI, to do this you can add a RequiresReplace()
PlanModifier
on each attribute, or implement the resource.ResourceWithModifyPlan
interface (set resp.RequiresReplace
value).
I believe the destroy operation via API is an asynchronous operation. Some kind of polling may be required, to ensure destroyed resources are fully deleted on Coolify's end before recreating...
Once the service is created, the images in the dockerfile are each created as a ServiceApplication
/ ServiceDatabase
which is not currently supported by the API. How will this impact your use case?
54e9e97
to
ee89cbb
Compare
@SierraJC I've added support for creating and updating services in coolify in coollabsio/coolify#5344. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When trying to create the resource, the beta.399
API is returning 500
.
Have you tested the provider locally?
If not, you can run make install
and then add a dev_override
to ~/.terraformrc
[docs] ie "registry.terraform.io/sierrajc/coolify" = "${GOPATH}/bin"
. You can then use your modified provider binary as normal, in regular terraform files.
Can get two birds with one stone by doing this in the examples/resources/<resource name>
folder.
Move the PR out of draft, and re-request review when you'd like me to check it again. Excellent effort so far, looks good 👍
Thank you for the review. I'll have a look and update this. |
a2c4c2c
to
25484c5
Compare
Updated this PR and opened another one on Coolify to fix these little problems with the api: coollabsio/coolify#5448 |
4f0a5c4
to
81e48aa
Compare
@SierraJC Coolify has been updated with the necessary fixes and I have also update the defs here. |
I'm unable to get it working, crashes immediately on create API call with
{"message":"Validation failed.","errors":{"destination_uuid":["The destination uuid field must be a string."]}} Manually providing a Please test the provider on your end so these issues can be spotted sooner
|
@SierraJC I have just test this locally with the latest beta.406 version of Coolify and everything worked for me.
I tried now to remove |
@SierraJC The Coolify api is not setting the correct status codes. I'll update it and fix that. Fix in coollabsio/coolify#5564 |
Implement initial version of
coolify_service
resource.See #51
Related coolify issues:
#5341
#5344