Skip to content
This repository was archived by the owner on Jul 23, 2025. It is now read-only.

WIP: Big and ugly patch#124

Open
jochumdev wants to merge 1 commit intobketelsen:mainfrom
jochumdev:chore/ugly_patch
Open

WIP: Big and ugly patch#124
jochumdev wants to merge 1 commit intobketelsen:mainfrom
jochumdev:chore/ugly_patch

Conversation

@jochumdev
Copy link
Contributor

Working on this for having full docker-compose support.

WIP.

@jochumdev
Copy link
Contributor Author

@jochumdev
Copy link
Contributor Author

Another note about this patch, it force users to use incus 6.11 which is the latest available atm.

for k, v := range s.Volumes {
fullVolName := p.Name + "_" + k
for _, v := range s.Volumes {
fullVolName := p.Name + "_" + v.Name
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I'm looking at my own patch - I think this is never true.

// If no valid remote is found, an error is returned.
//
// UseProject overwrites the instance, that means this function will return the overwritten instance.
func (app *Compose) GetIncusInstance() (incus.InstanceServer, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to go away, this was added where I didn't know the code base.

}

func (app *Compose) CreateProject(name string) error {
// get the project names while we're connected
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is required.


// check for existing bind
d, err := app.getInstanceServer(containerName)
d, err := app.getInstanceServer(containerName, app.GetProject())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this a lot, I made name == project and app.getInstance() selects the project now.

// keep all the external commands in one place
func (app *Compose) Up() error {
err := app.SanityCheck()
err := app.CreateProject(app.GetProject())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was added to make a start of a docker compose show file possible.

if volumes {
for volName, vol := range app.Services[service].Volumes {
slog.Info("Volume snapshot start", slog.String("volume", vol.CreateName(app.Name, service, volName)))
err := app.SnapshotVolume(vol.Pool, vol.CreateName(app.Name, service, volName), noexpiry, stateful, volumes)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A haevy duty breaking change volumes have been

Project-service-volume

Now they are:

Project-Volume

Image string `yaml:"image" validate:"required"`
GPU bool `yaml:"gpu,omitempty"`
Volumes map[string]*Volume `yaml:"volumes,omitempty" validate:"dive,required"`
Volumes []*Volume `yaml:"volumes,omitempty" validate:"dive,required"`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed anymore, still can stay maybe we once need to order Volumes?

@jochumdev
Copy link
Contributor Author

@bketelsen may have a look at these changes? Can we discuss them before I split them up into nice commits?

@bketelsen
Copy link
Owner

Another note about this patch, it force users to use incus 6.11 which is the latest available atm.

What's the reason for the 6.11 requirement? That will restrict a lot of deployments.

@jochumdev
Copy link
Contributor Author

jochumdev commented Apr 8, 2025

@bketelsen many thanks for having a look at this preview patch, maybe I named it bad.

The reason is https://discuss.linuxcontainers.org/t/incus-6-11-has-been-released/23322#p-80017-configurable-oci-entrypoint-8

In short it needs oci.uid and oci.gid for creating volumes with the uid and gid.

https://github.com/bketelsen/incus-compose/pull/124/files#diff-553cc4acd37549a90cd75b22ac8d9fa9cff9cb87d3bf22146955edddb505d58cR139

Everything else can be done without oci.

Kind regards,
René from the now warm Austria

Edit: I believe we can support pre-incus 6.11 users as well, we just need to make sure to set raw.lxc instead oci.entrypoint then. We have to detect the servers version for backward compatbility for that, I'm sure thats an easy task.

@bketelsen
Copy link
Owner

In short it needs oci.uid and oci.gid for creating volumes with the uid and gid.

Oh wow, I missed this addition, very nice!

https://github.com/bketelsen/incus-compose/pull/124/files#diff-553cc4acd37549a90cd75b22ac8d9fa9cff9cb87d3bf22146955edddb505d58cR139

Edit: I believe we can support pre-incus 6.11 users as well, we just need to make sure to set raw.lxc instead oci.entrypoint then. We have to detect the servers version for backward compatbility for that, I'm sure thats an easy task.

Yes, that should be OK as long as we have a path to support older versions.

@bketelsen
Copy link
Owner

can you resolve the conflicts? Then I can do some testing.

@jochumdev
Copy link
Contributor Author

Done

@bketelsen
Copy link
Owner

I was hoping to get my systems updated to a newer incus but haven't. I tried testing on incus 6.9 and it failed with idmapping error.
ERROR Start error="Failed to setup device mount \"ghost-db\": idmapping abilities are required but aren't supported on system"

If we can resolve that for older incus versions we can move forward.

@jochumdev
Copy link
Contributor Author

@bketelsen
Copy link
Owner

it was incus-in-incus, using dir filesystem. I managed to update a server and was able to test successfully.

What's next in this refactor/change?

@jochumdev
Copy link
Contributor Author

If your ok, with it overall. I would prepare some small commits to split this patch up.

@bketelsen
Copy link
Owner

If your ok, with it overall. I would prepare some small commits to split this patch up.

sounds good, let's get them in

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants