docs: Use directory for mounting

This commit is contained in:
SinTan1729
2025-10-03 23:20:09 -05:00
parent a61b5ac156
commit dcc7d94870
4 changed files with 8 additions and 11 deletions

6
.gitignore vendored
View File

@@ -2,11 +2,6 @@
actix/target
resources-final
# Ignore SQLite file
*.sqlite
*.sqlite-wal
*.sqlite-shm
# Ignore irrelevant dotfiles
.vscode/
**/.directory
@@ -17,3 +12,4 @@ cookie*
# Testing related
custom_dir
testing-data

View File

@@ -21,9 +21,9 @@ You can use the provided compose file as a base, modifying it as needed. Run it
docker compose up -d
```
If you're using a custom location for the `db_url`, make sure to make that file
before running the docker image, as otherwise a directory will be created in its
place, resulting in possibly unwanted behavior.
If you're using a custom location for the `db_url`, make sure to mount a whole
directory instead of a folder. Chhoto URL uses WAL journaling mode, so if this is
not done, there will be a low, but non-zero chance of data corruption.
## Building and running with docker

View File

@@ -29,7 +29,7 @@ audit:
cargo audit --file actix/Cargo.lock
docker-test: docker-local docker-stop test
docker run -t -p ${port}:${port} --name chhoto-url --env-file ./.env -v "${db_file}:${db_url}" -d chhoto-url
docker run -t -p ${port}:${port} --name chhoto-url --env-file ./.env -v "${db_dir}:/data" -d chhoto-url
docker logs chhoto-url -f
docker-dev: test build-dev

View File

@@ -23,8 +23,9 @@ services:
# Change if you want to mount the database somewhere else.
# In this case, you can get rid of the db volume below
# and instead do a mount manually by specifying the location.
# Make sure that you create an empty file with the correct name
# before starting the container if you do make any changes.
# Make sure that you mount a directory instead of a bare file
# since that might have a (low, but non-zero) possibility of
# corrupting your db since we use WAL journaling mode
# (In fact, I'd suggest that you do that so that you can keep
# a copy of your database.)
- db_url=/db/urls.sqlite