You are not logged in.

#1 2024-02-24 15:26:20

avi9526
Member
Registered: 2015-05-15
Posts: 116

Application config as package

When I need to set up an application, like a PHP website with Nginx, PHP-FPM, and MariaDB, I usually rely on guides from the internet (<3 archwiki) or my past projects.

Over time, the /etc folder can become messy. To keep it organized, I use a local git repository in the /etc folder.

I'm considering whether it's useful to create a package containing custom application configurations. My thinking is that it would help clean up the system from configuration clutter or quickly transfer configurations to another system. Such a package wouldn't require many dependencies; it would primarily serve as a configuration organizer.

Has anyone tried this in Arch Linux?

Last edited by avi9526 (2024-02-24 15:27:48)

Offline

#2 2024-02-24 15:30:09

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: Application config as package

You could.  But what benefit would it provide over your git repo?  You can just clone the git repo into a new system which skips several middle-man stages of creating and installing the package.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2024-02-24 15:58:58

avi9526
Member
Registered: 2015-05-15
Posts: 116

Re: Application config as package

1) Git contains all the mess from other apps, it doesn't cover other locations (some files may be placed in /opt/ for instance), it does not contain install/remove script code (which may be useful to perform some basic steps like 'systemctl daemon-reload' after placing configs in /etc/systemd/...)
2) Package doesn't need to be created properly, making folder tree and adding .INSTALL, .PKGINFO (without .MTREE) then compressing it with tar.xz. Then pacman -U
This lead to some 'error: local database is inconsistent', but still works

Last edited by avi9526 (2024-02-24 15:59:16)

Offline

#4 2024-02-24 16:03:30

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: Application config as package

avi9526 wrote:

2) Package doesn't need to be created properly, making folder tree and adding .INSTALL, .PKGINFO (without .MTREE) then compressing it with tar.xz. Then pacman -U
This lead to some 'error: local database is inconsistent', but still works

That's a bit ridiculous.  Despite my suggestion that it was extra steps, making the package "properly" would be far fewer steps than this, and it wouldn't break your pacman database.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2024-02-25 17:44:27

avi9526
Member
Registered: 2015-05-15
Posts: 116

Re: Application config as package

Trilby wrote:

That's a bit ridiculous.

the way I like it.

There are more drawbacks to using packages for configuring apps:

1) Some files should not be deleted when uninstalling a package, such as a database. This can create problems with initialization scripts during a full reinstallation (uninstall, then install) because the init script may not have the existing database root user password and could fail or break something. Having an overly complicated init script isn't a good solution. A harsh solution would be to delete the database entirely when uninstalling such a package, which serves as a hard lesson in maintaining backups.
2) It's possible that only a few lines need to be changed in a configuration file created by another package (and that file doesn't support any include directives to load an external file), making it complicated to uninstall such changes.

But as for now I still like this solution very much.

Offline

#6 2024-02-25 19:38:01

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: Application config as package

avi9526 wrote:

Some files should not be deleted when uninstalling a package...

And this ability is built in to your package manager if you built a proper package which again would be easier and would be far far better.  But I'll leave you be to keep perfecting your footgun.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

Board footer

Powered by FluxBB