-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Use LDFLAGS to set the default locations in docker #17501
Conversation
Too many docker users are caught out by the default location for the app.ini file being environment dependent so that when they docker exec into the container the `gitea` commands do not work properly and require additional `-c` arguments to correctly pick up the configuration. This PR simply builds the default locations into the build. Fix go-gitea#14468 Reference go-gitea#17497 Reference go-gitea#12082 Reference go-gitea#8941 ... amongst others ... Signed-off-by: Andrew Thornton <art27@cantab.net>
It makes the docker gitea binary differ from other build. Can we just use a wrapper to bypass the config problem? eg, we put gitea binary to
|
You mean a script like: https://github.com/go-gitea/gitea/blob/main/contrib/fhs-compliant-script/gitea |
Yep, it is more clear, and keeps all Gitea build consistency. My thought is to re-design the directory layout inside docker (Maybe both root-docker and rootless-docker). For example: We save gitea binary to Users can only use the wrapper and they always use the correct environment. |
This is already the case. The binaries in the dockers are built specifically for the docker - they're not copied from the "release" binaries that are made by DockerLines 10 to 11 in 4e8a817
Line 23 in 4e8a817
Release BinariesLines 634 to 638 in 4e8a817
|
Then what about the snap and other builds? |
This change only affects the LDFLAGS for the docker build, in snap and others the binary remains the same (ex, here is snap being built: https://github.com/go-gitea/gitea/blob/main/snap/snapcraft.yaml#L70) |
I mean, do snap or other builds have similar problems? I know many snap users also meet path & environment problems. My preference is to make a stable build system, eliminate the differences between builds as much as possible, and never surprise users, if they run The fhs-compliant-script seems a better solution. https://github.com/go-gitea/gitea/blob/main/contrib/fhs-compliant-script/gitea About snap, I can see the environment variables like docker:
|
The wrapping script would need to be different for each variant - I'm not sure that is really much different from just compiling things in correctly. (This reminds me though that the FHS script could benefit from a very small improvement... #17513) |
Another related issue. Adding LDFLAGS doesn't resolve the design problem fundamentally |
I think this one is unrelated and is more a problem with: Nope I got this wrong it's app work directory. But the LDFLAGS would also sort this. |
If we can warn users in time when they try to use a wrong The real problem now is: we seldom warn users clearly, instead gitea tries to do some automatic and "magic" operations for users, which leads to a bigger mistake. This is the fundamental problem in my mind.
We shouldn't set different LDFLAGS for different builds. We should have a unique and fundamental solution. |
Yes, you're preaching to the choir here. I am fully aware that our default paths are not correct for the ways that people use Gitea today. Gitea was never designed to be dumped in /usr/bin or /usr/local/bin as it is currently compiled. It is currently compiled to do the correct thing if you were to download Gitea and run it from where you downloaded. We can't change that default because it would be massively breaking for a number of people. The reality is that no binary you just download from the web would normally be considered to obey the FHS. Things that are meant to obey the FHS usually have to have their source code downloaded and compiled or be in a package. To that end, I spent a long time creating two options:
Neither of these gained much acceptance - although I understand that Arch uses LDFLAGS. 1. The Filesystem Hierarchy Standard ScriptReasons to use the script:
Reasons against the script:
It's notable that firefox (at least it used to) required a script like this. 2. LDFLAGS and compiling in the defaultsReasons to compile things in:
Reasons against compiling in:
These two negatives are just the same as any packaged binary though. My personal suggestion would be that we use LDFLAGS over the script as the script is just not being used. We could provide two different sets of binaries for linux - one obeying the FHS and one with the standard defaults. The docker version would just get the right locations built in. Snap and other downstream packagers would need to build in the correct paths or use the script as per their own choice. If you would prefer to use the scripted route then we need to come up with some way to make people use the script. |
Maybe we can just improve the gitea's behavior of choosing the
Pros: The problem seems to be resolved. For advanced users, they still can control the behavior. For junior users, no surprise to them, if accident occurs (more candidates), they still get enough message to learn how to resolve it. Cons: (I can not find a bad case now) |
It's not just the app.ini it's the workpath too. |
If we can get the correct |
For existing instances we can't get correct app.ini anymore except for breaking everything for them by changing behavior. So I agree with @zeripath that using LDFLAGS for docker image gitea binary build would be best solution here |
Why we can't ? I think we can get the
|
|
What about my proposal 2: For example, we put gitea binary in This solution is simple, and doesn't break existing system, and can be used for snap/apt/deb builds. About concerns:
That's the same to multiple builds. It doesn't make things worse. That's gitea's problem.
Because no one knows it and most people do not know how to use it. For example, I didn't know it before you told me (actually, I was going to write one .... 😂). But we can use it since it works.
Yes, as Q1, gitea's strange behavior forces us to make a choice, split the builds, or introduce scripts.
Well, I don't know what the real problem is .... some examples for bad cases?
Not bash,
They won't know it is a script ..... many Linux programs work this way. And why they complaint .... if they are senior users, they can build their own package and do everything they want. Gitea is not a desktop app. |
Too many docker users are caught out by the default location for the app.ini file being environment dependent so that when they docker exec into the container the gitea commands do not work properly and require additional -c arguments to correctly pick up the configuration. This PR simply shadows the gitea binary using variants of the FHS compatible script to make the command gitea have the default locations by default. Fix go-gitea#14468 Reference go-gitea#17497 Reference go-gitea#12082 Reference go-gitea#8941 ... amongst others ... Replace go-gitea#17501 Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Codecov Report
@@ Coverage Diff @@
## main #17501 +/- ##
==========================================
+ Coverage 45.54% 45.56% +0.01%
==========================================
Files 809 809
Lines 90059 90059
==========================================
+ Hits 41019 41035 +16
+ Misses 42484 42473 -11
+ Partials 6556 6551 -5
Continue to review full report at Codecov.
|
Too many docker users are caught out by the default location for the app.ini file being environment dependent so that when they docker exec into the container the gitea commands do not work properly and require additional -c arguments to correctly pick up the configuration. This PR simply shadows the gitea binary using variants of the FHS compatible script to make the command gitea have the default locations by default. Fix #14468 Reference #17497 Reference #12082 Reference #8941 ... amongst others ... Replace #17501 Signed-off-by: Andrew Thornton <art27@cantab.net>
Closed in preference of #17846 |
Too many docker users are caught out by the default location for the app.ini file being environment dependent so that when they docker exec into the container the gitea commands do not work properly and require additional -c arguments to correctly pick up the configuration. This PR simply shadows the gitea binary using variants of the FHS compatible script to make the command gitea have the default locations by default. Fix go-gitea#14468 Reference go-gitea#17497 Reference go-gitea#12082 Reference go-gitea#8941 ... amongst others ... Replace go-gitea#17501 Signed-off-by: Andrew Thornton <art27@cantab.net>
Too many docker users are caught out by the default location for the
app.ini file being environment dependent so that when they docker exec
into the container the
gitea
commands do not work properly and requireadditional
-c
arguments to correctly pick up the configuration.This PR simply builds the default locations into the build.
Fix #14468
Reference #17497
Reference #12082
Reference #8941
... amongst others ...
Replace #17846
Signed-off-by: Andrew Thornton art27@cantab.net