正在查看旧版本。 查看 当前版本.

与当前比较 查看页面历史记录

版本 4 下一个 »

环境配置

.env 配置容器运行中的环境变量,在涉及容器镜像版本调整或更改时仅需调整 .env 文件

使用 .env 可以配置多个容器运行的配置文件而无需在启动时指定对应的文件名

#COMPOSE_FILE='caddy.yml,seatable-server.yml'
COMPOSE_FILE='seatable-server.yml'
COMPOSE_PATH_SEPARATOR=','

# system settings
TIME_ZONE='Asia/Shanghai'

# seatable server url
SEATABLE_SERVER_HOSTNAME='http://192.168.182.53:8006'
SEATABLE_SERVER_PROTOCOL='https'

# initial web admin
SEATABLE_ADMIN_EMAIL='13609796771@139.com'
SEATABLE_ADMIN_PASSWORD='www.myj123.com'

# database
SEATABLE_MYSQL_ROOT_PASSWORD='www.myj123.com'

SEATABLE_DIR='/data/seatable'

官网默认启用 caddy 用来实现网关应用和域名的 https 证书管理,这里直接使用内置的 nginx 

seatable.yml

---
services:
  seatable-server:
    image: ${SEATABLE_IMAGE:-seatable/seatable-enterprise:4.3.8}
    restart: unless-stopped
    container_name: seatable-server
    ports:
      - "8006:80"
    volumes:
      - "${SEATABLE_DIR}/seatable-server:/shared"
      - "${SEATABLE_DIR}/deps/seatable.sh:/templates/seatable.sh:rx"
      - "${SEATABLE_DIR}/deps/seatable-license.txt:/shared/seatable/seatable-license.txt"
      - "${SEATABLE_DIR}/deps/licenseparse.py:/opt/seatable/seatable-server-latest/dtable-web/seahub/utils/licenseparse.py:rw"
      - "${SEATABLE_DIR}/deps/seafile-controller:/opt/seatable/seatable-server-latest/seafile/bin/seafile-controller:rw"
      - "${SEATABLE_DIR}/deps/seaf-server:/opt/seatable/seatable-server-latest/seafile/bin/seaf-server:rw"
#      - type: bind
#        source: "./seatable-license.txt"
#        target: "/shared/seatable/seatable-license.txt"
#        read_only: ${SEATABLE_LICENSE_FORCE_READ_ONLY:-false}
    environment:
      - DB_HOST=mariadb
      - DB_ROOT_PASSWD=${SEATABLE_MYSQL_ROOT_PASSWORD:?Variable is not set or empty}
      - SEATABLE_SERVER_HOSTNAME=${SEATABLE_SERVER_HOSTNAME:?Variable is not set or empty} 
      - SEATABLE_SERVER_PROTOCOL=${SEATABLE_SERVER_PROTOCOL:-https}
      - SEATABLE_ADMIN_EMAIL=${SEATABLE_ADMIN_EMAIL:?Variable is not set or empty}
      - SEATABLE_ADMIN_PASSWORD=${SEATABLE_ADMIN_PASSWORD:?Variable is not set or empty}
      - TIME_ZONE=${TIME_ZONE}
    depends_on:
      mariadb:
        condition: service_healthy
      memcached:
        condition: service_healthy
      redis:
        condition: service_healthy
    networks:
      - frontend-net
      - backend-seatable-net
    # healthcheck specifically for dtable-web
    healthcheck:
      test: ["CMD-SHELL", "curl --fail http://localhost:8000 || exit 1"]
      interval: 20s
      retries: 3
      start_period: 30s
      timeout: 10s

  mariadb:
    image: ${SEATABLE_DB_IMAGE:-mariadb:10.11.6}
    restart: unless-stopped
    container_name: mariadb
    environment:
      - MYSQL_ROOT_PASSWORD=${SEATABLE_MYSQL_ROOT_PASSWORD:?Variable is not set or empty}
      - MYSQL_LOG_CONSOLE=true
      - MARIADB_AUTO_UPGRADE=1
    volumes:
      - "${SEATABLE_DIR}/mariadb:/var/lib/mysql"
    networks:
      - backend-seatable-net
    healthcheck:
      test:
        [
          "CMD",
          "/usr/local/bin/healthcheck.sh",
          "--connect",
          "--mariadbupgrade",
          "--innodb_initialized",
        ]
      interval: 20s
      retries: 3
      start_period: 30s
      timeout: 10s
      # On older database containers without healthcheck users present you might need to create them manually,
      # otherwise the container stays unhealthy.
  memcached:
    image: ${SEATABLE_MEMCACHED_IMAGE:-memcached:1.6.22}
    restart: unless-stopped
    container_name: memcached
    entrypoint: memcached -m 256
    networks:
      - backend-seatable-net
    healthcheck:
      test: ["CMD-SHELL", "timeout 2 bash -c '</dev/tcp/localhost/11211'"]
      interval: 20s
      retries: 3
      timeout: 5s

  redis:
    image: ${SEATABLE_REDIS_IMAGE:-redis:7.2.3}
    restart: unless-stopped
    container_name: redis
    networks:
      - backend-seatable-net
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 20s
      retries: 3
      timeout: 5s

networks:
  frontend-net:
    name: frontend-net
  backend-seatable-net:
    name: backend-seatable-net

日常维护

数据库备份

cd /opt/seatable-backup/databases
docker exec -it seatable-mysql mysqldump -uroot -pMYSQL_ROOT_PASSWORD --opt ccnet_db > ccnet_db.sql
docker exec -it seatable-mysql mysqldump -uroot -pMYSQL_ROOT_PASSWORD --opt seafile_db > seafile_db.sql
docker exec -it seatable-mysql mysqldump -uroot -pMYSQL_ROOT_PASSWORD --opt dtable_db > dtable_db.sql

数据文件备份

rsync -az --exclude 'ccnet' --exclude 'logs' --exclude 'db-data' /opt/seatable/seatable-data/seatable /opt/seatable-backup/seatable

dtable-db 备份

docker exec -it seatable /opt/seatable/scripts/seatable.sh backup-all

数据库恢复

docker exec -i seatable-mysql /usr/bin/mysql -uroot -pMYSQL_ROOT_PASSWORD ccnet_db < /opt/seatable-backup/databases/ccnet_db.sql
docker exec -i seatable-mysql /usr/bin/mysql -uroot -pMYSQL_ROOT_PASSWORD seafile_db < /opt/seatable-backup/databases/seafile_db.sql
docker exec -i seatable-mysql /usr/bin/mysql -uroot -pMYSQL_ROOT_PASSWORD dtable_db < /opt/seatable-backup/databases/dtable_db.sql

恢复数据文件

rsync -az /opt/seatable-backup/seatable /opt/seatable/seatable-data/seatable

恢复 dtable-db 文件

docker exec -it seatable /opt/seatable/scripts/seatable.sh restore-all

更改域名配置

$ docker exec -it seatable /bin/bash

# for one base
$ seatable.sh python-env /opt/seatable/seatable-server-latest/dtable-web/manage.py domain_transfer -uuid <:base uuid> -od <:old domain> -nd <:new domain>

# for all bases
$ seatable.sh python-env /opt/seatable/seatable-server-latest/dtable-web/manage.py domain_transfer -all -od <:old domain> -nd <:new domain>

seatable.sh python-env /opt/seatable/seatable-server-latest/dtable-web/manage.py domain_transfer -uuid 695fa115-4927-4be1-b5b6-fbbbabd43b72  -od https://dev.seatable.cn -nd https://cloud.seatable.io

增加用户

docker exec -it seatable-server /shared/seatable/scripts/seatable.sh superuser


  • 无标签