笔记 571 0

    Docker部署Activity-Relay服务

    AI摘要:本文介绍了使用Docker部署Activity-Relay服务的具体步骤。首先,通过git克隆仓库并编辑配置文件。然后,生成actor RSA证书并设置权限。接下来,配置docker-compose文件以开放端口并构建镜像并运行服务。最后,通过反向代理将服务添加到mastodon的中继服务中。完成以上步骤后,即可使用Docker部署Activity-Relay服务。

    前言

    最初部署的Activity-Relay服务由于是在宿主机上工作,前段时间由于宿主机机房重启了机器 使Relay服务莫名其妙的不能启动

    于是这次使用便携易用的Docker来部署服务,记录一下以备用

    具体步骤

    拉取仓库

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

    编辑配置

    进入Activity-Relay目录

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

    编辑config.yml修改相关配置

    生成actor RSA 证书

    ubuntu使用

    openssl genrsa -traditional | tee actor.pem

    centos使用

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

    赋予权限600

    chmod 600 actor.pem

    docker-compose配置

    这里需开放端口用以反向代理

    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
    

    构建镜像与运行服务

    docker-compose build
    docker-compose up -d

    查看容器运行状态

    docker-compose ps

    停止服务

    docker-compose down

    反向代理

        location = /inbox {
            proxy_pass http://127.0.0.1:8080; 
            proxy_pass_request_headers on; 
            proxy_set_header Host $http_host; 
        }
        location = /actor {
            proxy_pass http://127.0.0.1:8080; 
            proxy_pass_request_headers on; 
            proxy_set_header Host $http_host; 
        }

    完成

    https://relay.jiong.us/inbox
    加入mastodon 的中继服务即可

    老孙
    资深网民孙先生

    Warning: Undefined array key "HTTP_ACCEPT_LANGUAGE" in /www/sites/imsun.org/index/usr/themes/farallon/comments.php on line 4

    Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/sites/imsun.org/index/usr/themes/farallon/comments.php on line 4