-
Notifications
You must be signed in to change notification settings - Fork 18
chore(container): rename database file volume to storage #363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughDirectory names, environment variables, and volume references related to SQLite database storage have been changed from Changes
Sequence Diagram(s)sequenceDiagram
participant Docker Compose
participant Container
participant Entrypoint Script
participant Application
Docker Compose->>Container: Mounts ./storage as /storage
Container->>Entrypoint Script: Executes entrypoint.sh
Entrypoint Script->>Entrypoint Script: Check if /storage/players-sqlite3.db exists
alt File missing
Entrypoint Script->>Entrypoint Script: Copy from image default /storage/players-sqlite3.db
else File exists
Entrypoint Script->>Entrypoint Script: Proceed
end
Entrypoint Script->>Application: Start application with STORAGE_PATH=/storage/players-sqlite3.db
Application->>Application: Use STORAGE_PATH for SQLite DB
Possibly related PRs
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Note ⚡️ Faster reviews with cachingCodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure ✨ Finishing Touches
🧪 Generate Unit Tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #363 +/- ##
=======================================
Coverage 89.18% 89.18%
=======================================
Files 2 2
Lines 111 111
=======================================
Hits 99 99
Misses 12 12
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
scripts/entrypoint.sh (1)
16-17: Error handling for missing source file
Exiting with code 1 when the source DB file is absent is appropriate. As a minor improvement, consider adding a more descriptive log line or redirecting errors to stderr.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
storage/players-sqlite3.dbis excluded by!**/*.db
📒 Files selected for processing (4)
Dockerfile(1 hunks)database/player_database.py(1 hunks)docker-compose.yml(1 hunks)scripts/entrypoint.sh(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (6)
database/player_database.py (1)
11-12: Environment variable rename and default path update
TheSTORAGE_PATHenv var and default fallback to./storage/players-sqlite3.dbare updated correctly, and thesqlite+aiosqlite:///{storage_path}string builds the right absolute URI.Dockerfile (2)
50-50: Verify initial database copy path
TheCOPY storage ./docker-composeinstruction is meant to seed/app/docker-compose/players-sqlite3.dbinside the image (matchingIMAGE_STORAGE_PATH). Please confirm that this produces the expected file location.
55-56: Prepare volume mount point with correct ownership
Addingmkdir -p /storageandchown fastapi:fastapi /storageensures the/storagedirectory is present and writable by the non-rootfastapiuser in a single layer.docker-compose.yml (1)
11-14: Consistent volume and environment variable renaming
The volume formerly namedsqlite3-dbis nowstorageand mounted at/storage/. TheSTORAGE_PATHenv var points to/storage/players-sqlite3.db, and thevolumes:section reflectsstorage:accordingly. These align with the Dockerfile and application code.Also applies to: 18-18
scripts/entrypoint.sh (2)
4-5: Update entrypoint paths
Renamed and repointedIMAGE_STORAGE_PATHto/app/docker-compose/players-sqlite3.dbandVOLUME_STORAGE_PATHto/storage/players-sqlite3.db. Ensure this matches the Dockerfile’s copy target.
9-15: Initial database copy logic
Theif [ ! -f "$VOLUME_STORAGE_PATH" ]block correctly handles seeding the database on first run and skips on subsequent starts. The flow is clear and robust.



This change is
Summary by CodeRabbit
sqlite3-dbtostoragefor database file storage and environment variables.storagedirectory andSTORAGE_PATHenvironment variable.