banner
老孙

老孙博客

资深网民孙先生
mastodon
email

Deploying Activity-Relay Service with Docker

  • There may be communication issues when deploying in China.

Test Environment#

centos7.9

Preparation#

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

Pull a repository from the repository#

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

Copy and edit config.yml#

Go to the Activity-Relay directory

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

Modify the relevant configuration

vim config.yml

Generate actor RSA certificate ./actor.pem#

For Ubuntu

openssl genrsa -traditional | tee actor.pem

For CentOS

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

Set permissions to 600

chmod 600 actor.pem

Build images and run services#

docker-compose build
docker-compose up -d

Check container running status#

docker-compose ps

Stop services#

docker-compose down

docker-compose configuration

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 configuration

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;
    }

  }

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.