I would like to introduce some tips for Rancher’s beginner.
🏀 Add cron configuration
If you want Rancher to run script regularly:
- (1) Launch a stack for cron Rancher Cron Service
- (2) Add setting(label) for corn in
docker-compose.yml
Launch a stack for cron
Launch a stack for cron Rancher Cron Service.
Even if there are multiple hosts, we will take care of them collectively, so only one is fine.
docker-compose.rancher-cron.yml
is as follows:
version: '3.5' |
rancher-compose.yml
is as follows:
version: '2' |
After creating the above files, you can start the cron stack on Rancher with the following command.
rancher up -d --pull --force-upgrade --recreate --stack rancher-cron --file ./conf/docker-compose.rancher-cron.yml --rancher-file ./conf/rancher-compose.yml |
Add setting(label) for corn in docker-compose.yml
あとは実際にcronで定期的に実行したいスクリプトにcom.socialengine.rancher-cron.schedule: 0 */15 * * * *
といったラベルを追加しておきます。
Add a label such as com.socialengine.rancher-cron.schedule: 0 * / 15 * * * *
to your docker-compose.yml
for service.
docker-compose.some-script.yml
is as follows:
version: '3.5' |
rancher-compose.yml
is as follows:
version: '2' |
After creating the above files, you can start the cron stack on Rancher with the following command.
rancher rm --stop some-script |
🗽 References
🖥 Recommended VPS Service
VULTR provides high performance cloud compute environment for you.
Vultr has 15 data-centers strategically placed around the globe, you can use a VPS with 512 MB memory for just $ 2.5 / month ($ 0.004 / hour).
In addition, Vultr is up to 4 times faster than the competition, so please check it => Check Benchmark Results!!