feat: Allow to use the current working directory as the agent's (#2)
Merged
Davide Beatrici opened 3 weeks ago

This is the case in OpenMandriva's package for example:

  1. Tanuki Wrapper is built separately in its own dedicated package and doesn't live in the agent's directory.
  2. The agent JAR is outside the lib folder.
Commits were rebased onto target branch
  • feat: Allow to use the current working directory as the agent's
    This is the case in OpenMandriva's package for example:
    
    1. Tanuki Wrapper is built separately in its own dedicated package and doesn't live in the agent's directory.
    2. The agent JAR is outside the lib folder.
    3 weeks ago
  • Robin Shen commented 5 days ago

    OneDev only cares about its own agent packaging to keep things simple.

  • Robin Shen discarded 5 days ago
  • Davide Beatrici commented 5 days ago

    Understandable, but the code as it stands is very fragile.

  • Robin Shen commented 5 days ago

    OneDev agent has a fixed layout for its distribution files, and user is not assumed to change this layout. With this assumption, the folder detection should be quite reliable.

  • Davide Beatrici commented 5 days ago

    I'm not disagreeing with that, but as a Linux distribution maintainer I would really appreciate better support for proper system packages.

    I really like OneDev and I believe it deserves to make its way into more distributions' repositories. Gitea for example is available in several: https://pkgs.org/search/?q=gitea

    It's not a problem for me to maintain patches in our package repository, but if they get upstreamed it's better for everyone including the project itself.

  • Robin Shen commented 4 days ago

    Thanks for helping to create custom distribution packages for OneDev. However both OneDev server and agent upgrade takes a quite different approach which does not play well with ordinary linux package upgrade process. Also as you've discovered, OneDev relies on propertiery software (JSW) for some of its operations (auto restart agent upon upgrade etc).

    Several years ago, there are other users trying to package OneDev server as a linux package (OD-1041), and it turns out to be very difficult and finally abandoned.

  • Davide Beatrici commented 4 days ago

    However both OneDev server and agent upgrade takes a quite different approach which does not play well with ordinary linux package upgrade process.

    So far I didn't encounter any issues with the server, for the agent I simply disabled the autoupdate logic: https://github.com/OpenMandrivaAssociation/onedev-agent/blob/8d4bdd3ac4a9b3a16b4e30664b283f3488d7be6d/disable-autoupdate.patch

    OneDev relies on propertiery software (JSW) for some of its operations (auto restart agent upon upgrade etc).

    Actually, in OpenMandriva we packaged the open-source version of Tanuki Wrapper and we're using it for both server and agent: https://github.com/OpenMandrivaAssociation/tanuki-wrapper

    Several years ago, there are other users trying to package OneDev server as a linux package (OD-1041), and it turns out to be very difficult and finally abandoned.

    It took some effort, but wasn't that bad honestly. We are not adhering to the common directory practices (e.g. configs in /etc/<name>), but what matters the most is permissions hardening and that's achieved.

    On that note, I would be really happy if you merge https://code.onedev.io/onedev/commons/~pulls/2 because it's what allows to run unprivileged/isolated/namespaced Docker containers.

    As for this pull request and https://code.onedev.io/onedev/agent/~pulls/1, I will modify the package so that they're not required anymore.

  • Robin Shen reopened 4 days ago
  • Robin Shen merged 4 days ago
  • Davide Beatrici commented 4 days ago

    Thank you very much!

  • Robin Shen commented 4 days ago

    Thanks for all your effort with this. I did not know about that previously. PR addressing permissions in commons project has been merged. Also merged changes you submitted for agent project as they are not big changes.

    Actually, in OpenMandriva we packaged the open-source version of Tanuki Wrapper and we're using it for both server and agent

    It is great that you are replacing JSW with its OS version. I actually thought about doing that, but the lack of Windows 64 support is an obstacle.

    It took some effort, but wasn't that bad honestly

    The biggest trouble is for server upgrade. Currently OneDev upgrade works in the way that:

    1. Download new version and extract to a folder
    2. From the folder with new version, run bin/upgrade.sh /path/to/old/installation

    Essentially the upgrade process needs both old version and new version in place. Old version dumps data from database, and new version upgrades data outside of database, and imports upgraded data into database. This makes the data migration really flexible (not rely on sql scripts which is quite limited), but creates upgrade difficulty when package OneDev server as ordinary unix/linux packages. The guy tried to package OneDev for Arch linux struggled for this without much success.

  • Davide Beatrici commented 4 days ago

    You're welcome!

    It is great that you are replacing JSW with its OS version. I actually thought about doing that, but the lack of Windows 64 support is an obstacle.

    I noticed they're only releasing x86_64 Windows binaries for the commercial version... which is unfortunate.

    The community source code should build just fine for 64 bit though, I'm willing to give that a try if I find the time.

    Essentially the upgrade process needs both old version and new version in place. Old version dumps data from database, and new version upgrades data outside of database, and imports upgraded data into database. This makes the data migration really flexible (not rely on sql scripts which is quite limited), but creates upgrade difficulty when package OneDev server as ordinary unix/linux packages. The guy tried to package OneDev for Arch linux struggled for this without much success.

    Oh, this is the only part I'm missing, but it's feasible. I'll implement it when releasing the very first update for the package.

pull request 1/1
Merge Strategy
Rebase Source Branch Commits
Watchers (3)
Reference
pull request onedev/agent#2
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover