-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docker and k8s example, closes #3
- Loading branch information
Gustavo Carneiro
committed
Jan 10, 2018
1 parent
99de463
commit 3d540c4
Showing
5 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |