Merge branch 'main' of ssh://git.autonomic.zone:2222/ruangrupa/living-room
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Aadil Ayub 2022-01-06 15:50:19 +05:00
commit 60d355cd36
10 changed files with 202 additions and 18 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
/content/
/public/

42
.drone.yml Normal file
View File

@ -0,0 +1,42 @@
---
kind: pipeline
name: continuous deployment
steps:
- name: push hugo image
image: plugins/docker
settings:
username:
from_secret: docker_reg_username
password:
from_secret: docker_reg_passwd
dockerfile: Dockerfile.hugo
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:
stack: beta_lumbung_space
host: lumbung.space
deploy_key:
from_secret: drone_ssh_lumbung.space
depends_on:
- push hugo image
- push scripts image
trigger:
branch:
- main
event:
exclude:
- pull_request

5
.gitignore vendored
View File

@ -1,4 +1,5 @@
*.lock
.env
/public/
.venv/
/content/
.venv/
/public/

View File

@ -1,11 +0,0 @@
FROM klakegg/hugo:alpine
RUN apk add --no-cache curl git
EXPOSE 1313
COPY . /src/
ENTRYPOINT ["/bin/bash"]
CMD ["-c", "hugo server --appendPort='false' --bind 0.0.0.0 --baseUrl='https://beta.lumbung.space' --port='1313' -F"]

7
Dockerfile.hugo Normal file
View File

@ -0,0 +1,7 @@
FROM klakegg/hugo:alpine
RUN apk add --no-cache curl git
EXPOSE 1313
COPY . /src/

11
Dockerfile.scripts Normal file
View File

@ -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 .

View File

@ -1,17 +1,47 @@
# living room
[![Build Status](https://drone.autonomic.zone/api/badges/ruangrupa/living-room/status.svg?ref=refs/heads/main)](https://drone.autonomic.zone/ruangrupa/living-room)
> A new attempt to bring together the ideas of the "splash" page, "portal" page
> and a comfortable digital "living room" experience for lumbung[dot]space.
> This is a work in progress. The end goal of this is to have a new design and
> implementation for [`lumbung.space`](https://lumbung.space) for January 2022.
## Hacking
## FAQ
[Install Hugo](https://gohugo.io/getting-started/installing/).
### How does the CI/CD work?
The [`.drone.yml`](./.drone.yml) triggers a build on [drone.autonomic.zone](https://drone.autonomic.zone/ruangrupa/living-room) of the [`Dockerfile.hugo`](./Dockerfile.hugo) and the [`Dockerfile.scripts`](./Dockerfile.scripts) and then deploys the [`compose.yml`](./compose.yml) stack using `docker stack deploy`.
### How often is the content regenerated?
See the `sleep ...` statements in the [`compose.yml`](./compose.yml).
### How do I see if content generation is working?
(requires `lumbung.space` docker context)
- `docker service logs -f beta_lumbung_space_peertube`
- `docker service logs -f beta_lumbung_space_calendar`
- `docker service logs -f beta_lumbung_space_feed`
Where `beta_lumbung_space_<service-name>` and you see the service name in the [`compose.yml`](./compose.yml).
### How do I add a feed?
Add your RSS feed URL to [`feeds_list.txt`](./feeds_list.txt) and don't forget [this deploy step](https://git.autonomic.zone/ruangrupa/living-room#deploy-a-new-feeds_list-txt).
### How do I wipe all the generated content?
(requires `lumbung.space` docker context)
`docker exec -it $(docker container ls -q -f name=beta_lumbung_space_app) bash -c "rm -rf /src/content/*"`
## Hacking
### Generate the site
`hugo serve --watch`
[Install Hugo](https://gohugo.io/getting-started/installing/) and `hugo serve --watch`
### Generate `lumbung[dot]space` posts
@ -28,6 +58,27 @@ lumbunglib-cal
export OUTPUT_DIR=content/video
lumbunglib-vid
export OUTPUT_DIR=content/feed
lumbunglib-feed # reads ./feeds_list.txt
```
Afterwards, you can automatically run it with `make gen`.
After a `git pull`, you may need to run `pip install git+https://git.autonomic.zone/ruangrupa/lumbunglib` again.
### Manually deploying new images
- `docker login -u decentral1se -p $(logins/dockerhub/decentral1se)`
- `make push-hugo`
- `make push-scripts`
### Manually deploy the site
(requires `lumbung.space` docker context)
- `make deploy`
### Deploy a new `feeds_list.txt`
Increment the `_v<n>` (e.g. `v1` -> `v2`) in [`compose.yml`](./compose.yml) `configs` to avoid any deployment error.

View File

@ -14,6 +14,14 @@ services:
start_period: 15s
volumes:
- content:/src/content
command: |
server
--appendPort='false'
--bind 0.0.0.0
--baseUrl='https://beta.lumbung.space'
--port='1313'
--buildFuture
--watch
deploy:
update_config:
failure_action: rollback
@ -25,9 +33,69 @@ 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/calendar
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
"
feed:
image: decentral1se/beta.lumbung.space-scripts:latest
volumes:
- content:/src/content
configs:
- source: feeds_list
target: /src/feeds_list.txt
environment:
OUTPUT_DIR: /src/content/feed
command: |
bash -c "
while true
do
echo 'generating feed posts...'
lumbunglib-feed
echo 'going to sleep for 5 minutes...'
sleep 300
done
"
volumes:
content:
networks:
proxy:
external: true
configs:
feeds_list:
name: beta_lumbung_space_feeds_list_v1
file: feeds_list.txt

1
feeds_list.txt Normal file
View File

@ -0,0 +1 @@
https://artivismo.org/feed/

View File

@ -7,6 +7,18 @@ gen:
@CALENDAR_URL="https://cloud.lumbung.space/remote.php/dav/public-calendars/WbnHM8YdCkKT6bcT?export"; \
OUTPUT_DIR=content/calendar; \
lumbunglib-cal && \
OUTPUT_DIR=content/video lumbunglib-vid
OUTPUT_DIR=content/video lumbunglib-vid && \
OUTPUT_DIR=content/feed lumbunglib-feed
.PHONY: serve
push-hugo:
@docker build -t decentral1se/beta.lumbung.space -f Dockerfile.hugo . && \
docker push decentral1se/beta.lumbung.space
push-scripts:
@docker build --no-cache -t decentral1se/beta.lumbung.space-scripts -f Dockerfile.scripts . && \
docker push decentral1se/beta.lumbung.space-scripts
deploy:
@DOCKER_CONTEXT=lumbung.space docker stack deploy -c compose.yml beta_lumbung_space
.PHONY: serve gen push-hugo push-scripts deploy