You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR improves the default Docker deployment configuration so the project can be run directly with persistent application state, Parquet market data, Redis/Celery services, and minute-level data sync dependencies on a host machine or NAS/router environment.
Changes:
Mount host ./data to container /app/data for downloaded Parquet data packages.
Mount host ./instance to container /app/instance so the SQLite database survives container rebuilds/restarts.
Mount host ./logs to container /app/logs so logs are persisted outside the container.
Use the Compose service name redis for Redis/Celery settings instead of localhost, which does not point to the Redis container from inside web/worker containers.
Persist Redis data with a named volume.
Add restart: unless-stopped for the app services and Redis.
Update .env.example to match the Docker Compose paths and network settings.
Install requirements.txt in the Docker image instead of requirements_minimal.txt, because the Compose setup starts Redis/Celery-backed services and the minimal dependency set does not include required packages such as redis and celery.
Add pytdx to requirements.txt, because the Tongdaxin minute data sync imports pytdx.hq.TdxHq_API.
Why
The README tells users to download the Parquet data package and use the Docker deployment, but the previous Compose file did not mount the host data directory into the container. In practice, users who unzip the data package on the host still get startup warnings that required assets are missing because the container cannot see the files.
The previous .env.example also used localhost for Redis. In Docker Compose, localhost inside the web or worker container refers to that same container, not the Redis service. Using redis matches the Compose service name and allows the containers to connect reliably.
Persisting data, instance, logs, and Redis storage also prevents data loss when containers are rebuilt or upgraded.
Additionally, the minute-level Tongdaxin sync path currently imports pytdx, but pytdx was not listed in requirements.txt. Without it, syncing data such as 5min bars fails with No module named 'pytdx'.
Validation
Validated on an iStoreOS Docker host with a downloaded data.zip package:
Extracted the archive so files such as stock_basic.parquet, stock_trade_calendar.parquet, stock_business.parquet, daily_history/daily, and daily_basic/daily exist under host ./data.
Ran Docker Compose with the updated mounts and environment.
Verified all containers started:
web
worker
redis
Verified the app responded with HTTP/1.1 200 OK on port 5000.
Verified startup logs changed from missing critical Parquet assets to:
关键资产检查: 通过
✅ 大宽表: 宽表已是最新
Verified pytdx can be imported inside the Docker container.
Verified syncing 5min data no longer fails with No module named 'pytdx'.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves the default Docker deployment configuration so the project can be run directly with persistent application state, Parquet market data, Redis/Celery services, and minute-level data sync dependencies on a host machine or NAS/router environment.
Changes:
./datato container/app/datafor downloaded Parquet data packages../instanceto container/app/instanceso the SQLite database survives container rebuilds/restarts../logsto container/app/logsso logs are persisted outside the container.redisfor Redis/Celery settings instead oflocalhost, which does not point to the Redis container from insideweb/workercontainers.restart: unless-stoppedfor the app services and Redis..env.exampleto match the Docker Compose paths and network settings.requirements.txtin the Docker image instead ofrequirements_minimal.txt, because the Compose setup starts Redis/Celery-backed services and the minimal dependency set does not include required packages such asredisandcelery.pytdxtorequirements.txt, because the Tongdaxin minute data sync importspytdx.hq.TdxHq_API.Why
The README tells users to download the Parquet data package and use the Docker deployment, but the previous Compose file did not mount the host data directory into the container. In practice, users who unzip the data package on the host still get startup warnings that required assets are missing because the container cannot see the files.
The previous
.env.examplealso usedlocalhostfor Redis. In Docker Compose,localhostinside theweborworkercontainer refers to that same container, not the Redis service. Usingredismatches the Compose service name and allows the containers to connect reliably.Persisting
data,instance,logs, and Redis storage also prevents data loss when containers are rebuilt or upgraded.Additionally, the minute-level Tongdaxin sync path currently imports
pytdx, butpytdxwas not listed inrequirements.txt. Without it, syncing data such as5minbars fails withNo module named 'pytdx'.Validation
Validated on an iStoreOS Docker host with a downloaded
data.zippackage:stock_basic.parquet,stock_trade_calendar.parquet,stock_business.parquet,daily_history/daily, anddaily_basic/dailyexist under host./data.webworkerredisHTTP/1.1 200 OKon port5000.关键资产检查: 通过✅ 大宽表: 宽表已是最新pytdxcan be imported inside the Docker container.5mindata no longer fails withNo module named 'pytdx'.