summary refs log tree commit diff
path: root/pkgs/servers/calibre-web/db-migrations.patch
diff options
context:
space:
mode:
authorPavel Borzenkov <pavel@borzenkov.net>2021-02-22 14:10:46 +0300
committerPavel Borzenkov <pavel@borzenkov.net>2021-03-21 17:10:12 +0300
commitf069cdb0dce80bb91055d94cca5c0a21b48b7fcd (patch)
treee0e29eea010ab5c6d78dc4f79c8b812e9bf5627b /pkgs/servers/calibre-web/db-migrations.patch
parent6259a47c45a11e8097464446660318873edc23d1 (diff)
downloadnixpkgs-f069cdb0dce80bb91055d94cca5c0a21b48b7fcd.tar
nixpkgs-f069cdb0dce80bb91055d94cca5c0a21b48b7fcd.tar.gz
nixpkgs-f069cdb0dce80bb91055d94cca5c0a21b48b7fcd.tar.bz2
nixpkgs-f069cdb0dce80bb91055d94cca5c0a21b48b7fcd.tar.lz
nixpkgs-f069cdb0dce80bb91055d94cca5c0a21b48b7fcd.tar.xz
nixpkgs-f069cdb0dce80bb91055d94cca5c0a21b48b7fcd.tar.zst
nixpkgs-f069cdb0dce80bb91055d94cca5c0a21b48b7fcd.zip
calibre-web: init at 0.6.11
There are two patches applied to 'calibre-web' in order to make it more
NixOS friendly:

  - default-logger.patch switches default log output to /dev/stdout, as
    otherwise calibre-web tries to open a file relative to its location,
    which it can't do as the store is read-only. It's not possible to
    pass log file location via command line flags.

  - run-migrations.patch adds an env var __RUN_MIGRATIONS_AND_EXIT that,
    when set, instructs calibre-web to run DB migrations and exit. As
    almost all config parameters are configured via UI in sqlite3 DB,
    this patch allows the DB to be pre-created so it can be updated by
    systemd pre-start script later.  Thus, allowing calibre-web to be
    configured declaratively.
Diffstat (limited to 'pkgs/servers/calibre-web/db-migrations.patch')
-rw-r--r--pkgs/servers/calibre-web/db-migrations.patch14
1 files changed, 14 insertions, 0 deletions
diff --git a/pkgs/servers/calibre-web/db-migrations.patch b/pkgs/servers/calibre-web/db-migrations.patch
new file mode 100644
index 00000000000..87e63f7d95c
--- /dev/null
+++ b/pkgs/servers/calibre-web/db-migrations.patch
@@ -0,0 +1,14 @@
+diff --git a/cps/__init__.py b/cps/__init__.py
+index 627cca0b..233bb2dd 100644
+--- a/cps/__init__.py
++++ b/cps/__init__.py
+@@ -87,6 +87,9 @@ db.CalibreDB.setup_db(config, cli.settingspath)
+ 
+ calibre_db = db.CalibreDB()
+ 
++if os.environ.get('__RUN_MIGRATIONS_AND_EXIT'):
++    sys.exit(0)
++
+ def create_app():
+     app.wsgi_app = ReverseProxied(app.wsgi_app)
+     # For python2 convert path to unicode