Skip to content
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

GitOps - Stacks managed by Git #471

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Felioh
Copy link

@Felioh Felioh commented Mar 30, 2024

⚠️⚠️⚠️ Since we do not accept all types of pull requests and do not want to waste your time. Please be sure that you have read pull request rules:
https://github.com/louislam/dockge/blob/master/CONTRIBUTING.md

Tick the checkbox if you understand [x]:

  • I have read and understand the pull request rules.

Description

This is an initial draft of a GitOps integration, related to #36 . Including:

  • specifying a git repository (via URL) upon creation of a stack
    • private repositories can be used when including an access token in the URL
    • a stack is intended to always follow a branch
  • updating the stack automatically
    • by enabling a scheduled check for remote updates (currently 10min) - this is disabled by default
    • by triggering the update via webhook for a specific stack

Since I have not discussed this before, I first would like to know if this is a feature that you (@louislam) would like to see included in this project. If you do, I am happy to apply any wanted changes.

I have some stuff in mind that could be really cool here, but that I would like to discuss before.
In the future allowing for local changes (displaying the editor in the edit view) and adding an option to commit/push could be implemented. (local changes should not be a problem with the way it is implemented right now, and should just be overwritten by any merge-conflicts with the remote).

I have tried to follow conventions, but I have never used ts, js, or vue before so if I can improve anything, please let me know :).

Type of change

Please delete any options that are not relevant.

  • User interface (UI)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Checklist

  • My code follows the style guidelines of this project
  • I ran ESLint and other linters for modified files
  • I have performed a self-review of my own code and tested it
  • I have commented my code, particularly in hard-to-understand areas
    (including JSDoc for methods)
  • My changes generate no new warnings
  • My code needed automated testing. I have added them (this is optional task)

Screenshots (if any)

Please do not use any external image service. Instead, just paste in or drag and drop the image here, and it will be uploaded automatically.
image
image
image
image

@Felioh Felioh marked this pull request as ready for review April 1, 2024 11:32
Copy link

@nathan815 nathan815 left a comment

Choose a reason for hiding this comment

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

This will be a great feature addition!

How about ability to specify repo subdirectory for a stack? My use case is I have a "stacks" directory in a repo instead of a repo per stack with the docker-compose at root.


let exitCode = await Terminal.exec(server, socket, terminalName, "git", [ "clone", "-b", branch, gitUrl, stackName ], server.stacksDir);
if (exitCode !== 0) {
throw new Error("Failed to clone git repo");

Choose a reason for hiding this comment

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

Would including the exit code in this error message be helpful?

stderr would be nice, but looks like Terminal.exec only exposes the exit code so I suppose that isn't possible without other changes.

@Felioh
Copy link
Author

Felioh commented Apr 29, 2024

How about ability to specify repo subdirectory for a stack? My use case is I have a "stacks" directory in a repo instead of a repo per stack with the docker-compose at root.

I think this is related to #214, and actually exactly my use case too.
I am not sure how to implement this, maybe you have some ideas. Currently we check if a directory in the root contains a files of acceptedComposeFileNames. I would relax that to a maximum depth of 3 (or 2?).
It could also be implemented by specifying the subpath on creation, but that makes things more complex, because we do not really want to save any additional information for a stack.

If you like I can do that, since I am interested in this too, but I think it should be a separate PR.

@Felioh Felioh requested a review from nathan815 April 29, 2024 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants