CasaOS icon indicating copy to clipboard operation
CasaOS copied to clipboard

[Feature Request] Settings -> Edit the docker-compose.yml

Open Teneff opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe. Currently the backend exposes the docker-compose.yml from http://$HOST:$PORT/v2/app_management/compose/$APP, it can be exported or modified by the Settings UI, which is somewhat restrictive, which is probably great for most of the users.

But for the "advanced" users they have to download the .yml modfiy it, remove the App, create a new one by uploading the .yml

Describe the solution you'd like A new tab in the settings allowing editing of the raw docker-compose.yml

Additional context image

Teneff avatar Dec 13 '23 16:12 Teneff

totally agree with this and love the tab idea instead of using a new icon.

udance4ever avatar Apr 26 '24 21:04 udance4ever

To address the challenge of advanced users needing to download, modify, and re-upload a docker-compose.yml file, a solution can be introduced by adding a new "Raw Compose Editor" tab in the app management settings. This would allow users to directly edit the raw docker-compose.yml file from the UI, without needing to follow the lengthy download-upload process.

Proposed Solution

  1. New Tab in Settings UI:

    • Introduce a new tab labeled "Raw Compose Editor" under the settings.
    • This tab should contain a text editor to display and allow editing of the current docker-compose.yml for the selected app.
  2. Text Editor Features:

    • The editor should support syntax highlighting for YAML.
    • It could include a basic linter or validation to check for YAML syntax errors.
    • It should allow advanced users to modify the file and apply changes directly.
  3. Apply & Revert Options:

    • Provide buttons to Apply changes or Revert to the last saved version if necessary.
    • Ensure there is a confirmation prompt when applying changes, as changes to the compose file can affect app functionality.
  4. Version Control:

    • Optionally, a history of previous versions of the docker-compose.yml could be available, allowing users to revert to an earlier version if needed.
  5. Security & Access Control:

    • Ensure that this tab is only accessible to users with the necessary permissions, preventing less experienced users from accidentally misconfiguring their apps.

Example Workflow

  1. The user navigates to Settings > App Management.
  2. In the Raw Compose Editor tab, they see the current docker-compose.yml.
  3. They make changes directly in the editor (e.g., updating resource limits, adding services, etc.).
  4. They click Apply, triggering the backend to update the app with the modified docker-compose.yml.
  5. If the changes are successful, the new configuration takes effect without needing to recreate the app from scratch.

This feature would enhance flexibility for advanced users while maintaining the simplicity of the existing UI for others.

Additional Context (Example Compose File)

Here's an example of how the docker-compose.yml might look in the raw editor:

version: '3.9'
services:
  main_app:
    container_name: vscode
    image: ghcr.io/teneff/casaos-vscode:main
    environment:
      PUID: "1000"
      PGID: "1000"
      TZ: Europe/Sofia
      HOME: /config
    deploy:
      resources:
        limits:
          memory: "16532897792"
    cpu_shares: 90
    command: []
    labels:
      icon: data:image/png;base64,iVBORwOKGgoAAA...

Sanjarbek-007 avatar Sep 16 '24 08:09 Sanjarbek-007