Skip to content

Commit 759911e

Browse files
committed
Updated most files for Docker Cloud migration
Signed-off-by: French Ben <me+git@frenchben.com>
1 parent 1c8ac5b commit 759911e

File tree

4 files changed

+20
-22
lines changed

4 files changed

+20
-22
lines changed

Dockerfile

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM sillelien/base-alpine:0.9.2
1+
FROM sillelien/base-alpine:0.10
22

33
RUN echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
44
apk update && apk upgrade && \
@@ -9,4 +9,3 @@ RUN chmod 755 /run.sh
99
COPY cron.sh /etc/services.d/cron/run
1010
RUN chmod 755 /etc/services.d/cron/run
1111
CMD /run.sh
12-

README.md

+13-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# A Cron Scheduler for Tutum
22

3-
##Intro
3+
## Intro
44

55
To use you simply need to add a link to each service you wish to schedule and then an environment variable that starts with the capitalized name of the service and which ends in _CRON_SCHEDULE, e.g.:
66

@@ -21,30 +21,32 @@ You'll also want to make sure you add the `global` role on tutum-cron:
2121
2222
Everything you really need to know is in the `tutum.yml` file, just take a look and you'll get the idea. So just press the button and get going:
2323

24-
[![Deploy to Tutum](https://s.tutum.co/deploy-to-tutum.svg)](https://dashboard.tutum.co/stack/deploy/)
24+
[![Deploy to Docker Cloud](https://s.tutum.co/deploy-to-tutum.svg)](https://cloud.docker.com/stack/deploy/)
25+
26+
27+
## Schedules
2528

26-
27-
##Schedules
28-
2929
Everything you need to know about scheduling can be found in the [fcrontab documentation](http://fcron.free.fr/doc/en/fcrontab.5.html) but simply you can use the cron syntax you are familiar with:
3030

31-
<pre><b>* * * * * *</b>
32-
| | | | | |
31+
```
32+
* * * * * *
33+
| | | | | |
3334
| | | | | +-- Year (range: 1900-3000)
3435
| | | | +---- Day of the Week (range: 1-7, 1 standing for Monday)
3536
| | | +------ Month of the Year (range: 1-12)
3637
| | +-------- Day of the Month (range: 1-31)
3738
| +---------- Hour (range: 0-23)
38-
+------------ Minute (range: 0-59)</pre>
39+
+------------ Minute (range: 0-59)
40+
```
3941

4042
You can of course use an online generator such as http://crontab-generator.org/ to help you along.
4143

42-
##Further Info
44+
## Further Info
4345

44-
This scheduler uses [fcron](http://fcron.free.fr/doc/en/fcrontab.5.html) to schedule commands, fcron is great because like anacron it catches up with running services it misses while down. So it's totally okay to change the config and restart the server.
46+
This scheduler uses [fcron](http://fcron.free.fr/doc/en/fcrontab.5.html) to schedule commands, fcron is great because like anacron it catches up with running services it misses while down. So it's totally okay to change the config and restart the server.
4547

4648
The base container uses work originally taken from https://github.com/just-containers/base-alpine credit to <John Regan>john@jrjrtech.com this provides us with the S6 supervisor which this image uses to run cron, dnsmasq and the main run.sh script.
4749

4850
The real base of this image though is [Alpine Linux](https://www.alpinelinux.org/) brought to Docker via [Glider Labs](http://gliderlabs.com/).
49-
51+
5052
[![](https://badge.imagelayers.io/vizzbuzz/tutum-cron.svg)](https://imagelayers.io/?images=vizzbuzz/tutum-cron:latest 'Get your own badge on imagelayers.io')

run.sh

+4-6
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ done
88

99
while true
1010
do
11-
env_vars=$(env | grep ".*_TUTUM_API_URL=" | cut -d= -f1 | tr '\n' ' ')
11+
env_vars=$(env | grep ".*_DOCKERCLOUD_SERVICE_API_URL=" | cut -d= -f1 | tr '\n' ' ')
1212

1313
[ ! -f /tmp/cron.tmp ] || rm /tmp/cron.tmp
1414

1515
for env_var in $env_vars
1616
do
1717
# Set on the remote service
18-
schedule_env_var=${env_var%_TUTUM_API_URL}_ENV_CRON_SCHEDULE
18+
schedule_env_var=${env_var%_DOCKERCLOUD_SERVICE_API_URL}_ENV_CRON_SCHEDULE
1919
# Set on the cron service
20-
schedule_var=${env_var%_TUTUM_API_URL}_CRON_SCHEDULE
20+
schedule_var=${env_var%_DOCKERCLOUD_SERVICE_API_URL}_CRON_SCHEDULE
2121

2222
if [[ -n $schedule_var ]]
2323
then
@@ -28,7 +28,7 @@ do
2828
service_url=${!env_var}
2929

3030
cat <<EOF >> /tmp/cron.tmp
31-
${schedule} curl -X POST -H "Authorization: $TUTUM_AUTH" -H "Accept: application/json" ${service_url}start/
31+
${schedule} curl -X POST -H "Authorization: $DOCKERCLOUD_AUTH" -H "Accept: application/json" ${service_url}start/
3232
EOF
3333
done
3434

@@ -38,5 +38,3 @@ EOF
3838
fcrontab /tmp/cron.tmp
3939
sleep 86400
4040
done
41-
42-

tutum.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
tutum-cron:
2-
image: vizzbuzz/tutum-cron
1+
cloud-cron:
2+
image: sillelien/tutum-cron
33
autorestart: always
44
cpu_shares: 128
55
mem_limit: 64m
@@ -14,4 +14,3 @@ tutum-cron:
1414
test:
1515
image: alpine
1616
command: 'echo On Schedule'
17-

0 commit comments

Comments
 (0)