1257 字
6 分钟
Sharkey部署
2024-02-05

Sharkey 是一个 Misskey 分叉,在可能的情况下遵循上游变化, 具有附加功能。像任何其他 ActivityPub 软件一样,Sharkey 可以 与构成 Fediverse 的数千台服务器接口,一个 互联的社交网络,与软件协同工作,例如 Akkoma、Mastodon、Pixelfed 等等。

具体差别可见:https://docs.joinsharkey.org/docs/comparison/misskey/

官网的安装文档有些过时了,我仅做备份,留存这篇博文。

创建文件#

下载地址:https://activitypub.software/TransFem-org/Sharkey

需要下载的文件:

  1. docker-compose_example.yml

  2. /.config/docker_example.yml

  3. /.config/docker_example.env

下载完成后,将 docker-compose_example.yml 重命名为 docker-compose.yml

docker_example.yml 重命名为 default.yml

docker_example.env 重命名为 docker.env

内容编辑#

docker-compose.yml(可能有过时,请以官方为准)

取消 image 前的注释,在 build 前添加注释

version: "3"

services:
  web:
    image: registry.activitypub.software/transfem-org/sharkey:latest
#    build: .
    restart: always
    links:
      - db
      - redis
#     - mcaptcha
#     - meilisearch
    depends_on:
      db:
        condition: service_healthy
      redis:
        condition: service_healthy
    ports:
      - "3000:3000"
    networks:
      - shonk
    volumes:
      - ./files:/sharkey/files
      - ./.config:/sharkey/.config:ro

  redis:
    restart: always
    image: redis:7-alpine
    networks:
      - shonk
    volumes:
      - ./redis:/data
    healthcheck:
      test: "redis-cli ping"
      interval: 5s
      retries: 20

  db:
    restart: always
    image: postgres:15-alpine
    networks:
      - shonk
    env_file:
      - .config/docker.env
    volumes:
      - ./db:/var/lib/postgresql/data
    healthcheck:
      test: "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"
      interval: 5s
      retries: 20

#  mcaptcha:
#    restart: always
#    image: mcaptcha/mcaptcha:latest
#    networks:
#      internal_network:
#      external_network:
#        aliases:
#          - localhost
#    ports:
#      - 7493:7493
#    env_file:
#      - .config/docker.env
#    environment:
#      PORT: 7493
#      MCAPTCHA_redis_URL: "redis://mcaptcha_redis/"
#    depends_on:
#      db:
#        condition: service_healthy
#      mcaptcha_redis:
#        condition: service_healthy
#
#  mcaptcha_redis:
#    image: mcaptcha/cache:latest
#    networks:
#      - internal_network
#    healthcheck:
#      test: "redis-cli ping"
#      interval: 5s
#      retries: 20

#  如果需要搜索功能,请取消注释以下内容,和上方links下内容,并修改 MEILI_MASTER_KEY!
#  meilisearch:
#    restart: always
#    image: getmeili/meilisearch:v1.3.4
#    environment:
#      - MEILI_NO_ANALYTICS=true
#      - MEILI_ENV=production
#      - MEILI_MASTER_KEY=ChangeThis
#    networks:
#      - shonk
#    volumes:
#      - ./meili_data:/meili_data


networks:
  shonk:

如果需要搜索功能,请取消注释meilisearch,和上方links下内容,并修改 MEILI_MASTER_KEY(或第一次运行以后,在日志种复制生成的密钥并填入)。

docker.env 修改数据库相关内容

# db settings
POSTGRES_PASSWORD=example-misskey-pass
POSTGRES_USER=example-misskey-user
POSTGRES_DB=misskey
DATABASE_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}"

default.yml

#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# Misskey configuration
#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

#   ┌─────┐
#───┘ URL └─────────────────────────────────────────────────────

# Final accessible URL seen by a user.修改此行!
url: https://example.tld/

# ONCE YOU HAVE STARTED THE INSTANCE, DO NOT CHANGE THE
# URL SETTINGS AFTER THAT!

#   ┌───────────────────────┐
#───┘ Port and TLS settings └───────────────────────────────────

#
# Misskey requires a reverse proxy to support HTTPS connections.
#
#                 +----- https://example.tld/ ------------+
#   +------+      |+-------------+      +----------------+|
#   | User | ---> || Proxy (443) | ---> | Misskey (3000) ||
#   +------+      |+-------------+      +----------------+|
#                 +---------------------------------------+
#
#   You need to set up a reverse proxy. (e.g. nginx)
#   An encrypted connection with HTTPS is highly recommended
#   because tokens may be transferred in GET requests.

# The port that your Misskey server should listen on.
port: 3000

#   ┌──────────────────────────┐
#───┘ PostgreSQL configuration └────────────────────────────────

db:
  host: db
  port: 5432

  # Database names.数据库名,按需修改
  db: misskey

  # Auth数据库用户名和密码,按需修改
  user: example-misskey-user
  pass: example-misskey-pass

  # Whether disable Caching queries
  #disableCache: true

  # Extra Connection options
  #extra:
  #  ssl: true

dbReplications: false

# You can configure any number of replicas here
#dbSlaves:
#  -
#    host:
#    port:
#    db:
#    user:
#    pass:
#  -
#    host:
#    port:
#    db:
#    user:
#    pass:

#   ┌─────────────────────┐
#───┘ Redis configuration └─────────────────────────────────────

redis:
  host: redis
  port: 6379
  #family: 0  # 0=Both, 4=IPv4, 6=IPv6
  #pass: example-pass
  #prefix: example-prefix
  #db: 1

#redisForPubsub:
#  host: redis
#  port: 6379
#  #family: 0  # 0=Both, 4=IPv4, 6=IPv6
#  #pass: example-pass
#  #prefix: example-prefix
#  #db: 1

#redisForJobQueue:
#  host: redis
#  port: 6379
#  #family: 0  # 0=Both, 4=IPv4, 6=IPv6
#  #pass: example-pass
#  #prefix: example-prefix
#  #db: 1

#redisForTimelines:
#  host: redis
#  port: 6379
#  #family: 0  # 0=Both, 4=IPv4, 6=IPv6
#  #pass: example-pass
#  #prefix: example-prefix
#  #db: 1

#   ┌───────────────────────────┐
#───┘ MeiliSearch configuration └─────────────────────────────

# You can set scope to local (default value) or global 
# (include notes from remote).

#meilisearch:如要使用 修改apikey为docker-compose中设置的master_key,将ssl改为false并填写index
#  host: meilisearch
#  port: 7700
#  apiKey: ''
#  ssl: true
#  index: ''
#  scope: global

#   ┌───────────────┐
#───┘ ID generation └───────────────────────────────────────────

# You can select the ID generation method.
# You don't usually need to change this setting, but you can
# change it according to your preferences.

# Available methods:
# aid ... Short, Millisecond accuracy
# aidx ... Millisecond accuracy
# meid ... Similar to ObjectID, Millisecond accuracy
# ulid ... Millisecond accuracy
# objectid ... This is left for backward compatibility

# ONCE YOU HAVE STARTED THE INSTANCE, DO NOT CHANGE THE
# ID SETTINGS AFTER THAT!

id: 'aidx'

#   ┌─────────────────────┐
#───┘ Other configuration └─────────────────────────────────────

# Whether disable HSTS
#disableHsts: true

# Number of worker processes
#clusterLimit: 1

# Job concurrency per worker
# deliverJobConcurrency: 128
# inboxJobConcurrency: 16
# relationshipJobConcurrency: 16
#  What's relationshipJob?:
#   Follow, unfollow, block and unblock(ings) while following-imports, etc. or account migrations.

# Job rate limiter
# deliverJobPerSec: 128
# inboxJobPerSec: 32
# relationshipJobPerSec: 64

# Job attempts
# deliverJobMaxAttempts: 12
# inboxJobMaxAttempts: 8

# Local address used for outgoing requests
#outgoingAddress: 127.0.0.1

# IP address family used for outgoing request (ipv4, ipv6 or dual)
#outgoingAddressFamily: ipv4

# Amount of characters that can be used when writing notes (maximum: 8192, minimum: 1)
maxNoteLength: 3000

# Proxy for HTTP/HTTPS
#proxy: http://127.0.0.1:3128

proxyBypassHosts:
  - api.deepl.com
  - api-free.deepl.com
  - www.recaptcha.net
  - hcaptcha.com
  - challenges.cloudflare.com

# Proxy for SMTP/SMTPS
#proxySmtp: http://127.0.0.1:3128   # use HTTP/1.1 CONNECT
#proxySmtp: socks4://127.0.0.1:1080 # use SOCKS4
#proxySmtp: socks5://127.0.0.1:1080 # use SOCKS5

# Media Proxy
#mediaProxy: https://example.com/proxy

# Proxy remote files (default: true)
# Proxy remote files by this instance or mediaProxy to prevent remote files from running in remote domains.
proxyRemoteFiles: true

# Movie Thumbnail Generation URL
# There is no reference implementation.
# For example, Misskey will point to the following URL:
#   https://example.com/thumbnail.webp?thumbnail=1&url=https%3A%2F%2Fstorage.example.com%2Fpath%2Fto%2Fvideo.mp4
#videoThumbnailGenerator: https://example.com

# Sign to ActivityPub GET request (default: true)
signToActivityPubGet: true
# check that inbound ActivityPub GET requests are signed ("authorized fetch")
checkActivityPubGetSignature: false

# For security reasons, uploading attachments from the intranet is prohibited,
# but exceptions can be made from the following settings. Default value is "undefined". 
# Read changelog to learn more (Improvements of 12.90.0 (2021/09/04)).
#allowedPrivateNetworks: [
#  '127.0.0.1/32'
#]

#customMOTD: ['Hello World', 'The sharks rule all', 'Shonks']

# Upload or download file size limits (bytes)
#maxFileSize: 262144000

一般只需要修改域名即可,如要使用 meilisearch,记得取消注释相关内容并修改。

部署,完成。

web内容默认在 localhost:3000 上,若要更改请修改 docker-compose.yml 中内容。

Sharkey部署
https://z3z.xyz/posts/sharkey/
作者
z3z
发布于
2024-02-05
许可协议
CC BY-NC-SA 4.0