-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Cloudflare Workers KV storage support, and improved k8s support
- Loading branch information
1 parent
3e8b768
commit 004897c
Showing
8 changed files
with
217 additions
and
4 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.direnv/ | ||
.envrc | ||
secrets.yml |
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,20 @@ | ||
#!/bin/bash | ||
|
||
if [ "$1" = "all" ]; then | ||
TARGETS=$(kubectx) | ||
else | ||
TARGETS=$1 | ||
fi | ||
|
||
echo "===================================================" | ||
while IFS= read -r line | ||
do | ||
echo "Deploying to ${line}" | ||
echo "===================================================" | ||
|
||
kubectx "$line" > /dev/null | ||
cat k8s.yml | envsubst | kubectl apply -n ${NAMESPACE} -f - | ||
|
||
echo "" | ||
echo "===================================================" | ||
done <<< $TARGETS |
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,20 @@ | ||
#!/bin/bash | ||
|
||
if [ "$1" = "all" ]; then | ||
TARGETS=$(kubectx) | ||
else | ||
TARGETS=$1 | ||
fi | ||
|
||
echo "===================================================" | ||
while IFS= read -r line | ||
do | ||
echo "Deploying to ${line}" | ||
echo "===================================================" | ||
|
||
kubectx "$line" > /dev/null | ||
cat k8s.yml | envsubst | kubectl delete -n ${NAMESPACE} -f - | ||
|
||
echo "" | ||
echo "===================================================" | ||
done <<< $TARGETS |
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,20 @@ | ||
#!/bin/bash | ||
|
||
if [ "$1" = "all" ]; then | ||
TARGETS=$(kubectx) | ||
else | ||
TARGETS=$1 | ||
fi | ||
|
||
echo "===================================================" | ||
while IFS= read -r line | ||
do | ||
echo "Rolling to ${line}" | ||
echo "===================================================" | ||
|
||
kubectx "$line" > /dev/null | ||
kubectl rollout restart deployment/${NAME} -n ${NAMESPACE} && kubectl rollout status deployment/${NAME} -n ${NAMESPACE} | ||
|
||
echo "" | ||
echo "===================================================" | ||
done <<< $TARGETS |
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,19 @@ | ||
FROM alpine:latest | ||
MAINTAINER Matthew Gall <docker@matthewgall.com> | ||
|
||
RUN apk add --update \ | ||
build-base \ | ||
python3 \ | ||
python3-dev \ | ||
py-pip \ | ||
openssl-dev \ | ||
libffi-dev \ | ||
&& rm -rf /var/cache/apk/* | ||
|
||
WORKDIR /app | ||
COPY . /app | ||
|
||
RUN pip3 install --upgrade pip && \ | ||
pip3 install -r /app/requirements.txt | ||
|
||
CMD ["python3", "/app/app.py"] |
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,22 @@ | ||
export NAME?=drandarchive | ||
export NAMESPACE?=drandarchive | ||
export IMAGE?=matthewgall/drandarchive.com | ||
export COLO:=$(shell kubectx -c) | ||
|
||
.PHONY: apply apply-all | ||
apply: | ||
@.utils/apply ${COLO} | ||
apply-all: | ||
@.utils/apply all | ||
|
||
.PHONY: delete delete-all | ||
delete: | ||
@.utils/delete ${COLO} | ||
delete-all: | ||
@.utils/delete all | ||
|
||
.PHONY: rollout rollout-all | ||
rollout: | ||
@.utils/rollout ${COLO} | ||
rollout-all: | ||
@.utils/rollout all |
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,81 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: ${NAMESPACE} | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: ${NAME}-drandcloudflarecom-backfill | ||
labels: | ||
app: ${NAME}-drandcloudflarecom-backfill | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: ${NAME}-drandcloudflarecom-backfill | ||
image: matthewgall/drandarchive:latest | ||
args: ["--backfill", "--cf"] | ||
env: | ||
- name: DRAND_SERVER | ||
value: drand.cloudflare.com | ||
- name: DELAY | ||
value: "120" | ||
- name: CLOUDFLARE_ACCOUNT | ||
valueFrom: | ||
secretKeyRef: | ||
name: ${NAME}-secrets | ||
key: cf-account | ||
- name: CLOUDFLARE_TOKEN | ||
valueFrom: | ||
secretKeyRef: | ||
name: ${NAME}-secrets | ||
key: cf-token | ||
- name: CLOUDFLARE_NAMESPACE | ||
valueFrom: | ||
secretKeyRef: | ||
name: ${NAME}-secrets | ||
key: cf-namespace | ||
restartPolicy: Never | ||
backoffLimit: 4 | ||
-- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: ${NAME}-drandcloudflarecom-server | ||
labels: | ||
app: ${NAME} | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: ${NAME}-drandcloudflarecom-server | ||
template: | ||
metadata: | ||
labels: | ||
app: ${NAME}-drandcloudflarecom-server | ||
spec: | ||
containers: | ||
- name: ${NAME}-drandcloudflarecom-server | ||
image: matthewgall/drandarchive.com:latest | ||
args: ["--sv", "--cf"] | ||
env: | ||
- name: DRAND_SERVER | ||
value: drand.cloudflare.com | ||
- name: DELAY | ||
value: "10" | ||
- name: CLOUDFLARE_ACCOUNT | ||
valueFrom: | ||
secretKeyRef: | ||
name: ${NAME}-secrets | ||
key: cf-account | ||
- name: CLOUDFLARE_TOKEN | ||
valueFrom: | ||
secretKeyRef: | ||
name: ${NAME}-secrets | ||
key: cf-token | ||
- name: CLOUDFLARE_NAMESPACE | ||
valueFrom: | ||
secretKeyRef: | ||
name: ${NAME}-secrets | ||
key: cf-namespace |