new posts (from drafts)

main
Dominic Reich 2 years ago
parent ffb6c19c33
commit fa1b2556a9
Signed by: dominic
GPG Key ID: BC9D6AE1A3BE169A

@ -1,10 +1,9 @@
+++ +++
title = '''Gitea Updates: quick'n'dirty''' title = '''Gitea Updates: quick'n'dirty'''
summary = 'After a lot of lookups, a quick reminder in copy&paste mode for me.' summary = 'After a lot of lookups, a quick reminder in copy&paste mode for me.'
date = '2023-03-12T07:34:46+0100' date = '2023-04-09T17:07:01+0200'
categories = [ 'computerstuff' ] categories = [ 'computerstuff' ]
tags = [ 'linux', 'reminders' ] tags = [ 'server', 'linux', 'git', 'selfhost' ]
draft = true
+++ +++
@ -88,4 +87,6 @@ I usually download to my root's home folder.
# systemctl restart gitea # systemctl restart gitea
``` ```
That's it. That's it. I won't need this again but I like to keep this information
somewhere I can find it ;-)

@ -1,18 +1,20 @@
+++ +++
title = 'Mastodon snippets' title = 'Mastodon snippets'
summary = 'snip snip' date = '2023-04-09T15:58:46+0200'
date = '2023-03-05T12:39:35+0100' summary = 'Some "nice to have" snippets for maintaining a mastodon server'
categories = [ 'computerstuff' ] categories = [ 'computerstuff' ]
tags = ['mastodon','server','linux','reminders'] tags = [ 'mastodon', 'server', 'linux', 'selfhost' ]
draft = true
+++ +++
Very short und maybe a bit chaotic... Very short und maybe a bit chaotic...
## clear media files There are some [style patches](https://codeberg.org/dominic/mastodon-styles)
available for plain mastodon for those that would want to have a look at them.
https://paste.opensuse.org/pastes/365542654a1e ## Clear media files
<https://paste.opensuse.org/pastes/365542654a1e>
```bash ```bash
@ -33,9 +35,9 @@ exec > /home/mastodon/live/log/prune.log 2>&1
date date
``` ```
## further removal of profile pics ## Further removal of profile pics
https://paste.opensuse.org/pastes/4ecbf69cdee7 <https://paste.opensuse.org/pastes/4ecbf69cdee7>
```bash ```bash
#!/usr/bin/env bash #!/usr/bin/env bash
@ -49,18 +51,21 @@ cd /home/mastodon/live/public/system/cache/accounts
find -name '*.png' -print0 | xargs -0 pngquant --verbose --ext=.png --force --speed 10 --quality 45-50 --skip-if-larger find -name '*.png' -print0 | xargs -0 pngquant --verbose --ext=.png --force --speed 10 --quality 45-50 --skip-if-larger
``` ```
## moar stuff in RAILS_ENV cnosole ## More snippets for use in the rails console
_Some or almost all of the following text is copy&paste'd from [this issue]
at Github._
https://github.com/mastodon/mastodon/issues/14681 [this issue]: https://github.com/mastodon/mastodon/issues/14681
There are several scripts executable with `RAILS_ENV=production bundle exec rails c`, There are several scripts executable with `RAILS_ENV=production bundle exec rails c`,
for convenience laid out here with minor corrections. **Do not execute these for convenience laid out here with minor corrections. **Do not execute these
without understanding what they do!**: without understanding what they do!**:
Deleting all cached media attachments from external servers to allow web app Deleting all cached media attachments from external servers to allow web app
to refetch them when they are queried. At least on my instance this is reaaally to re-fetch them when they are queried. At least on my instance this is really
slow, takes tens of seconds per attachment (is this the same as tootctl media slow, takes tens of seconds per attachment (is this the same as `tootctl media
remove?): remove`?):
```ruby ```ruby
MediaAttachment.cached.where.not(remote_url: '').each do |attachment| MediaAttachment.cached.where.not(remote_url: '').each do |attachment|
@ -70,12 +75,12 @@ MediaAttachment.cached.where.not(remote_url: '').each do |attachment|
end end
``` ```
Deleting and redownloading all cached remote emojis. This apparently has a Deleting and re-downloading all cached remote emojis. This apparently has a
problem that the local URLs for the cached emojis change, and the URLs aren't problem that the local URLs for the cached emojis change, and the URLs aren't
updated to the fetched profile headers. I suppose this should be done before updated to the fetched profile headers. I suppose this should be done before
the next steps, assuming the cached local emoji URLs are set up correctly to the next steps, assuming the cached local emoji URLs are set up correctly to
the profile headers and names at the time of fetching. This doesn't seem to the profile headers and names at the time of fetching. This doesn't seem to
work though, maybe tootctl emoji purge --remote-only would be better: work though, maybe `tootctl emoji purge --remote-only` would be better:
```ruby ```ruby
CustomEmoji.remote.where.not(image_file_name: nil).where.not(image_remote_url: '').each do |emoji| CustomEmoji.remote.where.not(image_file_name: nil).where.not(image_remote_url: '').each do |emoji|
@ -85,8 +90,8 @@ CustomEmoji.remote.where.not(image_file_name: nil).where.not(image_remote_url: '
end end
``` ```
Deleting all remote profile avatars, and refetching them. Are these two the Deleting all remote profile avatars, and re-fetching them. Are these two the
same as tootctl accounts refresh --all?: same as `tootctl accounts refresh --all`?:
```ruby ```ruby
Account.remote.where.not(avatar_file_name: nil).where.not(avatar_remote_url: '').each do |a| Account.remote.where.not(avatar_file_name: nil).where.not(avatar_remote_url: '').each do |a|
@ -96,7 +101,7 @@ Account.remote.where.not(avatar_file_name: nil).where.not(avatar_remote_url: '')
end end
``` ```
Deleting all remote profile headers, and refetching them. Hopefully this Deleting all remote profile headers, and re-fetching them. Hopefully this
uses/updates the newly fetched local cached emoji URLs, and also includes the uses/updates the newly fetched local cached emoji URLs, and also includes the
profile name as they often contain emojis: profile name as they often contain emojis:
@ -108,8 +113,8 @@ Account.remote.where.not(header_file_name: nil).where.not(header_remote_url: '')
end end
``` ```
It would be awesome to get tooling for these to tootctl. That said, I'm not It would be awesome to get tooling for these to `tootctl`. That said, I'm not
entirely sure if destroying the entities is necessary before downloading them entirely sure if destroying the entities is necessary before downloading them
again, and perhaps we could use remove_entity_cache instead. I'm not very well again, and perhaps we could use `remove_entity_cache` instead. I'm not very well
acquainted with the codebase. acquainted with the codebase.
Loading…
Cancel
Save