fix: rdb files can not be saved because of permission issues bug: redis can not save RDB files #318 (#472)
* fix: rdb files can not be saved because of permission issues bug: redis can not save RDB files #318 * refactor: move db and redis dumps to /appdata directory
This commit is contained in:
@@ -52,10 +52,14 @@ FROM base AS runner
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN apk add --no-cache redis
|
RUN apk add --no-cache redis
|
||||||
|
RUN mkdir /appdata
|
||||||
|
RUN mkdir /appdata/db
|
||||||
|
RUN mkdir /appdata/redis
|
||||||
|
|
||||||
# Don't run production as root
|
# Don't run production as root
|
||||||
RUN addgroup --system --gid 1001 nodejs
|
RUN addgroup --system --gid 1001 nodejs
|
||||||
RUN adduser --system --uid 1001 nextjs
|
RUN adduser --system --uid 1001 nextjs
|
||||||
|
RUN chown -R nextjs:nodejs /appdata
|
||||||
USER nextjs
|
USER nextjs
|
||||||
|
|
||||||
COPY --from=installer /app/apps/nextjs/next.config.mjs .
|
COPY --from=installer /app/apps/nextjs/next.config.mjs .
|
||||||
@@ -73,8 +77,9 @@ COPY --from=installer --chown=nextjs:nodejs /app/apps/nextjs/.next/standalone ./
|
|||||||
COPY --from=installer --chown=nextjs:nodejs /app/apps/nextjs/.next/static ./apps/nextjs/.next/static
|
COPY --from=installer --chown=nextjs:nodejs /app/apps/nextjs/.next/static ./apps/nextjs/.next/static
|
||||||
COPY --from=installer --chown=nextjs:nodejs /app/apps/nextjs/public ./apps/nextjs/public
|
COPY --from=installer --chown=nextjs:nodejs /app/apps/nextjs/public ./apps/nextjs/public
|
||||||
COPY --chown=nextjs:nodejs scripts/run.sh ./run.sh
|
COPY --chown=nextjs:nodejs scripts/run.sh ./run.sh
|
||||||
|
COPY --chown=nextjs:nodejs packages/redis/redis.conf /app/redis.conf
|
||||||
|
|
||||||
ENV DB_URL='/app/db/db.sqlite'
|
ENV DB_URL='/appdata/db/db.sqlite'
|
||||||
ENV DB_DIALECT='sqlite'
|
ENV DB_DIALECT='sqlite'
|
||||||
ENV DB_DRIVER='better-sqlite3'
|
ENV DB_DRIVER='better-sqlite3'
|
||||||
|
|
||||||
|
|||||||
5
packages/redis/redis.conf
Normal file
5
packages/redis/redis.conf
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Directory to store dump.rdb
|
||||||
|
dir /appdata/redis
|
||||||
|
|
||||||
|
# Save the data to disk every 60 seconds if at least 1 key changed
|
||||||
|
save 60 1
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
node ./db/migrations/$DB_DIALECT/migrate.cjs ./db/migrations/$DB_DIALECT
|
node ./db/migrations/$DB_DIALECT/migrate.cjs ./db/migrations/$DB_DIALECT
|
||||||
|
|
||||||
# Start Redis
|
# Start Redis
|
||||||
redis-server &
|
redis-server /app/redis.conf &
|
||||||
|
|
||||||
# Run the tasks backend
|
# Run the tasks backend
|
||||||
node apps/tasks/tasks.cjs &
|
node apps/tasks/tasks.cjs &
|
||||||
|
|||||||
Reference in New Issue
Block a user