back

pub / ktistec-tweaks

Tweaks for the ActivityPub server ktistec
git clone https://src.jayvii.de/pub/ktistec-tweaks.git
Home | Log | Files | Exports | Refs | Submodules | README | RSS

Activity: Jul, 2024 - Aug, 2024

Less More

ktistec tweaks

Small tweaks and hacks for ktistec.

Please send patches or remarks to jayvii+ktistec-tweaks[AT]posteo[DOT]de.


Docker

You can run ktistec via the provided docker-compose

cd docker/
docker-compose -f docker-compose.yaml up -d

CSS

Currently, the ./css/ directory contains three theming tweaks:

Purple-Ish Theme:

Purpleish Theme in Dark and Bright Mode

Mobile:

Mobile Navigation header with feather-icons on small screens (large screens have the original text labels)
Secondary Menu collapsed into the “Timelines” menu on small screen
Secondary Menu opened on hover or click on small screen
Pagination Buttons stretched across full width

Visibility:

Preview-Images without clipping and grey borders around the image previews
A post thread with several layers. The grey borders on the left side indicate layer depth.

Minify CSS:

make minify-css

Place the minified purpleish.min.css, layout.min.css and/or visibility.min.cssin the public/3rd/ directory and at AT THE START OF public/3rd/semantic-2.4.1.min.css:

@import url('purpleish.min.css');
@import url('visibility.min.css');
@import url('mobile.min.css');

/* ... rest of the file's content */

Manual installation:

KTISTEC_PATH="/var/www/ktistec"
KTISTEC_CSS="${KTISTEC_PATH}/public/3rd"
cp ./css/*.min.css ${KTISTEC_CSS}/
cp -r ./css/icons ${KTISTEC_CSS}/icons
echo "@import url('purpleish.min.css');" > ${KTISTEC_CSS}/tmp
echo "@import url('visibility.min.css');" >> ${KTISTEC_CSS}/tmp
echo "@import url('mobile.min.css');" >> ${KTISTEC_CSS}/tmp
cat ${KTISTEC_CSS}/semantic-*.min.css >> ${KTISTEC_CSS}/tmp
mv ${KTISTEC_CSS}/tmp ${KTISTEC_CSS}/semantic-*.min.css

Docker (via this repo’s docker-compose file):

docker cp ./css/purpleish.min.css ktistec:/app/public/3rd/purpleish.min.css
docker cp ./css/visibility.min.css ktistec:/app/public/3rd/visibility.min.css
docker cp ./css/mobile.min.css ktistec:/app/public/3rd/mobile.min.css
docker cp ./css/icons ktistec:/app/public/3rd/icons
docker exec -ti ktistec \
sh -c "
echo \"@import url('purpleish.min.css');\" > /app/public/3rd/tmp && \
echo \"@import url('visibility.min.css');\" >> /app/public/3rd/tmp && \
echo \"@import url('mobile.min.css');\" >> /app/public/3rd/tmp && \
cat /app/public/3rd/semantic*.css >> /app/public/3rd/tmp && \
mv /app/public/3rd/tmp /app/public/3rd/semantic-*.min.css
"

Backups

Database

Database backups should be done either by file-copying when the database is not in use, i.e. as long as ktistec is not running, or better yet with the .backup command, which handles file-locking and changes to the database during the backup procedure. However, either way, because .backup also honours file locking by the ktistec process itself and because changes to the database are constantly accounted for (which, depending on your instances volume, can prolonge the backup process indefinitely), ktistec should not be running during backup process.

Manual installation:

KTISTEC_PATH="/var/www/ktistec"
kill server && \
sqlite3 ${KTISTEC_PATH}/db/ktistec.db \
".backup \"${KTISTEC_PATH}/db/ktistec_backup_$(date +%Y-%m-%d).sq3\""; \
${KTISTEC_PATH}/server &

Docker (via this repo’s docker-compose file):

docker stop ktistec && \
docker run -ti --rm \
-v /var/www/ktistec/db:/db \
-v /var/www/ktistec/backups:/backups \
alpine:latest \
sh -c '
apk update && \
apk add sqlite && \
sqlite3 /db/ktistec.db \
".backup \"/backups/ktistec_backup_$(date +%Y-%m-%d).sq3\""
'; \
docker restart ktistec

Uploads

The uploads-folder contains images and other media files that you uploaded or included in one of your posts. It makes sense to back them up as well in order to prevent data loss.

Since these are typically just image files, the easiest way to back them up is by archiving them with tar.

Manual installation:

KTISTEC_PATH="/var/www/ktistec"
tar -cf ${KTISTEC_PATH}/uploads_backup_$(date +%Y-%m-%d).tar \
${KTISTEC_PATH}/public/uploads/

Docker (via this repo’s docker-compose file):

docker run -ti --rm \
-v /var/www/ktistec/uploads:/uploads \
-v /var/www/ktistec/backups:/backups \
alpine:latest \
sh -c '
apk update && \
apk add tar && \
tar -vcf /backups/uploads_backup_$(date +%Y-%m-%d).tar /uploads/
'

Clone this repository via:
git clone https://src.jayvii.de/pub/ktistec-tweaks.git