From d92732109f1f0f904e6794e3075fe7487611329e Mon Sep 17 00:00:00 2001 From: cellarspoon Date: Wed, 5 Jan 2022 12:53:04 +0100 Subject: [PATCH] feat: add content generation See https://git.autonomic.zone/ruangrupa/living-room/issues/17. --- .drone.yml | 16 +++++++++++++++- Dockerfile.scripts | 11 +++++++++++ compose.yml | 35 +++++++++++++++++++++++++++++++++++ makefile | 4 ++++ 4 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 Dockerfile.scripts diff --git a/.drone.yml b/.drone.yml index 752e4c8..dc82c3a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -2,7 +2,7 @@ kind: pipeline name: continuous deployment steps: - - name: build image + - name: push hugo image image: plugins/docker settings: username: @@ -13,6 +13,17 @@ steps: repo: decentral1se/beta.lumbung.space tags: latest + - name: push scripts image + image: plugins/docker + settings: + username: + from_secret: docker_reg_username + password: + from_secret: docker_reg_passwd + dockerfile: Dockerfile.scripts + repo: decentral1se/beta.lumbung.space-scripts + tags: latest + - name: deploy stack image: decentral1se/stack-ssh-deploy:latest settings: @@ -20,6 +31,9 @@ steps: host: lumbung.space deploy_key: from_secret: drone_ssh_lumbung.space + depends_on: + - push hugo image + - push scripts image trigger: branch: - main diff --git a/Dockerfile.scripts b/Dockerfile.scripts new file mode 100644 index 0000000..36c5da8 --- /dev/null +++ b/Dockerfile.scripts @@ -0,0 +1,11 @@ +FROM python:3.9.9-alpine + +RUN apk add --no-cache git bash + +WORKDIR /src/ + +RUN git clone https://git.autonomic.zone/ruangrupa/lumbunglib /src/ + +RUN pip install -U setuptools pip + +RUN pip install . diff --git a/compose.yml b/compose.yml index a3e7be3..ae0e431 100644 --- a/compose.yml +++ b/compose.yml @@ -33,6 +33,41 @@ services: - "traefik.http.services.coop-cloud-site.loadbalancer.server.port=1313" - "traefik.http.routers.coop-cloud-site.tls.certresolver=production" + peertube: + image: decentral1se/beta.lumbung.space-scripts:latest + volumes: + - content:/src/content + environment: + OUTPUT_DIR: /src/content/video + command: | + bash -c " + while true + do + echo 'generating peertube posts...' + lumbunglib-vid + echo 'going to sleep for 5 minutes...' + sleep 300 + done + " + + calendar: + image: decentral1se/beta.lumbung.space-scripts:latest + volumes: + - content:/src/content + environment: + OUTPUT_DIR: /src/content/video + CALENDAR_URL: "https://cloud.lumbung.space/remote.php/dav/public-calendars/WbnHM8YdCkKT6bcT?export" + command: | + bash -c " + while true + do + echo 'generating calendar posts...' + lumbunglib-cal + echo 'going to sleep for 5 minutes...' + sleep 300 + done + " + volumes: content: diff --git a/makefile b/makefile index b85c228..aa59b6e 100644 --- a/makefile +++ b/makefile @@ -13,4 +13,8 @@ push-hugo: @docker build -t decentral1se/beta.lumbung.space -f Dockerfile.hugo . && \ docker push decentral1se/beta.lumbung.space +push-scripts: + @docker build -t decentral1se/beta.lumbung.space-scripts -f Dockerfile.scripts . && \ + docker push decentral1se/beta.lumbung.space-scripts + .PHONY: serve gen push-hugo