本文最后更新于 2024-05-17,

若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益, 请联系我 删除。

本站只有Telegram群组为唯一交流群组, 点击加入

文章内容有误?申请成为本站文章修订者或作者? 向站长提出申请

Misskey是由日本开发者しゅいろ(syuilo)所创立的去中心化社交网络服务,其官方实例是misskey.io。Misskey和Mastodon一样,采用了ActivityPub协议,因此可以与联邦宇宙Fediverse互通。

简单来说,它就是一个去中心化的微博!

1715577302490.webp

官方网站:https://misskey-hub.net/en/

项目地址:https://github.com/misskey-dev/misskey

实例列表:https://join.misskey.page/zh-CN/instances (如果你不想自己搭建,也可以加入一个实例来使用)

1715577363349.webp

安装Docker🐳

利用Docker-compose搭建,易于更新

先建立一个文件夹和文件

mkdir -p ~/misskey &&cd $_

vim docker-compose.yaml

docker-compose填入以下内容:

# Misskey minimal deploy config
version: "3"

services:
  web:
    restart: always # 自动重启,请注意如果您对您的配置没有信心,请不要开启这个选项,以避免进程崩溃反复重启耗费大量资源!
    image: misskey/misskey:latest # 这里使用了官方镜像,以避免本地构建时资源不足的问题
    container_name: misskey_web # 容器名,方便管理,您可以自行修改为您觉得合适的内容
    links:
      - db
      - redis
    ports:
      - "3001:3001"
    networks:
      - internal_network
      - external_network
    volumes:
      - ./config:/misskey/.config:ro # 用于映射配置文件,请根据您的实际配置来决定文件夹名称,设定为只读即可;
      - ./files:/misskey/files # 用户上传到本地的文件,如果您一开始就接入外部存储(如wasabi或是AWS S3)您可以忽略这块配置

  redis:
    restart: always
    image: redis:latest
    container_name: misskey_redis
    networks:
      - internal_network
    volumes:
      - ./redis:/data # redis数据库的数据文件夹映射,创建后默认在 ./redis 文件夹中

  db:
    restart: always
    image: postgres:12.2-alpine
    container_name: misskey_db
    networks:
      - internal_network
    env_file:
      - ./config/docker.env # 需要使用配置文件中设置的 Docker 环境变量
    volumes:
      - ./db:/var/lib/postgresql/data # 主数据库的数据文件夹映射,创建后默认在 ./db 文件夹中

networks:
  internal_network: # 内部网络
    internal: true
  external_network: # 外部网

创建配置文件default.yml

mkdir config 

cd config vim 

default.yml
#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# Misskey configuration
#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

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

# Final accessible URL seen by a user.
url: https://gugu.ge/       # 注意改成自己最后反向代理想要的网址

# 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: 3001

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

db:
  host: db
  port: 5432

  # Database name
  db: misskey

  # Auth
  user: example-misskey-user
  pass: example-misskey-pass

  # Whether disable Caching queries
  #disableCache: true

  # Extra Connection options
  #extra:
  #  ssl: true

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

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

#   ┌─────────────────────────────┐
#───┘ Elasticsearch configuration └─────────────────────────────

#elasticsearch:
#  host: localhost
#  port: 9200
#  ssl: false
#  user: 
#  pass: 

#   ┌───────────────┐
#───┘ 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
# 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: 'aid'

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

# Whether disable HSTS
#disableHsts: true

# Number of worker processes
#clusterLimit: 1

# Job concurrency per worker
# deliverJobConcurrency: 128
# inboxJobConcurrency: 16

# Job rate limiter
# deliverJobPerSec: 128
# inboxJobPerSec: 16

# Job attempts
# deliverJobMaxAttempts: 12
# inboxJobMaxAttempts: 8

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

# Syslog option
#syslog:
#  host: localhost
#  port: 514

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

#proxyBypassHosts: [
#  'example.com',
#  '192.0.2.8'
#]

# 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: false)
#proxyRemoteFiles: true

# Sign to ActivityPub GET request (default: false)
#signToActivityPubGet: true

#allowedPrivateNetworks: [
#  '127.0.0.1/32'
#]

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

编辑环境文件docker.env

vim docker.env

复制下面的内容,填入(密码如果修改的话注意和上面对应):

# db settings
POSTGRES_PASSWORD=example-misskey-pass
POSTGRES_USER=example-misskey-user
POSTGRES_DB=misskey

最后

cd ..    # 来到dockercompose文件所在的文件夹下
docker-compose run --rm web yarn run init   # 初始化数据库
docker-compose up -d 

我们现在可以输入 http://ip:3001/访问了。

更新

cd ~/misskey # 进入docker-compose所在的文件夹

docker-compose pull    # 拉取最新的镜像(需要修改版本号)

docker-compose up -d   # 重新更新当前镜像

卸载

cd ~/misskey # 进入docker-compose所在的文件夹

docker-compose down    # 停止容器,此时不会删除映射到本地的数据

rm -rf ~/misskey # 完全删除映射到本地的数据

由于Misskey是需要ssl访问的,所以我们需要一个域名。配置反向代理参考下面

反向代理

参考教程:安装及使用

⚠️Nginx Proxy Manager(以下简称NPM)会用到80、443端口,所以本机不能占用(比如原来就有Nginx)

互联网使用请确保完成了域名解析