Docker安裝Nextcloud+collabora office+ocdownloader

Docker安裝nextcloud+Redis+Nginx

1.安裝dockerphp

2.安裝docker-composehtml

3.建立docker-compose.ymlmysql

   如下配置文件不包括數據庫,數據庫須要另外部署。nginx

#~/docker-compose.yml
version: '3'

services:

  nginx:
    container_name: nginx
    hostname: nginx
    image: nginx:1.14
    ports:
      - 80:80
      - 443:443
    networks:
      - cloud_net
    restart: always
    volumes:
      - /docker/nextcloud:/usr/share/nginx/html
      - /docker/nginx/nginx.conf:/etc/nginx/nginx.conf
      - /docker/nginx/conf:/etc/nginx/conf.d
      - /docker/certs:/etc/certs
      - /docker/nginx/log:/var/log/nginx

  nextcloud_web:
    image: nextcloud:apache
    container_name: nextcloud_web
    hostname: nextcloud_web
    depends_on:
      - redis
    environment:
      - UPLOAD_MAX_SIZE=10G
      - APC_SHM_SIZE=128M
      - OPCACHE_MEM_SIZE=128
      - CRON_PERIOD=15m
      - TZ=Aisa/Shanghai
      - DOMAIN=hostname
      - DB_TYPE=mariadb
      - DB_NAME=nextcloud
      - DB_USER=root
      - DB_PASSWORD=root
      - DB_HOST=IP:3306
    ports:
      - 9000:80/tcp
    networks:
      - cloud_net
    volumes:
      - /docker/nextcloud:/var/www/html
      - /docker/aria2/data:/data
      - /docker/aria2/user-files:/user-files                                   

    restart: always

  mariadb:
    image: mariadb:latest
    container_name: mariadb
    environment:
      MYSQL_ROOT_PASSWORD: root
    networks:
      - cloud_net
    volumes:
      - /data/mariadb/data:/var/lib/mysql
    restart: always
    ports:
      - 3306:3306

  redis:
    image: redis:alpine
    container_name: redis
    hostname: redis
    restart: always
    networks:
      - cloud_net
    expose:
      - 6379
    restart: always
    privileged: true

  #onlyoffice:
  #  image: onlyoffice/documentserver
  #  container_name: onlyoffice
  #  hostname: onlyoffice
  #  privileged: true
  #  environment:
  #    - REDIS_SERVER_HOST=redis
  #    - REDIS_SERVER_PORT=6379
  #  volumes:
  #    - /docker/onlyoffice/data:/var/www/onlyoffice/Data
  #    - /docker/onlyoffice/logs:/var/log/onlyoffice
  #  restart: always
  #  ports:
  #    - 9001:80/tcp
  #    - 9002:443
  #  networks:
  #    - cloud_net

  aria2:
    image: wahyd4/aria2-ui:latest
    ports:
      - "8000:80"
      - "6800:6800"
    volumes:
      - /docker/aria2/app/conf/aria2.conf:/root/conf/aria2.conf
      - /docker/aria2/app/conf/aria2.session:/root/conf/aria2.session
      - /docker/aria2/data:/data
    environment:
      - DOMAIN=:80
      # - SSL=true
      # - RPC_SECRET=Hello
      # - ARIA2_USER=111111
      # - ARIA2_PWD=111111
      # - ENABLE_AUTH=true
    links:
      - nextcloud_web:file-manager
    restart: always
    networks:
      - cloud_net  
     
networks:
  cloud_net:  

 

4.拉取用到的鏡像web

5.先運行Nginx鏡像redis

6.建立須要掛載的目錄sql

7.將當前運行的nginx配置複製到建立的目錄中docker

   nginx.conf、conf.d/default.conf數據庫

8.中止當前的nginx容器apache

9.刪除當前的nginx容器

10.進入docker-compose.yml同級目錄,執行

$ docker-compose up -d 

 

11.查看全部容器是否啓動

$ docker ps 

 

12.配置redis到nextcloud配置文件

# vim /docker/nextcloud/config/config.php 

 在文件尾部添加,保存退出

'memcache.local' => '\OC\Memcache\Redis',
  'memcache.distributed' => '\OC\Memcache\Redis',
  'memcache.locking' => '\OC\Memcache\Redis',
  'redis' => array(
     'host' => 'redis',  
     'port' => 6379,
     ),

 

部署Collabora Office(http)

  參考:https://www.jianshu.com/p/4082f998a05b

安裝介紹:

本機IP:192.168.1.110,虛擬機地址IP:192.168.33.145

一、安裝collabora鏡像

docker pull collabora/code

二、運行collabora鏡像

docker run -t -d -p 0.0.0.0:9980:9980 -e 'domain=192\\.168\\.1\\.110|192\\.168\\.33\\.145' -e "username=admin" -e "password=123456" --restart always --cap-add MKNOD collabora/code

說明:

鏡像端口9980映射到宿主主機9980

添加兩臺信任主機192.168.1.1十、192.168.33.145

爲collabora建立用戶admin,密碼123456

注意:

後臺運行,需耐心等待,可經過cpu利用率觀察

三、collabora登陸測試(https)

https://192.168.33.145:9980/loleaflet/dist/admin/adminSettings.html,顯示輸入用戶名、密碼

四、修改loolwsd.xml

查看collabora容器id:docker ps

進入collabora容器:docker exec -it <容器id> /bin/bash

編輯文件/etc/loolwsd/loolwsd.xml中ssl的值爲false,以下

<ssl desc="SSL settings">

        <enable type="bool" default="true">false</enable>

重啓collabora容器:docker restart <容器id>

五、collabora登陸測試(http)

http://192.168.33.145:9980/loleaflet/dist/admin/adminSettings.html,顯示輸入用戶名、密碼

六、nextcloud鏈接collabora

啓動collabora插件,設置中輸入collabora地址http://192.168.33.145:9980

說明:nextcloud登陸方式自己是http

部署Airas2+ocDownloader

 

 

注意點:*建議相關端口所有開一遍

1.商店不能打開,報錯「沒法找到當前版本應用」

  解決:防火牆開啓9000端口,並重啓nextcloud容器

[root@localhost ~]# firewall-cmd --zone=public --add-port=9000/tcp --permanent
success
[root@localhost ~]# docker restart c775ab55f8f3
c775ab55f8f3

 

2.開啓Collabora Online,添加服務地址後,查日誌報錯「No route to .host .port.」

  解決:防火牆開啓9980端口,並重啓Collabora容器

[root@localhost ~]# firewall-cmd --zone=public --add-port=9980/tcp --permanent
success
[root@localhost ~]# docker restart fdsa5f8f3
fdsa5f8f3

 

3.Nextcloud鏈接本機mariadb,報錯「No route to .host.port...」

  解決:防火牆開啓3306端口,並重啓Mairadb容器

[root@localhost ~]# firewall-cmd --zone=public --add-port=3306/tcp --permanent
success
[root@localhost ~]# docker restart lsodjskd2399ds
lsodjskd2399ds
相關文章
相關標籤/搜索