README.md (4617B)
1 # ktistec tweaks
2
3 Small tweaks and hacks for [ktistec](https://github.com/toddsundsted/ktistec).
4
5 Please send patches or remarks to
6 [jayvii+ktistec-tweaks[AT]posteo[DOT]de](mailto:jayvii+ktistec-tweaks[AT]posteo[DOT]de).
7
8 ---
9
10 ## Docker
11
12 You can run ktistec via the provided
13 [`docker-compose`](https://docs.docker.com/compose/)
14
15 ```bash
16 cd docker/
17 docker-compose -f docker-compose.yaml up -d
18 ```
19
20 In order to use
21 [machine generated translations](https://github.com/toddsundsted/ktistec/?tab=readme-ov-file#configuring-translation),
22 you can set the `DEEPL_API_KEY` or the `LIBRETRANSLATE_API_KEY` environment
23 variables while starting up the container:
24
25 ```bash
26 cd docker/
27 LIBRETRANSLATE_API_KEY="abcd" docker-compose -f docker-compose.yaml up -d
28 ```
29
30 ---
31
32 ## CSS
33
34 Some of previous CSS hacks have found their way into upstream ktistec by now,
35 for example:
36
37 - [Improvements for mobile devices](https://github.com/toddsundsted/ktistec/commit/35d9476b8f5b458056e660247ed4ed3b4e8f76e4)
38 - [The idea for a general Dark Mode](https://github.com/toddsundsted/ktistec/commit/99fe9ac72b0910c369153cb350e9ba86bf576671)
39
40 Currently, the `./css/` directory contains following theming tweaks:
41
42 - [purple-ish](#purple-ish-theme): a modern theme with automatic dark/bright
43 mode and purple highlights
44 - [visibility](#visibility): small adjustments to improve visibility of content
45 in the sense of accessibility
46
47 ### Purple-Ish Theme:
48
49 
50
51 ### Visibility:
52
53 
54
55 
56
57 The *Visibility* CSS rules also mark all external URLs with an arrow-icon.
58
59 **Minify CSS:**
60
61 ```bash
62 make minify-css
63 ```
64
65 Place the minified `purpleish.min.css`, and/or `visibility.min.css` in the
66 `public/theming/` directory.
67
68 **Manual installation:**
69
70 ```bash
71 KTISTEC_PATH="/var/www/ktistec"
72 KTISTEC_CSS="${KTISTEC_PATH}/public/theming"
73 cp ./css/*.min.css ${KTISTEC_CSS}/
74 ```
75
76 **Docker (via [this repo's docker-compose](#docker) file):**
77
78 ```bash
79 docker cp ./css/purpleish.min.css ktistec:/app/public/theming/purpleish.min.css
80 docker cp ./css/visibility.min.css ktistec:/app/public/theming/visibility.min.css
81 ```
82
83 ## Backups
84
85 ### Database
86
87 Database backups should be done either by file-copying **when the database is
88 not in use**, i.e. as long as ktistec is not running, or better yet with the
89 [`.backup`](https://sqlite.org/cli.html#special_commands_to_sqlite3_dot_commands_)
90 command, which handles file-locking and changes to the database during the
91 backup procedure. However, either way, because `.backup` also honours file
92 locking by the ktistec process itself and because changes to the database
93 are constantly accounted for (which, depending on your instances volume, can
94 prolonge the backup process indefinitely), ktistec should not be running during
95 backup process.
96
97 **Manual installation:**
98
99 ```bash
100 KTISTEC_PATH="/var/www/ktistec"
101 kill server && \
102 sqlite3 ${KTISTEC_PATH}/db/ktistec.db \
103 ".backup \"${KTISTEC_PATH}/db/ktistec_backup_$(date +%Y-%m-%d).sq3\""; \
104 ${KTISTEC_PATH}/server &
105 ```
106
107 **Docker (via [this repo's docker-compose](#docker) file):**
108
109 ```bash
110 docker stop ktistec && \
111 docker run -ti --rm \
112 -v /var/www/ktistec/db:/db \
113 -v /var/www/ktistec/backups:/backups \
114 alpine:latest \
115 sh -c '
116 apk update && \
117 apk add sqlite && \
118 sqlite3 /db/ktistec.db \
119 ".backup \"/backups/ktistec_backup_$(date +%Y-%m-%d).sq3\""
120 '; \
121 docker restart ktistec
122 ```
123
124 ### Uploads
125
126 The uploads-folder contains images and other media files that you uploaded or
127 included in one of your posts. It makes sense to back them up as well in order
128 to prevent data loss.
129
130 Since these are typically just image files, the easiest way to back them up is
131 by archiving them with `tar`.
132
133 **Manual installation:**
134
135 ```bash
136 KTISTEC_PATH="/var/www/ktistec"
137 tar -cf ${KTISTEC_PATH}/uploads_backup_$(date +%Y-%m-%d).tar \
138 ${KTISTEC_PATH}/public/uploads/
139 ```
140
141 **Docker (via [this repo's docker-compose](#docker) file):**
142
143 ```bash
144 docker run -ti --rm \
145 -v /var/www/ktistec/uploads:/uploads \
146 -v /var/www/ktistec/backups:/backups \
147 alpine:latest \
148 sh -c '
149 apk update && \
150 apk add tar && \
151 tar -vcf /backups/uploads_backup_$(date +%Y-%m-%d).tar /uploads/
152 '
153 ```