Henry
发布于 2025-01-05 / 30 阅读
0
0

Nextcloud - 部署

简介

部署 nextcloud 个人服务。

详细步骤

准备 docker-compose.yaml 配置文件:

services:
  nextcloud_db:
    image: mariadb:11.6.2
    volumes:
      - ./data/mariadb/var/lib/mysql:/var/lib/mysql
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    environment:
      - MYSQL_ROOT_PASSWORD=nextcloud_root_password
      - MYSQL_PASSWORD=nextcloud_password
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
    ports:
      - "30038:3306"
    networks:
      - prod_net

  nextcloud_redis:
    image: redis:7.4.1
    volumes:
      - ./data/redis/data:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    networks:
      - prod_net

  nextcloud_app:
    image: nextcloud:30.0.4
    ports:
      - 30039:80
    volumes:
      - ./data/nextcloud/var/www/html:/var/www/html
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    environment:
      - MYSQL_HOST=nextcloud_db
      - REDIS_HOST=nextcloud_redis
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_PASSWORD=nextcloud_password
      - NEXTCLOUD_ADMIN_USER=admin
      - NEXTCLOUD_ADMIN_PASSWORD=admin_password
    depends_on:
      - nextcloud_db
      - nextcloud_redis
    networks:
      - prod_net

networks:
  prod_net:
    external: true

配置完成后,启动容器

# docker compose up -d
[+] Running 3/3
 ✔ Container nextcloud_redis  Started 
 ✔ Container nextcloud_db     Started    
 ✔ Container nextcloud_app    Started     

查看各容器 Log

# docker logs -f --tail 10 nextcloud_db
2025-01-04 14:01:04 0 [Note] InnoDB: Cannot open '/var/lib/mysql/ib_buffer_pool' for reading: No such file or directory
2025-01-04 14:01:04 0 [Note] Plugin 'wsrep-provider' is disabled.
2025-01-04 14:01:04 0 [Note] Recovering after a crash using tc.log
2025-01-04 14:01:04 0 [Note] Starting table crash recovery...
2025-01-04 14:01:04 0 [Note] Crash table recovery finished.
2025-01-04 14:01:05 0 [Note] Server socket created on IP: '0.0.0.0'.
2025-01-04 14:01:05 0 [Note] Server socket created on IP: '::'.
2025-01-04 14:01:05 0 [Note] mariadbd: Event Scheduler: Loaded 0 events
2025-01-04 14:01:05 0 [Note] mariadbd: ready for connections.
Version: '11.6.2-MariaDB-ubu2404'  socket: '/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
# docker logs -f --tail 10 nextcloud_redis
1:C 04 Jan 2025 14:01:01.865 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
1:M 04 Jan 2025 14:01:01.867 * monotonic clock: POSIX clock_gettime
1:M 04 Jan 2025 14:01:01.869 * Running mode=standalone, port=6379.
1:M 04 Jan 2025 14:01:01.870 * Server initialized
1:M 04 Jan 2025 14:01:01.871 * Loading RDB produced by version 7.4.1
1:M 04 Jan 2025 14:01:01.871 * RDB age 223 seconds
1:M 04 Jan 2025 14:01:01.871 * RDB memory usage when created 0.90 Mb
1:M 04 Jan 2025 14:01:01.871 * Done loading RDB, keys loaded: 0, keys expired: 0.
1:M 04 Jan 2025 14:01:01.872 * DB loaded from disk: 0.003 seconds
1:M 04 Jan 2025 14:01:01.872 * Ready to accept connections tcp
# docker logs -f --tail 10 nextcloud_app
Configuring Redis as session handler
Initializing nextcloud 30.0.4.1 ...

等待 nextcloud 初始化完成后登录即可,具体时间基于系统配置,一般是 20~30分钟,例如我的URL是:https://192.168.122.254:30039


以上便是本文的全部内容,感谢您的阅读。



评论