本文最后更新于 2023-01-28T19:38:29+08:00
安装Docker 1 curl -fsSL https://get.docker.com | bash
由于新版docker自带compose,所以不用单独安装。
克隆项目 1 2 3 4 cd /opt git clone -b master https://github.com/misskey-dev/misskey.gitcd misskey git checkout master
修改配置文件 首先复制一份
1 2 cp .config/example.yml .config/default.ymlcp .config/docker_example.env .config/docker.env
编辑default.yml
其中url: https://example.tld/
改为你的实例域名db 的host
改为docker-compose.yml
里的services名,db
,user
,pass
分别改为你的数据库名,用户,密码。redis 的host
改为docker-compose.yml
里的services名。
编辑docker.env
这里的配置和default.yml
保持一致
构建镜像和初始化
如果内存太小,建议直接选择已构建好的镜像
1 2 docker compose build docker compose run --rm web pnpm run init
启动容器
配置Nginx反向代理 Misskey文档 给了一份配置文件,根据自己需求改改
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 map $http_upgrade $connection_upgrade { default upgrade; '' close; }proxy_cache_path /tmp/nginx_cache levels=1 :2 keys_zone=cache1:16m max_size=1g inactive=720m use_temp_path=off ;server { listen 80 ; listen [::]:80 ; server_name example.tld; root /var/www/html; location /.well-known/acme-challenge/ { allow all; } location /.well-known/pki-validation/ { allow all; } location / { return 301 https://$server_name $request_uri ; } }server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name example.tld; ssl_session_timeout 1d ; ssl_session_cache shared:ssl_session_cache:10m ; ssl_session_tickets off ; ssl_certificate /etc/letsencrypt/live/example.tld/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.tld/privkey.pem; ssl_protocols TLSv1.2 TLSv1.3 ; ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; ssl_prefer_server_ciphers off ; ssl_stapling on ; ssl_stapling_verify on ; client_max_body_size 80m ; location / { proxy_pass http://127.0.0.1:3000; proxy_set_header Host $host ; proxy_http_version 1 .1 ; proxy_redirect off ; proxy_set_header X-Real-IP $remote_addr ; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ; proxy_set_header X-Forwarded-Proto https; proxy_set_header Upgrade $http_upgrade ; proxy_set_header Connection $connection_upgrade ; proxy_cache cache1; proxy_cache_lock on ; proxy_cache_use_stale updating; proxy_force_ranges on ; add_header X-Cache $upstream_cache_status ; } }
如果实例套了CDN,需要删掉55-58行
升级实例 在实例目录执行
1 2 3 4 5 6 7 git stash git checkout master git pull git submodule update --init git stash pop sudo docker compose build sudo docker compose stop && sudo docker compose up -d