From dfda8c6a98009f066171436988b5c03d046788b6 Mon Sep 17 00:00:00 2001 From: Nicolas Schmidt <34066664+NGimbal@users.noreply.github.com> Date: Tue, 27 Feb 2024 14:50:33 -0500 Subject: [PATCH] feat(wal): reenables wal mode for litefs after resolution of issue (#621) Co-authored-by: Kent C. Dodds --- other/Dockerfile | 4 +++- other/litefs.yml | 15 +++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/other/Dockerfile b/other/Dockerfile index fb7906a5..82652ba6 100644 --- a/other/Dockerfile +++ b/other/Dockerfile @@ -52,6 +52,8 @@ ENV CACHE_DATABASE_PATH="$LITEFS_DIR/$CACHE_DATABASE_FILENAME" ENV INTERNAL_PORT="8080" ENV PORT="8081" ENV NODE_ENV="production" +# For WAL support: https://github.com/prisma/prisma-engines/issues/4675#issuecomment-1914383246 +ENV PRISMA_SCHEMA_DISABLE_ADVISORY_LOCK = "1" # add shortcut for connecting to database CLI RUN echo "#!/bin/sh\nset -x\nsqlite3 \$DATABASE_URL" > /usr/local/bin/database-cli && chmod +x /usr/local/bin/database-cli @@ -68,7 +70,7 @@ COPY --from=build /myapp/prisma /myapp/prisma COPY --from=build /myapp/app/components/ui/icons /myapp/app/components/ui/icons # prepare for litefs -COPY --from=flyio/litefs:0.5.8 /usr/local/bin/litefs /usr/local/bin/litefs +COPY --from=flyio/litefs:0.5.11 /usr/local/bin/litefs /usr/local/bin/litefs ADD other/litefs.yml /etc/litefs.yml RUN mkdir -p /data ${LITEFS_DIR} diff --git a/other/litefs.yml b/other/litefs.yml index 63cc550b..bb423d57 100644 --- a/other/litefs.yml +++ b/other/litefs.yml @@ -34,13 +34,12 @@ exec: - cmd: npx prisma migrate deploy if-candidate: true - # re-enable these when this is fixed: https://github.com/superfly/litefs/issues/425 - # # Set the journal mode for the database to WAL. This reduces concurrency deadlock issues - # - cmd: sqlite3 $DATABASE_PATH "PRAGMA journal_mode = WAL;" - # if-candidate: true - - # # Set the journal mode for the cache to WAL. This reduces concurrency deadlock issues - # - cmd: sqlite3 $CACHE_DATABASE_PATH "PRAGMA journal_mode = WAL;" - # if-candidate: true + # Set the journal mode for the database to WAL. This reduces concurrency deadlock issues + - cmd: sqlite3 $DATABASE_PATH "PRAGMA journal_mode = WAL;" + if-candidate: true + + # Set the journal mode for the cache to WAL. This reduces concurrency deadlock issues + - cmd: sqlite3 $CACHE_DATABASE_PATH "PRAGMA journal_mode = WAL;" + if-candidate: true - cmd: npm start