Plane安装记录

Plane安装记录

步骤

  • 使用官方脚本,下载docker-compose.yaml和变量
  • 修改docker-compose.yaml,使用已有的数据库和网络,以及解决因未使用minio导致proxy无法启动问题
  • 修改变量
  • 启动

下载docker-compose.yaml和变量

大部分按照官方教程
操作即可

mkdir plane-selfhost

cd plane-selfhost

curl -fsSL -o setup.sh https://raw.githubusercontent.com/makeplane/plane/master/deploy/selfhost/install.sh

chmod +x setup.sh

运行程序

./setup.sh
Select a Action you want to perform:
   1) Install (arm64)
   2) Start
   3) Stop
   4) Restart
   5) Upgrade
   6) View Logs
   7) Backup Data
   8) Exit
Action [2]: 1

先选择1进行安装。
安装完毕以后需要进行调整。

修改docker-compose.yaml

修改docker-compose.yaml文件,主要解决几个问题:
1. 使用已运行的PGDATABASE数据库
2. 调整网络以能使用PGDATABASE数据库

x-app-env: &app-env
  environment:
    - NGINX_PORT=${NGINX_PORT:-80}
    - WEB_URL=${WEB_URL:-http://localhost}
    - DEBUG=${DEBUG:-0}
    - SENTRY_DSN=${SENTRY_DSN}
    - SENTRY_ENVIRONMENT=${SENTRY_ENVIRONMENT:-"production"}
    - CORS_ALLOWED_ORIGINS=${CORS_ALLOWED_ORIGINS}
    # Gunicorn Workers
    - GUNICORN_WORKERS=${GUNICORN_WORKERS:-1}
    #DB SETTINGS
    - PGHOST=${PGHOST:-plane-db}
    - PGDATABASE=${PGDATABASE:-plane}
    - POSTGRES_USER=${POSTGRES_USER:-plane}
    - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-plane}
    - POSTGRES_DB=${POSTGRES_DB:-plane}
    - POSTGRES_PORT=${POSTGRES_PORT:-5432}
    - PGDATA=${PGDATA:-/var/lib/postgresql/data}
    - DATABASE_URL=${DATABASE_URL:-postgresql://plane:plane@plane-db/plane}
    # REDIS SETTINGS
    - REDIS_HOST=${REDIS_HOST:-plane-redis}
    - REDIS_PORT=${REDIS_PORT:-6379}
    - REDIS_URL=${REDIS_URL:-redis://plane-redis:6379/}
    # Application secret
    - SECRET_KEY=${SECRET_KEY:-60gp0byfz2dvffa45cxl20p1scy9xbpf6d8c5y0geejgkyp1b5}
    # DATA STORE SETTINGS
    - USE_MINIO=${USE_MINIO:-1}
    - AWS_REGION=${AWS_REGION:-""}
    - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-"access-key"}
    - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-"secret-key"}
    - AWS_S3_ENDPOINT_URL=${AWS_S3_ENDPOINT_URL:-http://plane-minio:9000}
    - AWS_S3_BUCKET_NAME=${AWS_S3_BUCKET_NAME:-uploads}
    - MINIO_ROOT_USER=${MINIO_ROOT_USER:-"access-key"}
    - MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD:-"secret-key"}
    - BUCKET_NAME=${BUCKET_NAME:-uploads}
    - FILE_SIZE_LIMIT=${FILE_SIZE_LIMIT:-5242880}


    # 注释ADMIN_BASE_URL、SPACE_BASE_URL、APP_BASE_URL,防止提示错误
    # Admin and Space URLs
    # - ADMIN_BASE_URL=${ADMIN_BASE_URL}
    # - SPACE_BASE_URL=${SPACE_BASE_URL}
    # - APP_BASE_URL=${APP_BASE_URL}

services:
  web:
    <<: *app-env
    image: ${DOCKERHUB_USER:-makeplane}/plane-frontend:${APP_RELEASE:-stable}
    platform: ${DOCKER_PLATFORM:-}
    pull_policy: ${PULL_POLICY:-always}
    restart: unless-stopped
    command: node web/server.js web
    deploy:
      replicas: ${WEB_REPLICAS:-1}
    depends_on:
      - api
      - worker

    # 新增networks:1panel-network
    networks:
      - 1panel-network

  space:
    <<: *app-env
    image: ${DOCKERHUB_USER:-makeplane}/plane-space:${APP_RELEASE:-stable}
    platform: ${DOCKER_PLATFORM:-}
    pull_policy: ${PULL_POLICY:-always}
    restart: unless-stopped
    command: node space/server.js space
    deploy:
      replicas: ${SPACE_REPLICAS:-1}
    depends_on:
      - api
      - worker
      - web

    # 新增networks:1panel-network
    networks:
      - 1panel-network

  admin:
    <<: *app-env
    image: ${DOCKERHUB_USER:-makeplane}/plane-admin:${APP_RELEASE:-stable}
    platform: ${DOCKER_PLATFORM:-}
    pull_policy: ${PULL_POLICY:-always}
    restart: unless-stopped
    command: node admin/server.js admin
    deploy:
      replicas: ${ADMIN_REPLICAS:-1}
    depends_on:
      - api
      - web

    # 新增networks:1panel-network
    networks:
      - 1panel-network

  api:
    <<: *app-env
    image: ${DOCKERHUB_USER:-makeplane}/plane-backend:${APP_RELEASE:-stable}
    platform: ${DOCKER_PLATFORM:-}
    pull_policy: ${PULL_POLICY:-always}
    restart: unless-stopped
    command: ./bin/docker-entrypoint-api.sh
    deploy:
      replicas: ${API_REPLICAS:-1}
    volumes:
      - logs_api:/code/plane/logs
    # depends_on:
    #   - plane-db
    #   - plane-redis

    # 新增networks:1panel-network
    networks:
      - 1panel-network

  worker:
    <<: *app-env
    image: ${DOCKERHUB_USER:-makeplane}/plane-backend:${APP_RELEASE:-stable}
    platform: ${DOCKER_PLATFORM:-}
    pull_policy: ${PULL_POLICY:-always}
    restart: unless-stopped
    command: ./bin/docker-entrypoint-worker.sh
    volumes:
      - logs_worker:/code/plane/logs
    depends_on:
      - api
      # - plane-db
      # - plane-redis

    # 新增networks:1panel-network
    networks:
      - 1panel-network

  beat-worker:
    <<: *app-env
    image: ${DOCKERHUB_USER:-makeplane}/plane-backend:${APP_RELEASE:-stable}
    platform: ${DOCKER_PLATFORM:-}
    pull_policy: ${PULL_POLICY:-always}
    restart: unless-stopped
    command: ./bin/docker-entrypoint-beat.sh
    volumes:
      - logs_beat-worker:/code/plane/logs
    depends_on:
      - api
      # - plane-db
      # - plane-redis

    # 新增networks:1panel-network
    networks:
      - 1panel-network

  migrator:
    <<: *app-env
    image: ${DOCKERHUB_USER:-makeplane}/plane-backend:${APP_RELEASE:-stable}
    platform: ${DOCKER_PLATFORM:-}
    pull_policy: ${PULL_POLICY:-always}
    restart: "no"
    command: ./bin/docker-entrypoint-migrator.sh
    volumes:
      - logs_migrator:/code/plane/logs
    # depends_on:
    #   - plane-db
    #   - plane-redis

    # 新增networks:1panel-network
    networks:
      - 1panel-network

  # 注释plane-db、plane-redis,使用已存在的数据库和redis
  # plane-db:
  #   <<: *app-env
  #   image: postgres:15.5-alpine
  #   pull_policy: if_not_present
  #   restart: unless-stopped
  #   command: postgres -c 'max_connections=1000'
  #   volumes:
  #     - pgdata:/var/lib/postgresql/data

  # plane-redis:
  #   <<: *app-env
  #   image: valkey/valkey:7.2.5-alpine
  #   pull_policy: if_not_present
  #   restart: unless-stopped
  #   volumes:
  #     - redisdata:/data


  # 注释plane-minio,使用AWS
  # plane-minio:
  #   <<: *app-env
  #   image: minio/minio:latest
  #   pull_policy: if_not_present
  #   restart: unless-stopped
  #   command: server /export --console-address ":9090"
  #   volumes:
  #     - uploads:/export

  # Comment this if you already have a reverse proxy running
  proxy:
    <<: *app-env
    # 注释image,使用build,解决因未使用minio,导致无法启动的问题
    # image: ${DOCKERHUB_USER:-makeplane}/plane-proxy:${APP_RELEASE:-stable}
    build: ./plane-proxy
    platform: ${DOCKER_PLATFORM:-}
    pull_policy: ${PULL_POLICY:-always}
    ports:
      - ${NGINX_PORT}:80
    depends_on:
      - web
      - api
      - space

    # 新增networks:1panel-network
    networks:
      - 1panel-network

# 注释pgdata、redisdata、uploads、
volumes:
  # pgdata:
  # redisdata:
  # uploads:
  logs_api:
  logs_worker:
  logs_beat-worker:
  logs_migrator:

# 新增networks:1panel-network
networks:
  1panel-network:  # 引用已存在的网络
    external: true  # 标记为外部网络

plane.env配置文件如下:

APP_RELEASE=stable

WEB_REPLICAS=1
SPACE_REPLICAS=1
ADMIN_REPLICAS=1
API_REPLICAS=1

NGINX_PORT=8012 # 修改端口
WEB_URL=http://localhost
DEBUG=0
SENTRY_DSN=
SENTRY_ENVIRONMENT=production
CORS_ALLOWED_ORIGINS=http://localhost

#DB SETTINGS
PGHOST=1Panel-postgresql
PGDATABASE=xxx_plane
POSTGRES_USER=xxx_plane_user
POSTGRES_PASSWORD=POSTGRES_PASSWORD
POSTGRES_DB=xxx_plane
POSTGRES_PORT=5432
PGDATA=/var/lib/postgresql/data
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${PGHOST}:${POSTGRES_PORT}/${POSTGRES_DB}

# REDIS SETTINGS
REDIS_HOST=1Panel-redis
REDIS_PORT=6379
REDIS_PASSWORD=redis_password
REDIS_URL=redis://:${REDIS_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}

# Secret Key
SECRET_KEY=60gp0byfz2dvffa45cxl20p1scy9xbpf6d8c5y0geejgkyp1b5

# DATA STORE SETTINGS

# 着重强调,要确认一下KEY_ID和ACCESS_KEY是否对桶有读写权限,可以先本地测试一下,然后桶需要开启ACL,允许公网访问。在这里吃了亏,测试了1-2天
USE_MINIO=0
AWS_REGION=ap-northeast-1
AWS_ACCESS_KEY_ID=123
AWS_SECRET_ACCESS_KEY=456
AWS_S3_ENDPOINT_URL=https://s3.ap-northeast-1.amazonaws.com
AWS_S3_BUCKET_NAME=minyae-plane
# MINIO_ROOT_USER=access-key
# MINIO_ROOT_PASSWORD=secret-key
BUCKET_NAME=xxx-plane
FILE_SIZE_LIMIT=5242880

# Gunicorn Workers
GUNICORN_WORKERS=1

# UNCOMMENT `DOCKER_PLATFORM` IF YOU ARE ON `ARM64` AND DOCKER IMAGE IS NOT AVAILABLE FOR RESPECTIVE `APP_RELEASE`
DOCKER_PLATFORM=linux/amd64

plane-selfhost/plane-app/plane-proxy下创建三个文件,以重新构建plane-proxy,因为没有使用Minio,导致nginx出现问题,无法启动proxy

分别是Dockerfile,env.sh,nginx.conf.template


cd /app/plane-selfhost/plane-app mkdir plane-proxy cd plane-proxy

Dockerfile文件:

FROM nginx:1.25.0-alpine

RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf.template /etc/nginx/nginx.conf.template

COPY ./env.sh /docker-entrypoint.sh

RUN chmod +x /docker-entrypoint.sh
# Update all environment variables
CMD ["/docker-entrypoint.sh"]

env.sh文件:

#!/bin/sh

export dollar="$"
export http_upgrade="http_upgrade"
export scheme="scheme"
envsubst < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf
exec nginx -g 'daemon off;'

nginx.conf.template文件:

events {
}

http {
    sendfile on;

    server {
        listen 80;
        root /www/data/;
        access_log /var/log/nginx/access.log;

        client_max_body_size ${FILE_SIZE_LIMIT};

        add_header X-Content-Type-Options    "nosniff" always;
        add_header Referrer-Policy           "no-referrer-when-downgrade" always;
        add_header Permissions-Policy        "interest-cohort=()" always;
        add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
        add_header X-Forwarded-Proto         "${dollar}scheme";
        add_header X-Forwarded-Host          "${dollar}host";
        add_header X-Forwarded-For           "${dollar}proxy_add_x_forwarded_for";
        add_header X-Real-IP                 "${dollar}remote_addr";

        location / {
            proxy_http_version 1.1;
            proxy_set_header Upgrade ${dollar}http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Host ${dollar}http_host;
            proxy_pass http://web:3000/;
        }

        location /god-mode/ {
            proxy_http_version 1.1;
            proxy_set_header Upgrade ${dollar}http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Host ${dollar}http_host;
            proxy_pass http://admin:3000/god-mode/;
        }

        location /api/ {
            proxy_http_version 1.1;
            proxy_set_header Upgrade ${dollar}http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Host ${dollar}http_host;
            proxy_pass http://api:8000/api/;
        }

        location /auth/ {
            proxy_http_version 1.1;
            proxy_set_header Upgrade ${dollar}http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Host ${dollar}http_host;
            proxy_pass http://api:8000/auth/;
        }

        location /spaces/ {
            proxy_http_version 1.1;
            proxy_set_header Upgrade ${dollar}http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Host ${dollar}http_host;
            proxy_pass http://space:3000/spaces/;
        }


    }
}

以上三个文件实际来自于https://github.com/makeplane/plane/tree/master/nginx ,实际只是删除了nginx.conf.template文件中关于minio的内容:

启动容器

docker compose -f docker-compose.yaml  --env-file=plane.env up -d

启动的时候指定变量文件

上一篇 2024年5月16日 下午10:52
下一篇 2024年9月21日 下午9:41

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注