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 # Can be easy, medium, or hard
difficulty: "medium" 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 sending configuration. All options except login/password are mandatory
email: { email: {
# Hostname and port of the smtp server # Hostname and port of the smtp server
@ -87,9 +95,6 @@
port: __PORT__ port: __PORT__
# Whether the site is available over TLS. Needs to be true for federation to work. # Whether the site is available over TLS. Needs to be true for federation to work.
tls_enabled: true 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 # Maximum length of local community and user names
actor_name_max_length: 20 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). # 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__ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=__INSTALL_DIR__/pict-rs/ 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 StandardOutput=append:/var/log/__APP__/__APP__-pict-rs.log
StandardError=inherit StandardError=inherit

View file

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

View file

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

View file

@ -89,6 +89,12 @@ chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R $app:$app "$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 # 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 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 # Create a dedicated systemd config
ynh_add_systemd_config --service="$app" --template="lemmy.service" ynh_add_systemd_config --service="$app" --template="lemmy.service"
ynh_add_systemd_config --service="$app-ui" --template="lemmy-ui.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" 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" 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 fi
chmod 750 "$install_dir" 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 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 # Create a dedicated systemd config
ynh_add_systemd_config --service="$app" --template="lemmy.service" ynh_add_systemd_config --service="$app" --template="lemmy.service"
ynh_add_systemd_config --service="$app-ui" --template="lemmy-ui.service" ynh_add_systemd_config --service="$app-ui" --template="lemmy-ui.service"