README.md (4975B)
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 ### Themes
48
49 #### Simple.CSS
50
51 Theme based on colours from the [Simple.css Framework](https://simplecss.org/)
52
53 
54
55 #### Purple-Ish
56
57 
58
59 ### Common CSS Styles
60
61 #### Cards
62
63 Card Style for posts (see in [Themes](#themes) section above)
64
65 #### Visibility
66
67 
68
69 
70
71 The *Visibility* CSS rules also mark all external URLs with an arrow-icon.
72
73 **Minify CSS:**
74
75 ```bash
76 make minify-css
77 ```
78
79 Place the minified [CSS themes](#themes), and/or `visibility.min.css` and
80 `cards.min.css` in the `public/theming/` directory.
81
82 **Manual installation:**
83
84 ```bash
85 KTISTEC_PATH="/var/www/ktistec"
86 KTISTEC_CSS="${KTISTEC_PATH}/public/theming"
87 cp ./css/*.min.css ${KTISTEC_CSS}/
88 ```
89
90 **Docker (via [this repo's docker-compose](#docker) file):**
91
92 ```bash
93 docker cp ./css/purpleish.min.css ktistec:/app/public/theming/purpleish.min.css
94 docker cp ./css/visibility.min.css ktistec:/app/public/theming/visibility.min.css
95 ```
96
97 ## Backups
98
99 ### Database
100
101 Database backups should be done either by file-copying **when the database is
102 not in use**, i.e. as long as ktistec is not running, or better yet with the
103 [`.backup`](https://sqlite.org/cli.html#special_commands_to_sqlite3_dot_commands_)
104 command, which handles file-locking and changes to the database during the
105 backup procedure. However, either way, because `.backup` also honours file
106 locking by the ktistec process itself and because changes to the database
107 are constantly accounted for (which, depending on your instances volume, can
108 prolonge the backup process indefinitely), ktistec should not be running during
109 backup process.
110
111 **Manual installation:**
112
113 ```bash
114 KTISTEC_PATH="/var/www/ktistec"
115 kill server && \
116 sqlite3 ${KTISTEC_PATH}/db/ktistec.db \
117 ".backup \"${KTISTEC_PATH}/db/ktistec_backup_$(date +%Y-%m-%d).sq3\""; \
118 ${KTISTEC_PATH}/server &
119 ```
120
121 **Docker (via [this repo's docker-compose](#docker) file):**
122
123 ```bash
124 docker stop ktistec && \
125 docker run -ti --rm \
126 -v /var/www/ktistec/db:/db \
127 -v /var/www/ktistec/backups:/backups \
128 alpine:latest \
129 sh -c '
130 apk update && \
131 apk add sqlite && \
132 sqlite3 /db/ktistec.db \
133 ".backup \"/backups/ktistec_backup_$(date +%Y-%m-%d).sq3\""
134 '; \
135 docker restart ktistec
136 ```
137
138 ### Uploads
139
140 The uploads-folder contains images and other media files that you uploaded or
141 included in one of your posts. It makes sense to back them up as well in order
142 to prevent data loss.
143
144 Since these are typically just image files, the easiest way to back them up is
145 by archiving them with `tar`.
146
147 **Manual installation:**
148
149 ```bash
150 KTISTEC_PATH="/var/www/ktistec"
151 tar -cf ${KTISTEC_PATH}/uploads_backup_$(date +%Y-%m-%d).tar \
152 ${KTISTEC_PATH}/public/uploads/
153 ```
154
155 **Docker (via [this repo's docker-compose](#docker) file):**
156
157 ```bash
158 docker run -ti --rm \
159 -v /var/www/ktistec/uploads:/uploads \
160 -v /var/www/ktistec/backups:/backups \
161 alpine:latest \
162 sh -c '
163 apk update && \
164 apk add tar && \
165 tar -vcf /backups/uploads_backup_$(date +%Y-%m-%d).tar /uploads/
166 '
167 ```