On my instance metapixl.com the alt text for post was cut of after 191 characters. 191 chars is a hint that the colum type is set to varchar(191) whis is obviouly wrong if you want to store more than 191 chars inside it. Pixelfed stores the alt text to a posted picture in a colum named caption you can check the colums and types inside the mariadb interface.

MariaDB [pixelfed]> use pixelfed;
Database changed
MariaDB [pixelfed]> SHOW COLUMNS FROM media;
+-------------------+---------------------+------+-----+---------+----------------+
| Field             | Type                | Null | Key | Default | Extra          |
+-------------------+---------------------+------+-----+---------+----------------+
| id                | int(10) unsigned    | NO   | PRI | NULL    | auto_increment |
| status_id         | bigint(20) unsigned | YES  | MUL | NULL    |                |
| profile_id        | bigint(20) unsigned | YES  | MUL | NULL    |                |
| user_id           | bigint(20) unsigned | YES  | MUL | NULL    |                |
| is_nsfw           | tinyint(1)          | NO   |     | 0       |                |
| remote_media      | tinyint(1)          | NO   | MUL | 0       |                |
| original_sha256   | varchar(191)        | YES  | MUL | NULL    |                |
| optimized_sha256  | varchar(191)        | YES  | MUL | NULL    |                |
| media_path        | varchar(191)        | NO   |     | NULL    |                |
| thumbnail_path    | varchar(191)        | YES  |     | NULL    |                |
| cdn_url           | text                | YES  |     | NULL    |                |
| optimized_url     | varchar(191)        | YES  |     | NULL    |                |
| thumbnail_url     | varchar(191)        | YES  |     | NULL    |                |
| remote_url        | varchar(191)        | YES  |     | NULL    |                |
| caption           | varchar(191)        | YES  |     | NULL    |                |
| hls_path          | varchar(191)        | YES  |     | NULL    |                |
| order             | tinyint(3) unsigned | NO   |     | 1       |                |
| mime              | varchar(191)        | YES  | MUL | NULL    |                |
| size              | int(10) unsigned    | YES  |     | NULL    |                |
| orientation       | varchar(191)        | YES  |     | NULL    |                |
| filter_name       | varchar(191)        | YES  |     | NULL    |                |
| filter_class      | varchar(191)        | YES  |     | NULL    |                |
| license           | varchar(191)        | YES  | MUL | NULL    |                |
| processed_at      | timestamp           | YES  |     | NULL    |                |
| hls_transcoded_at | timestamp           | YES  |     | NULL    |                |
| created_at        | timestamp           | YES  |     | NULL    |                |
| updated_at        | timestamp           | YES  |     | NULL    |                |
| deleted_at        | timestamp           | YES  | MUL | NULL    |                |
| key               | varchar(191)        | YES  |     | NULL    |                |
| metadata          | longtext            | YES  |     | NULL    |                |
| version           | tinyint(4)          | NO   | MUL | 1       |                |
| blurhash          | varchar(191)        | YES  |     | NULL    |                |
| srcset            | longtext            | YES  |     | NULL    |                |
| width             | int(10) unsigned    | YES  |     | NULL    |                |
| height            | int(10) unsigned    | YES  |     | NULL    |                |
| skip_optimize     | tinyint(1)          | YES  | MUL | NULL    |                |
| replicated_at     | timestamp           | YES  | MUL | NULL    |                |
+-------------------+---------------------+------+-----+---------+----------------+
37 rows in set (0.001 sec)

As you can see the type is set to varchar(191) so I changed it to text as it should be

MariaDB [pixelfed]> ALTER TABLE media MODIFY caption text;
Query OK, 1996326 rows affected (1 min 0.749 sec)      
Records: 1996326  Duplicates: 0  Warnings: 0

MariaDB [pixelfed]> SHOW COLUMNS FROM media;
+-------------------+---------------------+------+-----+---------+----------------+
| Field             | Type                | Null | Key | Default | Extra          |
+-------------------+---------------------+------+-----+---------+----------------+
| id                | int(10) unsigned    | NO   | PRI | NULL    | auto_increment |
| status_id         | bigint(20) unsigned | YES  | MUL | NULL    |                |
| profile_id        | bigint(20) unsigned | YES  | MUL | NULL    |                |
| user_id           | bigint(20) unsigned | YES  | MUL | NULL    |                |
| is_nsfw           | tinyint(1)          | NO   |     | 0       |                |
| remote_media      | tinyint(1)          | NO   | MUL | 0       |                |
| original_sha256   | varchar(191)        | YES  | MUL | NULL    |                |
| optimized_sha256  | varchar(191)        | YES  | MUL | NULL    |                |
| media_path        | varchar(191)        | NO   |     | NULL    |                |
| thumbnail_path    | varchar(191)        | YES  |     | NULL    |                |
| cdn_url           | text                | YES  |     | NULL    |                |
| optimized_url     | varchar(191)        | YES  |     | NULL    |                |
| thumbnail_url     | varchar(191)        | YES  |     | NULL    |                |
| remote_url        | varchar(191)        | YES  |     | NULL    |                |
| caption           | text                | YES  |     | NULL    |                |
| hls_path          | varchar(191)        | YES  |     | NULL    |                |
| order             | tinyint(3) unsigned | NO   |     | 1       |                |
| mime              | varchar(191)        | YES  | MUL | NULL    |                |
| size              | int(10) unsigned    | YES  |     | NULL    |                |
| orientation       | varchar(191)        | YES  |     | NULL    |                |
| filter_name       | varchar(191)        | YES  |     | NULL    |                |
| filter_class      | varchar(191)        | YES  |     | NULL    |                |
| license           | varchar(191)        | YES  | MUL | NULL    |                |
| processed_at      | timestamp           | YES  |     | NULL    |                |
| hls_transcoded_at | timestamp           | YES  |     | NULL    |                |
| created_at        | timestamp           | YES  |     | NULL    |                |
| updated_at        | timestamp           | YES  |     | NULL    |                |
| deleted_at        | timestamp           | YES  | MUL | NULL    |                |
| key               | varchar(191)        | YES  |     | NULL    |                |
| metadata          | longtext            | YES  |     | NULL    |                |
| version           | tinyint(4)          | NO   | MUL | 1       |                |
| blurhash          | varchar(191)        | YES  |     | NULL    |                |
| srcset            | longtext            | YES  |     | NULL    |                |
| width             | int(10) unsigned    | YES  |     | NULL    |                |
| height            | int(10) unsigned    | YES  |     | NULL    |                |
| skip_optimize     | tinyint(1)          | YES  | MUL | NULL    |                |
| replicated_at     | timestamp           | YES  | MUL | NULL    |                |
+-------------------+---------------------+------+-----+---------+----------------+
37 rows in set (0.001 sec)

As you can see, the type is converted from varchar(191) to text and it’s now possible to post pictures with alt text wirth max 2000 characters (again).

Never do those things without an actual backup!

media:cloud-url-rewrite

This is a command to update S3 media urls in the database, useful for when you migrate S3 buckets or want to add a proxy in front of your S3 media.

Usage:

Run php artisan media:cloud-url-rewrite and enter the old and new S3 domains when prompted, or you can provide them as arguments like

php artisan media:cloud-url-rewrite old.pixelfed.example.org new.pixelfed.example.org

Notes:

Before you can update S3 media urls, you have to configure the new bucket and then re-cache configuration

php artisan config:cache && php artisan cache:clear

before you run this command You need to run

php artisan cache:clear

after the command is run to purge old S3 media urls from your cache


Disable two factor authentication for given username:

php artisan user:2fa {username}

Cleanup avatar storage:

php artisan avatar:storage-deep-clean

Make a user an admin, or remove admin privileges:

php artisan user:admin {username}

Create an invite link:

php artisan admin:invite

Fix Like counts:

php artisan fix:likes

Delete (local) media uploads that exist on S3:

php artisan media:s3gc {--limit=200} {--huge} {--log-errors}

Delete media uploads not attached to any active statuses:

php artisan media:gc

Delete password reset tokens over 24 hours old:

php artisan gc:passwordreset

Create a new user:

php artisan user:create {--name=} {--username=} {--email=} {--password=} {--is_admin=0} {--confirm_email=0

Delete account:

php artisan user:delete {id} {--force}

Ad S3 storage block to Pixelfed .env file

## S3 Configuration (Post-Installer)
PF_ENABLE_CLOUD=true
FILESYSTEM_DRIVER=local
FILESYSTEM_CLOUD=s3
AWS_ACCESS_KEY_ID=[KEY_ID]
AWS_SECRET_ACCESS_KEY=[KEY_SECRET]
AWS_DEFAULT_REGION=[REGION]
AWS_BUCKET=metapixl-media
AWS_ENDPOINT=[URL_TO_S3_STORAGE]
AWS_USE_PATH_STYLE_ENDPOINT=true

Enable Cloud storage in admin dashboard

Run this command to migrate media to S3 storage

php artisan media:migrate2cloud

Move avatar storage to S3 with this command

php artisan avatar:storage

Check Nodes

kubectl get nodes
➜  ~ kubectl get nodes                                              
NAME      STATUS   ROLES                  AGE    VERSION
master1   Ready    control-plane,master   517d   v1.21.5
master2   Ready    control-plane,master   517d   v1.21.5
master3   Ready    control-plane,master   517d   v1.21.5
worker1   Ready    worker                 517d   v1.21.5
worker2   Ready    worker                 517d   v1.21.5
worker3   Ready    worker                 517d   v1.21.5

Cordon the node

kubectl cordon [NODENAME]

Drain the node

kubectl drain [NODENAME] --ignore-daemonsets --force --delete-local-data

Uncordon the node

kubectl uncordon [NODENAME]

Let’s say you have a given directory with possible configurations and you want to create a environment file for your laravel app. Within this directory are several .php files containing things like this:

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Application Name
    |--------------------------------------------------------------------------
    |
    | This value is the name of your application. This value is used when the
    | framework needs to place the application's name in a notification or
    | any other location as required by the application or its packages.
    |
    */

    'name' => env('APP_NAME', 'Laravel app'),

    /*
    |--------------------------------------------------------------------------
    | Application Environment
    |--------------------------------------------------------------------------
    |
    | This value determines the "environment" your application is currently
    | running in. This may determine how you prefer to configure various
    | services your application utilizes. Set this in your ".env" file.
    |
    */

    'env' => env('APP_ENV', 'production'),

A proper environment file would look like this:

APP_NAME=Laravel App
APP_ENV=production

We have to grep through all .php files, search for only UPPER_CASE strings and write them into a new file called ‘environment’:

% grep -oP '\b[A-Z_]*[A-Z]+[A-Z_]*\b' *.php
app.php:APP_NAME
app.php:APP_ENV

Which is fine if you want to start from scratch or want to build a example file with a lot of comments. As you can see, every line contains the source file. Turn this off with ‘-h’

% grep -h -oP '\b[A-Z_]*[A-Z]+[A-Z_]*\b' *.php
APP_NAME
APP_ENV