Closed 0x3639 closed 1 year ago
You are using two different paths. You are saying store the db in ./dst.db
where the CWD is /go/src/discord-stock-ticker
per the dockerfile, whereas your volume is trying to use /dst.db
.
What I would recommend is something like this:
discordstockticker:
image: ghcr.io/rssnyder/discord-stock-ticker:3.10.2
environment:
- DB=/ticker_data/dst.db
- CACHE=true
volumes:
- ticker_data:/ticker_data
networks:
- ticker-net
ports:
- "8112:8080"
Which, when started, loaded, deleted, then restarted, reloads the bots for me:
zira ➜ ~ docker compose up -d
[+] Running 2/2
⠿ Container riley-discordstockticker-1 Started 0.7s
⠿ Container jellyfin Running 0.0s
zira ➜ ~ docker logs riley-discordstockticker-1
time="2023-01-08T21:00:57Z" level=info msg="Running discord-stock-ticker version development..."
time="2023-01-08T21:00:57Z" level=info msg="Will be storing state in /ticker_data/dst.db\n"
time="2023-01-08T21:00:57Z" level=info msg="Starting api server on 0.0.0.0:8080..."
zira ➜ ~ curl -X POST localhost:8080/floor --data '{
"marketplace": "opensea",
"name": "sappy-seals",
"nickname": true,
"frequency": 10,
"discord_bot_token": "xxxxx"
}'
{"marketplace":"opensea","name":"sappy-seals","nickname":true,"frequency":10,"client_id":"xxxx","discord_bot_token":"xxxxx"}
zira ➜ ~ docker logs riley-discordstockticker-1
time="2023-01-08T21:00:57Z" level=info msg="Running discord-stock-ticker version development..."
time="2023-01-08T21:00:57Z" level=info msg="Will be storing state in /ticker_data/dst.db\n"
time="2023-01-08T21:00:57Z" level=info msg="Starting api server on 0.0.0.0:8080..."
time="2023-01-08T21:01:03Z" level=info msg="Added floor: opensea\n"
time="2023-01-08T21:01:03Z" level=info msg="Watching floor price for opensea/sappy-seals"
zira ➜ ~ docker stop riley-discordstockticker-1
riley-discordstockticker-1
zira ➜ ~ docker rm riley-discordstockticker-1
riley-discordstockticker-1
zira ➜ ~ docker compose up -d
[+] Running 2/2
⠿ Container riley-discordstockticker-1 Started 0.4s
⠿ Container jellyfin Running 0.0s
zira ➜ ~ docker logs riley-discordstockticker-1
time="2023-01-08T21:01:13Z" level=info msg="Running discord-stock-ticker version development..."
time="2023-01-08T21:01:13Z" level=info msg="Will be storing state in /ticker_data/dst.db\n"
time="2023-01-08T21:01:13Z" level=info msg="Loaded floor from db: opensea-sappy-seals"
time="2023-01-08T21:01:13Z" level=info msg="Starting api server on 0.0.0.0:8080..."
time="2023-01-08T21:01:13Z" level=info msg="Watching floor price for opensea/sappy-seals"
Thank you for this feedback. This adjustment worked. I'll make sure to buy you a coffee. This app works great!!
Describe the bug When I restart my docker image the db does not persist the data and I need to reload all tickers manually.
To Reproduce Steps to reproduce the behavior:
create a
docker-compose.yml
file with the following configuration. Load tickers with the API and then restart the docker image.Expected behaviour I would expect the docker image to restart and load and run all the saved tickers. However when running
curl localhost:8080/ticker
I get {}Python (please complete the following information): Docker image per compose file above.
Additional context NA