Skip to content

Commit

Permalink
Add docker and k8s example, closes #3
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustavo Carneiro committed Jan 10, 2018
1 parent 99de463 commit 3d540c4
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 1 deletion.
3 changes: 2 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ History
--------------

* Added the ``utc`` option and document that times are utc by default (#17);
* If an email body is empty, skip sending it.
* If an email body is empty, skip sending it;
* Added docker and k8s example.


0.6.0 (2017-11-24)
Expand Down
11 changes: 11 additions & 0 deletions example/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM ubuntu:xenial

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -q \
python3 virtualenv

RUN virtualenv -p /usr/bin/python3 /yacron && \
/yacron/bin/pip install yacron

COPY yacrontab.yaml /etc/yacron.d/yacrontab.yaml

ENTRYPOINT ["/yacron/bin/yacron"]
28 changes: 28 additions & 0 deletions example/docker/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
A simple example of how to add yacron to a docker image. To try it out,
run for instance:

$ docker build -t yacrondemo .
$ docker run -ti yacrondemo -l DEBUG # Ctrl-C to stop

Moreover, you can find an example of deploying to Kubernetes in the
``k8s-deploy.yaml`` file. To test:

$ kubectl apply -f k8s-deploy.yaml
deployment "yacrondemo" created

Check that the pod was created:

$ kubectl get pods -l app=yacrondemo
NAME READY STATUS RESTARTS AGE
yacrondemo-cffff957f-9dt5r 1/1 Running 0 1m

Follow the logs from the pod:

$ kubectl logs --timestamps -f yacrondemo-cffff957f-9dt5r

(hit Ctrl-C to stop following logs)

To undo the changes and stop the pod:

$ kubectl delete deployment yacrondemo
deployment "yacrondemo" deleted
26 changes: 26 additions & 0 deletions example/docker/k8s-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: yacrondemo
spec:
replicas: 1
template:
metadata:
labels:
app: yacrondemo
spec:
containers:
- name: yacrondemo
image: yacrondemo
imagePullPolicy: Never
resources:
limits:
cpu: 200m
memory: 128Mi
requests:
cpu: 10m
memory: 64Mi
env:
- name: PYTHONIOENCODING
value: "utf-8"
10 changes: 10 additions & 0 deletions example/docker/yacrontab.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
defaults:
environment:
- key: PYTHONIOENCODING
value: utf-8

jobs:
- name: test-01
command: echo "hello from $HOSTNAME"
schedule: "*/2 * * * *"
captureStdout: true

0 comments on commit 3d540c4

Please sign in to comment.