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

Allow configuration of standard Unix layout #480

Closed
couling opened this issue Dec 26, 2016 · 24 comments
Closed

Allow configuration of standard Unix layout #480

couling opened this issue Dec 26, 2016 · 24 comments
Labels
type/enhancement An improvement of existing functionality type/feature Completely new functionality. Can only be merged if feature freeze is not active.

Comments

@couling
Copy link
Contributor

couling commented Dec 26, 2016

The current install instructions suggests gitea should be run from a single directory (/home/git/gitea)

This is very non-standard for *nix operating systems and will irritate a lot of sysadmins. I've had earlier versions (gogs) running based on standard layout by configuring app.ini to point to the various directories. But this seems to have broken. The following now seems to be partially ignored.

[server]
STATIC_ROOT_PATH = /foo/bar

My current work around is to construct a directory /var/lib/gitea/ and use symlinks to bring everything into one place.

Our aim ought to be to allow the following layout relatively purely through a handful of app.ini settings and command-line args:

gitea binary --> /usr/sbin/gitea
config --> /etc/gitea/ (eg: /etc/gitea/app.ini)
static content --> /usr/share/gitea (eg: /usr/share/gitea/templates)
variable content --> /var/lib/gitea  (eg: /var/lib/gitea/repositories)
log --> /var/log/gitea (eg: /var/log/gitea/http.log)
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/40400377-allow-configuration-of-standard-unix-layout?utm_campaign=plugin&utm_content=tracker%2F47456670&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F47456670&utm_medium=issues&utm_source=github).
@kjellkvinge
Copy link
Contributor

Hi. In my setup, I have the binary in /usr/local/bin,

It was somewhat confusing to get the files where I wanted them, but I managed without symlinks.
the configfile contains:

[attachment]
PATH = ....
...
[picture]
AVATAR_UPLOAD_PATH = ...

[repository]
ROOT = ...

working directory + /data is where sessions and tmp is placed. This is set by the init script.

I am not sure if there is more "hidden" config values that could make this more easy.

@tboerger
Copy link
Member

I also don't like the current default behavior for the directories, but changing that means possibly breaking things. Hopefully we will provide better defaults in future releases

@tboerger
Copy link
Member

Let's see if I can prepare a proper showcase within the docker container.

@strk
Copy link
Member

strk commented Dec 27, 2016

I think the milestone of this should be 1.0.x, as it breaks upgrades from Gogs.
Is it a problem to make STATIC_ROOT_PATH work again with the new bindata mechanism ?

@couling
Copy link
Contributor Author

couling commented Dec 27, 2016

Digging into this a little more. The current thing stopping my setup is that I get the error:

panic: fail to set message file(en-US): open conf/locale/locale_en-US.ini: no such file or directory

This seems to be failing if the conf directory isn't in the CWD (eg: the CWD isn't set to /home/git/custom). This a subtly a different bug than I thought. Do you want me to raise a seperate issue and keep this one clean?

@lunny lunny added this to the 1.1.0 milestone Dec 28, 2016
@lunny lunny added type/enhancement An improvement of existing functionality type/feature Completely new functionality. Can only be merged if feature freeze is not active. labels Dec 28, 2016
@lunny lunny modified the milestones: 1.x.x, 1.1.0 Dec 28, 2016
@bkcsoft
Copy link
Member

bkcsoft commented Dec 29, 2016

This should do it, if it doesn't then we have a bug :trollface:

[repository.upload]
TEMP_PATH=/tmp/gogs/uploads
[picture]
AVATAR_UPLOAD_PATH=/var/lib/gitea/avatars
[attachment]
PATH=/var/lig/gitea/attachments
[log]
ROOT_PATH=/var/log/gitea
[repository]
ROOT=/var/lib/gitea/repositories

@couling
Copy link
Contributor Author

couling commented Jan 4, 2017

Yeah that still fails unless I set my working directory first.

panic: fail to set message file(en-US): open conf/locale/locale_en-US.ini: no such file or directory

This is the only item I know if that is affected by the current working directory. I'm pretty sure its a recent change that's caused it but I can't find what it was.

@bkcsoft
Copy link
Member

bkcsoft commented Jan 20, 2017

@couling conf/ is built into the binary when built with TAGS="bindata", should fix your issue :)

@couling
Copy link
Contributor Author

couling commented Jan 20, 2017

Is there a full list of tags recorded somewhere that I need to build with?

@bkcsoft
Copy link
Member

bkcsoft commented Jan 21, 2017

there's a few oneliners floating around for greping the files for build-tags, but AFAIK there's only bindata,sqlite 🙂

@tboerger
Copy link
Member

https://docs.gitea.io/en-us/install-from-source/#build lists the regular build tags ;)

@blankoworld
Copy link

blankoworld commented May 17, 2017

@couling I encount the same problem as you about conf/locale/locale_en-US.ini but I don't understand the way you fix the problem.
Mine was:

  • synchronize (using rsync) /var/lib/gitea with the directory I use (for an example /srv/www/gitea/) that contains a custom directory (in which I redefine some templates, etc.) and while excluding data directory and custom one
  • change STATIC_ROOT_PATH (that seems to change in the new AUR package I use) to /srv/www/gitea/ instead of previous "/srv/www/gitea/public" value

So I agree with this topic that it's quite difficult on standard Unix to deal with files and directories without the "bindata" option when building Gitea. AUR package doesn't provide any "bindata" option when building.

@couling
Copy link
Contributor Author

couling commented May 17, 2017

@blankoworld There are basically two options:

  1. Work around: Before running gitea, you need to cd to the conf directory directory
  2. Fix by recompiling the binary. Instead of just:
    make
    You need
    make TAGS="bindata"

@blankoworld
Copy link

@couling :

  1. My app.ini file is in /etc/gitea/app.ini, and files are in /srv/www/gitea. To my mind it may not work in this configuration, may it not?
  2. As I use AUR package (ArchLinux community) I think that the author don't use bindata for some reason. But it cost me nothing to ask him/her why this tag isn't used

@couling
Copy link
Contributor Author

couling commented May 17, 2017

@blankoworld I have a similar setup. I use /srv/gitea/ but the principle is the same. The other difference is that I spread out some files across the filesystem (eg my config files are in /etc). If you work in a single directory, you will want to change the home directory of the user running gitea to /srv/www/gitea. If your configuration is there as well then before running gitea you need to cd /srv/www/gitea/conf OR you need to build gitea with the bindata tag as indicated above..

To my mind gitea defaults really need an overhaul to bring them inline with linux standards.

@MTecknology
Copy link
Contributor

I don't disagree with gitea being written to run from a single directory. There are many applications that are written to run this way because of the developer's workflow. Gitea has a lot of configuration options available in app.ini and I'd say we're pretty close to being able to deploy gitea in the "standard unix" structure.

If #2229, and to a lesser degree #2228, were resolved, the rest isn't much more than tweaking the default configuration file when deploying from a package. Easy peasy. :)

@bkcsoft
Copy link
Member

bkcsoft commented Oct 29, 2017

@MTecknology could you please send that as a PR? 🙂

@MTecknology
Copy link
Contributor

MTecknology commented Oct 30, 2017 via email

@blankoworld
Copy link

You're right about documentation, a lot of variables aren't documented. But we have https://docs.gitea.io/en-us/specific-variables/. And it should be fine if developers or contributors can complete progressively this page ^_^.

I was also afraid since Gitea 1.2.2 to see that app.ini should be overwritten by Gitea itself. But this seems to be same thing for other tools as Mattermost. In Mattermost, either you edit the configuration and then you start the service or you start the service and update the configuration through the web interface (which update your configuration file). Seems to be dangerous, but I don't know how to keep configuration you update through the web interface.

@lafriks
Copy link
Member

lafriks commented Feb 19, 2018

I think currently it is possible to have correct standard unix layout with correctly configured app.ini so I think we can close this issue

@lafriks lafriks closed this as completed Feb 19, 2018
@lafriks lafriks removed this from the 1.x.x milestone Feb 19, 2018
@MTecknology
Copy link
Contributor

With enough fiddling, yes, it's possible to get gitea to mostly adhere to standards. I absolutely wouldn't consider this closed, but I'm also not interested in chasing this. (using gitolite now)

@lafriks
Copy link
Member

lafriks commented Feb 20, 2018

@MTecknology changes are needed only in app.ini. In previous versions it was still using relative to binary paths that were not possible to set in app.ini but with latest version this has been fixed.
What else needs to be done to consider this issue fixed?

@zeripath
Copy link
Contributor

zeripath commented May 1, 2019

Since #6631 you can build Gitea with the defaults in the correct place

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/enhancement An improvement of existing functionality type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

No branches or pull requests

10 participants