Closed mgrimace closed 1 month ago
Whilst there's no env support, you can use docker volumes to persist your session across runs. You can login once with the login command, and then continue using the script with the session file. That way you won't have to save your password anywhere, only the session file. This method is described in this example command.
Sure, more methods of providing credentials could be added (in fact, when developing in the early days, before the CLI commands were implemented, I used env variables myself for that exact purpose).
As for the scheduling, it wouldn't be too hard, and it's actually a great idea. Until it's done, I recommend using ofelia.
I'll implement both features someday, but no ETA.
Thank you so much, and no rush of course, these are just my ‘wish list’ items. As for Ofelia, interesting, I’ve never used it before. Does the following compose make sense in terms of syntax for it? If so, I'll leave it here for others who may wish to accomplish the same scheduling.
And is there a ‘reasonable’ interval you recommend for checking for new releases without overburdening the server?
services:
scheduler:
image: mcuadros/ofelia:latest
container_name: scheduler
depends_on:
- itchclaim
command: daemon --docker
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
labels:
ofelia.job-run.itchclaim.schedule: "@every 6h"
ofelia.job-run.itchclaim.container: "itchclaim"
itchclaim:
container_name: itchclaim
image: ghcr.io/smart123s/itchclaim
volumes:
- /root/docker/appdata/itchclaim:/data
command: [
"--login", "${USERNAME}",
"--password", "${PASSWORD}",
"claim"
]
quickly reporting back that my compose posted above appears to be working as intended, the container runs every 6 hours and games are claiming
Added built-in schedule command in https://github.com/Smart123s/ItchClaim/commit/b868758035260dfc11329d081f47f5e9443a5bc3 Added support for loading from environment variables in https://github.com/Smart123s/ItchClaim/commit/adf37777aced403fb3c6476460357288d26d6481
As a side note, I'd recommend setting ofelia.job-run.itchclaim.schedule
to 0 28 0,6,12,18 * * *
as it aligns better with ItchClaim's online update schedule.
Thanks so much for these updates! Here’s a sample docker compose.yaml that uses these new features, and assuming users would put their username and password in a .env file:
services:
itchclaim:
container_name: itchclaim
image: ghcr.io/smart123s/itchclaim
volumes:
- /root/docker/appdata/itchclaim:/data
environment:
- ITCH_USERNAME=${ITCH_USERNAME}
- ITCH_PASSWORD=${ITCH_PASSWORD}
command: [
"schedule", "--cron", "28 0,6,12,18 * * *"
]
First, thanks for pulling this together. I cobbled together something messy a while back from another abandoned project,(https://github.com/mgrimace/claim_itch) and never bothered getting it working with docker (and it was scraping an reddit thread, which is probably defunct now, and the script itself took FOREVER)
As for scheduling, I'd love some kind of in-built/automatic daily cron scheduling via docker. Ideally, with support for setting the schedule via environmental variable in the run or compose.yaml (e.g., daily at 2:00 am by default, for example). I know this can be accomplished externally via system cron, but its nice and tidy if the container can stay up/running and idle, and just run the script at the specified interval from within the container.
As for env var support, it'd also be great to have environmental variables for username, password (and TOTM), that could be set either directly in a compose file, or via a .env file for security.
Thanks again, ~M