曾梦想仗剑走天涯
Docker部署Activity-Relay服务
  • 经过测试国内部署会有无法通讯的问题.

测试环境

centos7.9

准备工作

  • git
  • openssl
  • nginx
  • docker
  • docker-compose

从仓库Pull a repository

1
git clone https://github.com/yukimochi/Activity-Relay.git -b v2.0.0

复制编辑config.yml

进入Activity-Relay目录

1
2
cd Activity-Relay
cp config.yml.example config.yml

修改相关配置

1
vim config.yml

生成actor RSA 证书 ./actor.pem

ubuntu使用

1
openssl genrsa -traditional | tee actor.pem

centos使用

1
openssl genrsa -out actor.pem 1024 | tee actor.pem

赋予权限600

1
chmod 600 actor.pem

构建镜像与运行服务

1
2
docker-compose build
docker-compose up -d

查看容器运行状态

1
docker-compose ps

停止服务

1
docker-compose down

相关参考

docker-compose配置

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
version: "2.3"
services:
redis:
restart: always
image: redis:alpine
healthcheck:
test: ["CMD", "redis-cli", "ping"]
volumes:
- "./redisdata:/data"

worker:
container_name: worker
build: .
image: yukimochi/activity-relay
working_dir: /var/lib/relay
restart: always
init: true
command: relay worker
volumes:
- "./actor.pem:/var/lib/relay/actor.pem"
- "./config.yml:/var/lib/relay/config.yml"
depends_on:
- redis

server:
container_name: relay
build: .
image: yukimochi/activity-relay
working_dir: /var/lib/relay
restart: always
init: true
ports:
- "8080:8080"
command: relay server
volumes:
- "./actor.pem:/var/lib/relay/actor.pem"
- "./config.yml:/var/lib/relay/config.yml"
depends_on:
- redis

Nginx设置

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
upstream relay {
server 127.0.0.1:8080;
}
server {
server_name relay.example.com;

location / {
root /var/lib/relay;
try_files $uri $uri/index.html =404;
}

location /inbox {
rewrite ^/inbox(.*) /$1 break;
proxy_pass http://relay/;
proxy_pass_request_headers on;
proxy_set_header Host $http_host;
}

location /actor {
rewrite ^/inbox(.*) /$1 break;
proxy_pass http://relay/;
proxy_pass_request_headers on;
proxy_set_header Host $http_host;
}

}

Docker
centos在yum时出现Determining fastest mirrors
NEC M700黑苹果OC0.9.4引导
© 2020 浪子
Powered by hexo | Theme is blank
Title - Artist
0:00