-
Notifications
You must be signed in to change notification settings - Fork 4
feat: 🚧 Add stack with docker-compose generation #18
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?
Conversation
gonzariosm
commented
Apr 23, 2023
- Updated image model
- Created docker model
- Created image list and getbycode function
pkg/api/cloud/stack/add.go
Outdated
| } | ||
|
|
||
| // registry url (staging) | ||
| registryPath := "registry-staging.sitehost.co.nz" |
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.
This would be better if the request has a variable like ImageProvider and it can be either empty, or sitehost or custom values.
If empty or sitehost, we can assume sitehost provided image hence registry.sitehost.co.nz
if custom, it's custom image so registry-clients.sitehost.co.nz.
put the registry urls as constants.
For now if custom value is detected, print out message that say something along the line custom image is not supported at the moment
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.
So, we can add ImageProvider to AddRequestWithImage struct. Then control this value in the same function?
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.
Yeah I would imagine we can set a variable in terraform to specify if the image is from sitehost or custom provider.
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.
Yes, but in this case the endpoint is different
sitehost images: https://api.sitehost.nz/1.2/cloud/stack/image/list_all.json
client images: https://api.sitehost.nz/1.2/cloud/image/list_all.json
pkg/api/cloud/stack/add.go
Outdated
| }, | ||
| Expose: request.Ports, | ||
| Image: request.Image, | ||
| Labels: []string{ |
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.
Not all labels are the same across all type of images. You will need to check for different type of image and create the labels for it.
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.
Can you provide and example please.
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.
You can create services and integrated containers and compare the docker-compose file to web containers.
pkg/api/cloud/stack/add.go
Outdated
| Name: request.Name, | ||
| Label: request.Label, | ||
| Image: registryPath + "/" + image.Code + ":" + imageLastVersion, | ||
| Type: image.Labels.NzSitehostImageType, |
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.
We will need to check the image type and only proceed with the supported image types we discussed before. Print out a message that says something along the line of image type is not supported at the moment.
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.
Can you confirm if the expected types are service and www.
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.
for now we expect service, www and integrated type.