cfg: In develop mode, use /var/lib for DB and sessions

- Only effects develop mode.

- To primarily avoid writing to the source code directory. Multiple containers
or VMs using the source folder won't fight with the database file (the overlay
file system plan is not working out well for containers #1873).

- In the earlier days, we used to allow running from source code directory
without even doing ./setup.py install. Currently it is not possible anyway. We
pretty much install freedombox package before running from source directory.

- If the build process itself learns not to write to source directory, then
containers/VMs won't have to write to source directory at all.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2020-06-24 00:54:17 -07:00 committed by James Valleroy
parent a2281aaf07
commit 91c4d6742e
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 9 additions and 16 deletions

View File

@ -47,16 +47,15 @@ Shared folder: Using systemd-nspawn, the project directory is mounted as
/freedombox inside the container. The project directory is determined as /freedombox inside the container. The project directory is determined as
directory in which this script resides. The project folder from the container directory in which this script resides. The project folder from the container
point of view will be read-only. Container should be able to write various point of view will be read-only. Container should be able to write various
files such as build files, FreedomBox sqlite3 database and session files into files such as build files into the /freedombox folder. To enable writing, an
the /freedombox folder. To enable writing, an additional read-write folder is additional read-write folder is overlayed onto /freedombox folder in the
overlayed onto /freedombox folder in the container. This directory can't be container. This directory can't be created under the project folder and is
created under the project folder and is created instead in created instead in $XDG_DATA_HOME/freedombox-container/overlay/$DISTRIBUTION.
$XDG_DATA_HOME/freedombox-container/overlay/$DISTRIBUTION. If XDG_DATA_HOME is If XDG_DATA_HOME is not set, it is assumed to be $HOME/.local/shared/. Whenever
not set, it is assumed to be $HOME/.local/shared/. Whenever data is written data is written into /freedombox directory inside the container, this directory
into /freedombox directory inside the container, this directory on the host on the host receives the changes. See documentation for Overlay filesystem for
receives the changes. See documentation for Overlay filesystem for further further details. When container is destroyed, this overlay folder is destroyed
details. When container is destroyed, this overlay folder is destroyed to to ensure clean state after bringing up the container again.
ensure clean state after bringing up the container again.
Users: PrivateUsers configuration flag for systemd-nspawn is currently off. Users: PrivateUsers configuration flag for systemd-nspawn is currently off.
This means that each user's UID on the host is also the same UID in the This means that each user's UID on the host is also the same UID in the
@ -138,9 +137,6 @@ KEY_SERVER = 'keys.gnupg.net'
PROVISION_SCRIPT = ''' PROVISION_SCRIPT = '''
set -x set -x
# Remove FreedomBox database lingering in source directory to start fresh
sudo rm -f /freedombox/data/var/lib/plinth/plinth.sqlite3
cd /freedombox/ cd /freedombox/
sudo apt-get update sudo apt-get update

View File

@ -1,8 +1,5 @@
[Path] [Path]
file_root = %(parent_parent_dir)s file_root = %(parent_parent_dir)s
config_dir = %(file_root)s/data/etc/plinth config_dir = %(file_root)s/data/etc/plinth
data_dir = %(file_root)s/data/var/lib/plinth
actions_dir = %(file_root)s/actions actions_dir = %(file_root)s/actions
doc_dir = %(file_root)s/doc doc_dir = %(file_root)s/doc
custom_static_dir = %(file_root)s/data/var/www/plinth/custom/static
store_file = %(data_dir)s/plinth.sqlite3