Make Database Engine Default to /var/lib Directory
Created by: julianrichen
This is RFE to make the applications default database location be one of the following or similar:
/var/lib/platypush/main.db /var/lib/platypush/database.db /var/lib/platypush/db/main.db
I've been using platypush for a few days to test it out since it seems promising, I like your direction for the project and your Medium articles are well written. For reference the below is from testing when I was writing an Ansible role to automatically setup the service so I can redeploy on different machines if something happens.
When installing the daemon I was trying to keep it contained since it's not a system package. I was installing everything
/opt/platypush where I had:
/opt/platypush/venv was the Python virtual environment
/opt/platypush/config was the
/opt/platypush/log were the log files.
I then created a system user with no home directory and a shell
/sbin/nologin as I don't want the daemon user to have any more permissions then it should. You shouldn't be able to login to the user and it doesn't need a home directory as it only really needs to run the dameon. This caused issues because of config module always defaults the engine to
~/.local/share/platypush/main.db. I also noticed the working directory is the same.
I know you can override it in the
config.yaml but as a system user it would be best to not default to a user's home directory for data as it's not guaranteed to exists for system users or system installs. From
man hier.7 this would probably be best suited for
/var/lib/<package> since it contains state data for packages and subsystems. Other packages store daemon databases here.
Currently the default
config.yaml & log files are in respective system directories,
/var/log/platypush and only the DB isn't. Because of this you'll get errors if you make a non-home system user who doesn't have a home directory and
/home/<user>/.local/share/platypush/ doesn't exists.
A command line flag should probably also exists for the DB path and logs (which can only be override via
config.yaml) but I'll submit that as a different ticket.