mirror of
https://github.com/TheNetsky/Microsoft-Rewards-Script.git
synced 2026-01-10 02:16:18 +00:00
Docker updates and maintenance (#164)
- Update run_daily.sh to use compose.yaml env var overrides if present on scheduled jobs, not just first run. Defaults back to config.json values if no override specified. - update sample compose.yaml with volume mapping to keep config.json, accounts.json, and sessions folder persistent on local machine (e.g., to keep data persistent through updates).
This commit is contained in:
@@ -19,10 +19,11 @@ Under development, however mainly for personal use!
|
||||
**Note:** If you had previously built and run the script locally, remove the `/node_modules` and `/dist` from your Microsoft-Rewards-Script folder.
|
||||
|
||||
1. Download the source code
|
||||
2. Make changes to your `accounts.json` and `config.json`
|
||||
3. **Headless mode must be enabled.** You can do this in `config.json` or by using the `HEADLESS=true` environmental variable in docker run or docker compose.yaml (see below). Environmental variables are prioritized over the values in config.json.
|
||||
4. The container has in-built scheduling. Customize your schedule using the `CRON_START_TIME` environmental variable. Use [crontab.guru](crontab.guru) if you're unsure how to create a cron schedule.
|
||||
5. **Note:** the container will add between 5 and 50 minutes of randomized variability to your scheduled start times.
|
||||
2. Make changes to your `accounts.json` and `config.json`.
|
||||
3. Use volume mapping (see sample compose.yaml) to ensure these files are stored on your local machine and not inside the container. This way, your data (like account settings and config options) will persist even if the container is restarted or updated.
|
||||
4. **Headless mode must be enabled.** You can do this in `config.json` or by using the `HEADLESS=true` environmental variable in docker run or docker compose.yaml (see below). Environmental variables are prioritized over the values in config.json.
|
||||
5. The container has in-built scheduling. Customize your schedule using the `CRON_START_TIME` environmental variable. Use [crontab.guru](crontab.guru) if you're unsure how to create a cron schedule.
|
||||
6. **Note:** the container will add between 5 and 50 minutes of randomized variability to your scheduled start times.
|
||||
|
||||
### Option 1: build and run with docker run
|
||||
|
||||
|
||||
11
compose.yaml
11
compose.yaml
@@ -10,4 +10,13 @@ services:
|
||||
- CRON_START_TIME=0 5,11 * * *
|
||||
### Run on start, set to false to only run the script per the cron schedule
|
||||
- RUN_ON_START=true
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
### Replace "/path/to/" with the actual path to where you want to save the files on your local machine.
|
||||
- /path/to/accounts.json:/usr/src/microsoft-rewards-script/dist/accounts.json
|
||||
- /path/to/config.json:/usr/src/microsoft-rewards-script/dist/config.json
|
||||
- /path/to/sessions:/usr/src/microsoft-rewards-script/dist/browser/sessions #optional, saves your login session
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 2048M
|
||||
restart: unless-stopped
|
||||
|
||||
@@ -28,5 +28,8 @@ sleep $SLEEPTIME
|
||||
# Log the start of the script
|
||||
echo "Starting script..."
|
||||
|
||||
# Update config with environment variables before running the script
|
||||
node src/updateConfig.js
|
||||
|
||||
# Execute the Node.js script directly
|
||||
npm run start
|
||||
|
||||
Reference in New Issue
Block a user