撰写文件不适用于部署

时间:2019-04-18 02:38:53

标签: docker docker-compose docker-swarm

我正在使用Wonderfall nextcloud image通过撰写文件进行部署。在使用docker stack deploy时,似乎没有填写变量。

我尝试了几次部署,但没有运气

version: '3.3'

networks:
  prodnet:
    external: true

services:
  nextcloud:
    image: wonderfall/nextcloud
    depends_on:
      - nextcloud-db # If using MySQL
      - redis # If using Redis
  ports:
    - 8888:8888
  deploy:
    replicas: 1
    placement:
      constraints: [node.role == worker]

  environment:
    - UID=1100
    - GID=1100
    - UPLOAD_MAX_SIZE=10G
    - APC_SHM_SIZE=128M
    - OPCACHE_MEM_SIZE=128
    - CRON_PERIOD=15m
    - TZ=America/New_York
    - ADMIN_USER=cloudadmin # Don't set to configure through browser
    - ADMIN_PASSWORD=verycomplexpassword # Don't set to configure through browser
    - DOMAIN=www.blah.com
    - DB_TYPE=mysql
    - DB_NAME=nextcloud
    - DB_USER=wonderfall
    - DB_PASSWORD=supersecretpassword
    - DB_HOST=nextcloud-db

  volumes:
    - nextcloud_data:/data
    - nextcloud_config:/config
    - nextcloud_apps:/apps2
    - nextcloud_themes:/nextcloud/themes

  networks:
    - prodnet



# If using Redis
redis:
  image: redis:alpine
  volumes:
    - nextcloud_redis:/data
  networks:
    - prodnet

# If using MySQL

nextcloud-db:
  image: mysql:latest
  command: --default-authentication-plugin=mysql_native_password
  ports:
    - 3307:3306
  deploy:
    replicas: 1
    placement:
      constraints: [node.role == worker]

  volumes:
    - nextcloud_mysql:/var/lib/mysql

  environment:
    - MYSQL_ROOT_PASSWORD=supersecretpassword
    - MYSQL_DATABASE=nextcloud
    - MYSQL_USER=wonderfall
    - MYSQL_PASSWORD=supersecretpassword
  networks:
    - prodnet

volumes:
  nextcloud_data:
    driver: local
    driver_opts:
      type: nfs
      o: addr=xxxxxxxxxxxxx,hard,nolock,rw
      device: ":/mnt/array1/docker/nextcloud1/data"
  nextcloud_config:
    driver: local
    driver_opts:
      type: nfs
      o: addr=xxxxxxxxxxxxx,hard,nolock,rw
      device: ":/mnt/array1/docker/nextcloud1/config"
  nextcloud_apps:
    driver: local
    driver_opts:
      type: nfs
      o: addr=xxxxxxxxxxxxx,hard,nolock,rw
      device: ":/mnt/array1/docker/nextcloud1/apps2"
  nextcloud_themes:
    driver: local
    driver_opts:
      type: nfs
      o: addr=xxxxxxxxxxxxx,hard,nolock,rw
      device: ":/mnt/array1/docker/nextcloud1/themes"

  nextcloud_redis:
    driver: local
    driver_opts:
      type: nfs
      o: addr=xxxxxxxxxxxxx,hard,nolock,rw
      device: ":/mnt/array1/docker/nextcloud1/redis"

  nextcloud_mysql:
    driver: local
    driver_opts:
      type: nfs
      o: addr=xxxxxxxxxxxxx,hard,nolock,rw
      device: ":/mnt/array1/docker/nextcloud1/mysql"

已部署映像,但这是默认设置,并且正在尝试使用SQLite,而不是配置的映像。我正在遵循Wonderfall github页面上的准则,但是它不起作用。

1 个答案:

答案 0 :(得分:0)

您需要缩进redisnextcloud-db的定义,它们应该与nextcloud处于同一级别,而不与services处于同一级别。

[...]

services:
  nextcloud:
    image: wonderfall/nextcloud
    [...]

  # If using Redis
  redis:
    image: redis:alpine
    [...]

  # If using MySQL
  nextcloud-db:
    image: mysql:latest
    [...]

请参见Dockerhub上的示例。