Initial commit
This commit is contained in:
153
etc/app/config.yml.dist
Normal file
153
etc/app/config.yml.dist
Normal file
@@ -0,0 +1,153 @@
|
||||
homeserver:
|
||||
# The canonical homeserver domain name
|
||||
server_name: synapse.127.0.0.1.nip.io
|
||||
url: http://synapse.127.0.0.1.nip.io:42020
|
||||
|
||||
user:
|
||||
mxid_localpart: baibot
|
||||
password: baibot
|
||||
|
||||
# The name the bot uses as a display name and when it refers to itself.
|
||||
# Leave empty to use the default (baibot).
|
||||
name: baibot
|
||||
|
||||
encryption:
|
||||
# An optional passphrase to use for backing up and recovering the bot's encryption keys.
|
||||
# You can use any string here.
|
||||
#
|
||||
# If set to null, the recovery module will not be used and losing your session/database (see persistence)
|
||||
# will mean you lose access to old messages in encrypted room.
|
||||
#
|
||||
# Changing this subsequently will also cause you to lose access to old messages in encrypted rooms.
|
||||
# If you really need to change this:
|
||||
# - Set `encryption_recovery_reset_allowed` to `true` and adjust the passphrase
|
||||
# - Remove your session file and database (see persistence)
|
||||
# - Restart the bot
|
||||
# - Then restore `encryption_recovery_reset_allowed` to `false` to prevent accidental resets in the future
|
||||
recovery_passphrase: long-and-secure-passphrase-here
|
||||
|
||||
# An optional flag to reset the encryption recovery passphrase.
|
||||
recovery_reset_allowed: false
|
||||
|
||||
# Command prefix. Leave empty to use the default (!bai).
|
||||
command_prefix: "!bai"
|
||||
|
||||
access:
|
||||
# Space-separated list of MXID patterns which specify who is an admin.
|
||||
admin_patterns:
|
||||
- "@admin:synapse.127.0.0.1.nip.io"
|
||||
|
||||
persistence:
|
||||
# This is unset here, because we expect the configuration to come from an environment variable (BAIBOT_PERSISTENCE_DATA_DIR_PATH).
|
||||
# In your setup, you may wish to set this to a directory path.
|
||||
data_dir_path: null
|
||||
|
||||
# An optional secret for encrypting the bot's session data (stored in data_dir_path).
|
||||
# This must be 32-bytes (64 characters when HEX-encoded).
|
||||
# Generate it with: `openssl rand -hex 32`
|
||||
# Leave null or empty to avoid using encryption.
|
||||
# Changing this subsequently requires that you also throw away all data stored in data_dir_path.
|
||||
session_encryption_key: 9701cd109ed56770687dd8410f7d7371a4390dd3feb8ed721f189a0756c40098
|
||||
|
||||
# An optional secret for encrypting bot configuration stored in Matrix's account data.
|
||||
# This must be 32-bytes (64 characters when HEX-encoded).
|
||||
# Generate it with: `openssl rand -hex 32`
|
||||
# Leave null or empty to avoid using encryption.
|
||||
# Changing this subsequently will make you lose your configuration.
|
||||
config_encryption_key: a9f1df98d288802ead20a8be2c701a627eabd31cf3d9e2aea28867ccd7a4ded7
|
||||
|
||||
agents:
|
||||
# A list of statically-defined agents.
|
||||
#
|
||||
# Below are a few common choices on popular providers, preconfigured for development purposes (see docs/development.md).
|
||||
# You may enable some of the ones you see below or define others.
|
||||
# You can also leave this list empty and only define agents dynamically (via chat).
|
||||
#
|
||||
# Uncomment one or more of these and potentially adjust their configuration (API key, etc).
|
||||
# Consider setting `initial_global_config.handler.*` to an agent that you enable here.
|
||||
static_definitions:
|
||||
# - id: openai
|
||||
# provider: openai
|
||||
# config:
|
||||
# base_url: https://api.openai.com/v1
|
||||
# api_key: ""
|
||||
# text_generation:
|
||||
# model_id: gpt-4o-2024-08-06
|
||||
# prompt: You are a brief, but helpful bot.
|
||||
# temperature: 1.0
|
||||
# max_response_tokens: 16384
|
||||
# max_context_tokens: 128000
|
||||
# speech_to_text:
|
||||
# model_id: whisper-1
|
||||
# text_to_speech:
|
||||
# model_id: tts-1-hd
|
||||
# voice: onyx
|
||||
# speed: 1.0
|
||||
# response_format: opus
|
||||
# image_generation:
|
||||
# model_id: dall-e-3
|
||||
# style: vivid
|
||||
# size: 1024x1024
|
||||
# quality: standard
|
||||
#
|
||||
# - id: localai
|
||||
# provider: localai
|
||||
# config:
|
||||
# base_url: http://127.0.0.1:42027/v1
|
||||
# api_key: null
|
||||
# text_generation:
|
||||
# model_id: gpt-4
|
||||
# prompt: You are a brief, but helpful bot.
|
||||
# temperature: 1.0
|
||||
# max_response_tokens: 16384
|
||||
# max_context_tokens: 128000
|
||||
# speech_to_text:
|
||||
# model_id: whisper-1
|
||||
# text_to_speech:
|
||||
# model_id: tts-1
|
||||
# voice: onyx
|
||||
# speed: 1.0
|
||||
# response_format: opus
|
||||
# image_generation:
|
||||
# model_id: stablediffusion
|
||||
# style: vivid
|
||||
# # Intentionally defaults to a small value to improve performance
|
||||
# size: 256x256
|
||||
# quality: standard
|
||||
#
|
||||
# - id: ollama
|
||||
# provider: ollama
|
||||
# config:
|
||||
# base_url: "http://127.0.0.1:42026/v1"
|
||||
# api_key: null
|
||||
# text_generation:
|
||||
# model_id: "gemma2:2b"
|
||||
# prompt: "You are an assistant based on the gemma2:2b model. Be brief in your responses."
|
||||
# temperature: 1.0
|
||||
# max_response_tokens: 4096
|
||||
# max_context_tokens: 128000
|
||||
|
||||
# Initial global configuration. This only affects the first run of the bot.
|
||||
# Configuration is later managed at runtime.
|
||||
initial_global_config:
|
||||
handler:
|
||||
catch_all: null
|
||||
text_generation: null
|
||||
text_to_speech: null
|
||||
speech_to_text: null
|
||||
image_generation: null
|
||||
|
||||
# Space-separated list of MXID patterns which specify who can use the bot.
|
||||
# By default, we let anyone on the homeserver use the bot.
|
||||
user_patterns:
|
||||
- "@*:synapse.127.0.0.1.nip.io"
|
||||
|
||||
# Controls logging.
|
||||
#
|
||||
# Sets all tracing targets (external crates) to warn, and our own logs to debug.
|
||||
# For even more verbose logging, one may also use trace.
|
||||
#
|
||||
# matrix_sdk_crypto may be chatty and could be added with an error level.
|
||||
#
|
||||
# Learn more here: https://stackoverflow.com/a/73735203
|
||||
logging: warn,mxlink=debug,baibot=debug
|
||||
BIN
etc/assets/baibot-torso-768.png
Normal file
BIN
etc/assets/baibot-torso-768.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 77 KiB |
351
etc/assets/baibot-torso.svg
Normal file
351
etc/assets/baibot-torso.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 67 KiB |
BIN
etc/assets/baibot.png
Normal file
BIN
etc/assets/baibot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 87 KiB |
568
etc/assets/baibot.svg
Normal file
568
etc/assets/baibot.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 118 KiB |
BIN
etc/assets/baibot.xcf
Normal file
BIN
etc/assets/baibot.xcf
Normal file
Binary file not shown.
41
etc/services/core/compose.yml
Normal file
41
etc/services/core/compose.yml
Normal file
@@ -0,0 +1,41 @@
|
||||
services:
|
||||
postgres:
|
||||
image: docker.io/postgres:16.3-alpine
|
||||
user: ${UID}:${GID}
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: synapse
|
||||
POSTGRES_PASSWORD: synapse-password
|
||||
POSTGRES_DB: homeserver
|
||||
POSTGRES_INITDB_ARGS: --lc-collate C --lc-ctype C --encoding UTF8
|
||||
volumes:
|
||||
- ./postgres:/var/lib/postgresql/data
|
||||
- /etc/passwd:/etc/passwd:ro
|
||||
|
||||
synapse:
|
||||
image: ghcr.io/element-hq/synapse:v1.114.0
|
||||
user: "${UID}:${GID}"
|
||||
restart: unless-stopped
|
||||
entrypoint: python
|
||||
command: "-m synapse.app.homeserver -c /config/homeserver.yaml"
|
||||
ports:
|
||||
- "${SERVICE_SYNAPSE_BIND_PORT_CLIENT_API}:8008"
|
||||
- "${SERVICE_SYNAPSE_BIND_PORT_FEDERATION_API}:8008"
|
||||
volumes:
|
||||
- ../../etc/services/core/synapse/config:/config:ro
|
||||
- ./synapse/media-store:/media-store
|
||||
|
||||
element-web:
|
||||
image: docker.io/vectorim/element-web:v1.11.77
|
||||
user: "${UID}:${GID}"
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${SERVICE_ELEMENT_WEB_BIND_PORT_HTTP}:8080"
|
||||
volumes:
|
||||
- ../../etc/services/core/element-web/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
- ../../etc/services/core/element-web/config.json:/app/config.json:ro
|
||||
|
||||
networks:
|
||||
default:
|
||||
name: ${NETWORK_NAME}
|
||||
external: true
|
||||
13
etc/services/core/element-web/config.json
Normal file
13
etc/services/core/element-web/config.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"default_hs_url": "http://synapse.127.0.0.1.nip.io:42020",
|
||||
"default_is_url": "https://vector.im",
|
||||
"integrations_ui_url": "https://scalar.vector.im/",
|
||||
"integrations_rest_url": "https://scalar.vector.im/api",
|
||||
"bug_report_endpoint_url": "https://riot.im/bugreports/submit",
|
||||
"enableLabs": true,
|
||||
"roomDirectory": {
|
||||
"servers": [
|
||||
"matrix.org"
|
||||
]
|
||||
}
|
||||
}
|
||||
60
etc/services/core/element-web/nginx.conf
Normal file
60
etc/services/core/element-web/nginx.conf
Normal file
@@ -0,0 +1,60 @@
|
||||
# This is a custom nginx configuration file that we use in the container (instead of the default one),
|
||||
# because it allows us to run nginx with a non-root user.
|
||||
#
|
||||
# For this to work, the default vhost file (`/etc/nginx/conf.d/default.conf`) also needs to be removed.
|
||||
# (mounting `/dev/null` over `/etc/nginx/conf.d/default.conf` works well)
|
||||
#
|
||||
# The following changes have been done compared to a default nginx configuration file:
|
||||
# - default server port is changed (80 -> 8080), so that a non-root user can bind it
|
||||
# - various temp paths are changed to `/tmp`, so that a non-root user can write to them
|
||||
# - the `user` directive was removed, as we don't want nginx to switch users
|
||||
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /tmp/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
client_body_temp_path /tmp/client_body_temp;
|
||||
proxy_temp_path /tmp/proxy_temp;
|
||||
fastcgi_temp_path /tmp/fastcgi_temp;
|
||||
uwsgi_temp_path /tmp/uwsgi_temp;
|
||||
scgi_temp_path /tmp/scgi_temp;
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
server {
|
||||
listen 8080;
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
}
|
||||
}
|
||||
1457
etc/services/core/synapse/config/homeserver.yaml
Normal file
1457
etc/services/core/synapse/config/homeserver.yaml
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,36 @@
|
||||
|
||||
version: 1
|
||||
|
||||
formatters:
|
||||
precise:
|
||||
format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s'
|
||||
|
||||
filters:
|
||||
context:
|
||||
(): synapse.util.logcontext.LoggingContextFilter
|
||||
request: ""
|
||||
|
||||
handlers:
|
||||
console:
|
||||
class: logging.StreamHandler
|
||||
formatter: precise
|
||||
filters: [context]
|
||||
|
||||
loggers:
|
||||
synapse:
|
||||
level: INFO
|
||||
|
||||
shared_secret_authenticator:
|
||||
level: INFO
|
||||
|
||||
rest_auth_provider:
|
||||
level: INFO
|
||||
|
||||
synapse.storage.SQL:
|
||||
# beware: increasing this to DEBUG will make synapse log sensitive
|
||||
# information such as access tokens.
|
||||
level: INFO
|
||||
|
||||
root:
|
||||
level: INFO
|
||||
handlers: [console]
|
||||
@@ -0,0 +1 @@
|
||||
ed25519 a_FEMe JGs8Fk83GHIrVyhBYa/VRUFbU4+Fxtf8iOsJ7CMamcM
|
||||
12
etc/services/env.dist
Normal file
12
etc/services/env.dist
Normal file
@@ -0,0 +1,12 @@
|
||||
SERVICE_SYNAPSE_BIND_PORT_CLIENT_API=127.0.0.1:42020
|
||||
SERVICE_SYNAPSE_BIND_PORT_FEDERATION_API=127.0.0.1:42028
|
||||
|
||||
SERVICE_ELEMENT_WEB_BIND_PORT_HTTP=127.0.0.1:42025
|
||||
|
||||
SERVICE_OLLAMA_BIND_PORT_HTTP=127.0.0.1:42026
|
||||
|
||||
# See https://localai.io/basics/container/#all-in-one-images for the list of available images
|
||||
SERVICE_LOCALAI_IMAGE_NAME=docker.io/localai/localai:latest-aio-cpu
|
||||
SERVICE_LOCALAI_BIND_PORT_HTTP=127.0.0.1:42027
|
||||
|
||||
# Variables below are added later on, dynamically
|
||||
20
etc/services/localai/compose.yml
Normal file
20
etc/services/localai/compose.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
services:
|
||||
localai:
|
||||
image: ${SERVICE_LOCALAI_IMAGE_NAME}
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8080/readyz"]
|
||||
interval: 1m
|
||||
timeout: 20m
|
||||
retries: 5
|
||||
ports:
|
||||
- ${SERVICE_LOCALAI_BIND_PORT_HTTP}:8080
|
||||
environment:
|
||||
- DEBUG=true
|
||||
volumes:
|
||||
- ./localai/models:/build/models:cached
|
||||
|
||||
networks:
|
||||
default:
|
||||
name: ${NETWORK_NAME}
|
||||
external: true
|
||||
13
etc/services/ollama/compose.yml
Normal file
13
etc/services/ollama/compose.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
services:
|
||||
ollama:
|
||||
image: docker.io/ollama/ollama:0.3.9
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${SERVICE_OLLAMA_BIND_PORT_HTTP}:11434"
|
||||
volumes:
|
||||
- ./ollama:/root/.ollama
|
||||
|
||||
networks:
|
||||
default:
|
||||
name: ${NETWORK_NAME}
|
||||
external: true
|
||||
Reference in New Issue
Block a user