1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lemmy_ynh.git synced 2024-09-03 19:36:09 +02:00

Fix Pict-RS config and include ImageMagick

This commit is contained in:
tituspijean 2023-07-29 21:50:44 +02:00
parent 62411c18a9
commit 4ab3b027c8
No known key found for this signature in database
GPG key ID: EF3B0D7CC0A94720
6 changed files with 48 additions and 24 deletions

View file

@ -66,6 +66,14 @@
# Can be easy, medium, or hard
difficulty: "medium"
}
# Settings related to activitypub federation
# Pictrs image server configuration.
pictrs: {
# Address where pictrs is available (for image hosting)
url: "http://127.0.0.1:__PORT_PICTRS__/"
# Set a custom pictrs API key. ( Required for deleting images )
#api_key: "string"
}
# Email sending configuration. All options except login/password are mandatory
email: {
# Hostname and port of the smtp server
@ -87,9 +95,6 @@
port: __PORT__
# Whether the site is available over TLS. Needs to be true for federation to work.
tls_enabled: true
# Address where pictrs is available (for image hosting)
pictrs_url: "http://127.0.0.1:__PORT_PICTRS__/"
slur_filter: "(\bThis\b)|(\bis\b)|(\bsample\b)"
# Maximum length of local community and user names
actor_name_max_length: 20
# Maximum number of HTTP requests allowed to handle a single incoming activity (or a single object fetch through the search).

View file

@ -7,7 +7,8 @@ Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__INSTALL_DIR__/pict-rs/
ExecStart=__INSTALL_DIR__/pict-rs/pict-rs run -a 127.0.0.1:__PORT_PICTRS__ filesystem -p __DATA_DIR__/pictrs-data sled -p __DATA_DIR__/sled
Environment=PATH=__PICTRS_PATH__
ExecStart=__INSTALL_DIR__/pict-rs/pict-rs -c __INSTALL_DIR__/pict-rs/pict-rs.toml run
StandardOutput=append:/var/log/__APP__/__APP__-pict-rs.log
StandardError=inherit

View file

@ -59,7 +59,7 @@ targets = 'warn,tracing_actix_web=info,actix_server=info,actix_web=info'
## Console configuration
[tracing.console]
#[tracing.console]
## Optional: console address
# default: empty
#
@ -87,18 +87,18 @@ targets = 'warn,tracing_actix_web=info,actix_server=info,actix_web=info'
# ```
# $ tokio-console http://localhost:6669
# ```
address = '0.0.0.0:6669'
#address = '0.0.0.0:6669'
## Optional: console buffer capacity
# default: 102400
#
# This is the number of _events_ to buffer, not the number of bytes. In reality, the amount of
# RAM used will be significatnly larger (in bytes) than the buffer capacity (in events)
buffer_capacity = 102400
#buffer_capacity = 102400
## OpenTelemetry configuration
[tracing.opentelemetry]
#[tracing.opentelemetry]
## Optional: url for exporting otlp traces
# default: empty
#
@ -106,24 +106,24 @@ buffer_capacity = 102400
# When set, pict-rs will export OpenTelemetry traces to the provided URL. If the URL is
# inaccessible, this can cause performance degredation in pict-rs, so it is best left unset unless
# you have an OpenTelemetry collector
url = 'http://localhost:4317/'
#url = 'http://localhost:4317/'
## Optional: name to relate OpenTelemetry traces
# default: pict-rs
service_name = 'pict-rs'
#service_name = 'pict-rs'
## Optional: trace level to export
# default: info
#
# Follows the same format as RUST_LOG
targets = 'info'
#targets = 'info'
## Configuration for migrating from pict-rs 0.2
[old_db]
#[old_db]
## Optional: path to old pict-rs directory
# default: /mnt
path = '/mnt'
#path = '/mnt'
## Media Processing Configuration
@ -442,12 +442,12 @@ export_path = "__DATA_DIR__/exports"
## Media storage configuration
[store]
#[store]
## Optional: type of media storage to use
# default: filesystem
#
# available options: filesystem, object_storage
type = 'filesystem'
#type = 'filesystem'
## Required: endpoint at which the object storage exists
# default: empty
@ -464,43 +464,43 @@ type = 'filesystem'
# When false, objects will be fetched from http{s}://{bucket_name}.{endpoint}:{port}/{object}
#
# Set to true when using minio
use_path_style = false
#use_path_style = false
## Required: object storage bucket name
# default: empty
bucket_name = 'pict-rs'
#bucket_name = 'pict-rs'
## Required: object storage region
# default: empty
#
# When using minio, this can be set to `minio`
region = ''
#region = ''
## Required: object storage access key
# default: empty
access_key = ''
#access_key = ''
## Required: object storage secret key
# default: empty
secret_key = ''
#secret_key = ''
## Optional: object storage session token
# default: empty
session_token = ''
#session_token = ''
## Optional: set how long object storage signatures are valid for (in seconds)
# default: 15
#
# This can be useful if your object storage might take a while to process requests. It should not be
# increased more than needed to prevent replay attacks.
signature_expiration = 15
#signature_expiration = 15
## Optional: set how long pict-rs will wait (in seconds) for a response from object storage
# default: 30
#
# This value is the total wait time, and not additional wait time on top of the
# signature_expiration.
client_timeout = 30
#client_timeout = 30
## Filesystem media storage example
# ## Media storage configuration

View file

@ -82,7 +82,7 @@ ram.runtime = "50M"
inbox.protected = true
[resources.apt]
packages = "postgresql espeak"
packages = "postgresql espeak libfuse2"
extras.yarn.repo = "deb https://dl.yarnpkg.com/debian/ stable main"
extras.yarn.key = "https://dl.yarnpkg.com/debian/pubkey.gpg"
extras.yarn.packages = "yarn"

View file

@ -89,6 +89,12 @@ chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir"
# (Dirty) Install ImageMagick
# Requires libfuse2 apt dependency
wget https://imagemagick.org/archive/binaries/magick -o "$install_dir/pict-rs/magick" -q
chmod 750 "$install_dir/pict-rs/magick"
chown $app:$app "$install_dir/pict-rs/magick"
#=================================================
# ADD A CONFIGURATION
#=================================================
@ -110,6 +116,9 @@ chown $app:$app "$install_dir/pict-rs/pict-rs.toml"
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1
# Prep local path for Pict-RS
pictrs_path="$install_dir/pict-rs:$PATH"
# Create a dedicated systemd config
ynh_add_systemd_config --service="$app" --template="lemmy.service"
ynh_add_systemd_config --service="$app-ui" --template="lemmy-ui.service"

View file

@ -128,6 +128,12 @@ then
mv -f "$install_dir/build-pict-rs/output/usr/local/bin/pict-rs" "$install_dir/pict-rs/pict-rs"
ynh_secure_remove --file="$install_dir/build-pict-rs"
# (Dirty) Install ImageMagick
# Requires libfuse2 apt dependency
wget https://imagemagick.org/archive/binaries/magick -o "$install_dir/pict-rs/magick" -q
chmod 750 "$install_dir/pict-rs/magick"
chown $app:$app "$install_dir/pict-rs/magick"
fi
chmod 750 "$install_dir"
@ -162,6 +168,9 @@ ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pgcrypto;" --data
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
# Prep local path for Pict-RS
pictrs_path="$install_dir/pict-rs:$PATH"
# Create a dedicated systemd config
ynh_add_systemd_config --service="$app" --template="lemmy.service"
ynh_add_systemd_config --service="$app-ui" --template="lemmy-ui.service"