git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* How to best maintain directories like /etc/sysstat in GIT?
@ 2022-10-12 16:35 Thorsten Schöning
  2022-10-13  0:07 ` brian m. carlson
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Schöning @ 2022-10-12 16:35 UTC (permalink / raw)
  To: git

Hi everyone,

I'm using SVN to maintain lots of different host specific configs like
crontab files, web server configs and the directory /etc/sysstat. The
current approach is to simply have some directory structure in trunk
named by topics like /trunk/Mail/Postfix for some reference host, if
any makes sense at all. That config is then copied to e.g.
/tags/Mail/Postfix/some.other.host and Postfix for that host
maintained in that writable tag.

GIT doesn't have writable tags, which might be worked around using
branches or one repo per host or stuff. The more important difference
is that SVN can have a working copy for each and every maintained
directory. So one can really make /etc/postfix or /etc/sysstat a
wroking copy and maintained that only, without additionally necessary
subdirs and without having .svn in /etc or alike. AFAIK that is not
possible in GIT, even with sparse checkouts one needs a subdir of
some kind, which is pretty incomplatible with many system wide
configs. Unless one wants to put .git into / or /etc or alike, which
is what I would loike to avoid.

Any useful suggestions for workarounds?

I can only think of two things: Putting the GIT clone somewhere and
link directories into that. Which won't work very well for directories
for which I only want to maintain some and not all files and seems
like a lot of work, might break package management etc.

The other thing I have in mind is using branches and their implicit
available ROOT. So I would create /etc/sysstat as branch name, clone
some repo into /etc/sysstat and checkout the corresponding branch
name. That branch would only contain the files for that directory. For
other directories other branch names would need to be created. The
problems I see are with introducing host names, branch name lengths
and stuff.

Any further ideas? Thanks!

Mit freundlichen Grüßen

Thorsten Schöning

-- 
AM-SoFT IT-Service - Bitstore Hameln GmbH
Mitglied der Bitstore Gruppe - Ihr Full-Service-Dienstleister für IT und TK

E-Mail: Thorsten.Schoening@AM-SoFT.de
Web:    http://www.AM-SoFT.de/

Tel:   +49 5151-  9468- 0
Tel:   +49 5151-  9468-55
Mobil: +49  178-8 9468-04

AM-SoFT IT-Service - Bitstore Hameln GmbH, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 221853 - Geschäftsführer: Janine Galonska


Für Rückfragen stehe ich Ihnen jederzeit zur Verfügung. 

Mit freundlichen Grüßen, 

Thorsten Schöning


Telefon: +49 5151 9468-55
Fax: 
E-Mail: TSchoening@am-soft.de

AM-Soft IT-Service - Bitstore Hameln GmbH
Brandenburger Straße 7c
31789 Hameln

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen und ist ausschliesslich für den Adressaten bestimmt. Jeglicher Zugriff auf diese E-Mail durch andere Personen als den Adressaten ist untersagt. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail. Sollten Sie nicht der für diese E-Mail bestimmte Adressat sein, ist Ihnen jede Veröffentlichung, Vervielfältigung oder Weitergabe wie auch das Ergreifen oder Unterlassen von Massnahmen im Vertrauen auf erlangte Information untersagt. 

This e-mail may contain confidential and/or privileged information and is intended solely for the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. 

Hinweise zum Datenschutz: bitstore.group/datenschutz




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How to best maintain directories like /etc/sysstat in GIT?
  2022-10-12 16:35 How to best maintain directories like /etc/sysstat in GIT? Thorsten Schöning
@ 2022-10-13  0:07 ` brian m. carlson
  0 siblings, 0 replies; 2+ messages in thread
From: brian m. carlson @ 2022-10-13  0:07 UTC (permalink / raw)
  To: Thorsten Schöning; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 2918 bytes --]

On 2022-10-12 at 16:35:51, Thorsten Schöning wrote:
> Hi everyone,
> 
> I'm using SVN to maintain lots of different host specific configs like
> crontab files, web server configs and the directory /etc/sysstat. The
> current approach is to simply have some directory structure in trunk
> named by topics like /trunk/Mail/Postfix for some reference host, if
> any makes sense at all. That config is then copied to e.g.
> /tags/Mail/Postfix/some.other.host and Postfix for that host
> maintained in that writable tag.
> 
> GIT doesn't have writable tags, which might be worked around using
> branches or one repo per host or stuff. The more important difference
> is that SVN can have a working copy for each and every maintained
> directory. So one can really make /etc/postfix or /etc/sysstat a
> wroking copy and maintained that only, without additionally necessary
> subdirs and without having .svn in /etc or alike. AFAIK that is not
> possible in GIT, even with sparse checkouts one needs a subdir of
> some kind, which is pretty incomplatible with many system wide
> configs. Unless one wants to put .git into / or /etc or alike, which
> is what I would loike to avoid.
> 
> Any useful suggestions for workarounds?

There are a couple approaches you can take.  One is to keep the
repository elsewhere and simply copy files into place.  This is how I
and many people manage our respective dotfiles with Git.

Another option is to use some sort of automatic system for managing
those config files, such as Puppet, Chef, or Ansible, and keep those
files in a repository suitable for that system.  This is how I manage
configuration for my servers and how we do it at work.

Finally, you can also keep the Git directory separate from the working
tree.  For example, if you're in /etc and your repository directory is
/srv/checkouts/etc-git, you can run one of the following:

$ GIT_WORK_TREE=/etc GIT_DIR=/srv/checkouts/etc-git git status
$ git --work-tree=/etc --git-dir=/srv/checkouts/etc-git status

(Note that you must set both environment variables or both options, not
just one.)  Of course, this is a little unwieldy, so a shell script may
be helpful.  You'll also want an appropriate .gitignore file.

> I can only think of two things: Putting the GIT clone somewhere and
> link directories into that. Which won't work very well for directories
> for which I only want to maintain some and not all files and seems
> like a lot of work, might break package management etc.

Git does not preserve hard links and this won't work in general.  Since
Git also does not preserve permissions other than the executable bit, so
you almost certainly will not want to use symlinks, either, since that
means the destination directories may change ownership and permissions
when you run git checkout.
-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-13  0:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-12 16:35 How to best maintain directories like /etc/sysstat in GIT? Thorsten Schöning
2022-10-13  0:07 ` brian m. carlson

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).