docker icon indicating copy to clipboard operation
docker copied to clipboard

nextcloud docker build - swift configured as main storage is not working (but working if configured as external storage)

Open dataenligne opened this issue 3 years ago • 2 comments

Issue summary: Trying to get an OVH object storage configured as the primary storage. Works well if it is configured as an external storage.

Docker build on CentOS:

  • CentOS Linux release 7.9.2009 (Core)
  • Docker version 20.10.5, build 55c4c88

Configuration files:

[...]
.env (stripped):
# Swift username
OBJECTSTORE_SWIFT_USER_NAME=some-username

# Swift user password
OBJECTSTORE_SWIFT_USER_PASSWORD=awesome-password

# OpenStack project name
OBJECTSTORE_SWIFT_PROJECT_NAME=some-digitonly-project-name

# Swift container (bucket) that Nextcloud should store the data in
OBJECTSTORE_SWIFT_CONTAINER_NAME=some-container-name

# The Swift identity (Keystone) endpoint
OBJECTSTORE_SWIFT_URL=https://auth.cloud.ovh.net/v3/

# Swift endpoint region
OBJECTSTORE_SWIFT_REGION=BHS
OBJECTSTORE_SWIFT_SERVICE_REGION=BHS
OBJECTSTORE_SWIFT_AUTOCREATE=true
[...]

docker-compose.yml:

version: '3'

services:
  # Watchtower detects if any linked containers have an new image
  # available, automatically updating & restarting them if needed.
  watchtower:
    # https://hub.docker.com/r/centurylink/watchtower/
    image: v2tec/watchtower:latest
    # https://github.com/v2tec/watchtower#options
    # This schedule applies updates (if available) at midnight.
    command: --cleanup --schedule "0 0 0 * * *"
    restart: always
    networks:
      - default
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

  db:
    image: mariadb:10.3
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    restart: always
    volumes:
      - db:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: ${NEXTCLOUD_DB_ROOT_PASSWORD}
      MYSQL_DATABASE: ${NEXTCLOUD_DB_NAME}
      MYSQL_USER: ${NEXTCLOUD_DB_USER}
      MYSQL_PASSWORD: ${NEXTCLOUD_DB_PASSWORD}
  redis:
    image: redis:alpine
    restart: always

  app:
    image: nextcloud:fpm-alpine
    restart: always
    volumes:
      - nextcloud:/var/www/html
      - ./php_max_upload.ini:/usr/local/etc/php/conf.d/php_max_upload.ini:ro
      - themes:/var/www/html/themes
    environment:
      MYSQL_HOST: ${NEXTCLOUD_MYSQL_HOST}
      REDIS_HOST: ${NEXTCLOUD_REDIS_HOST}
      MYSQL_DATABASE: ${NEXTCLOUD_DB_NAME}
      MYSQL_USER: ${NEXTCLOUD_DB_USER}
      MYSQL_PASSWORD: ${NEXTCLOUD_DB_PASSWORD}
      NEXTCLOUD_ADMIN_USER: ${NEXTCLOUD_ADMIN_USER}
      NEXTCLOUD_ADMIN_PASSWORD: ${NEXTCLOUD_ADMIN_PASSWORD}
      NEXTCLOUD_DATA_DIR: ${NEXTCLOUD_DATA_DIR}
      NEXTCLOUD_TRUSTED_DOMAINS: ${NEXTCLOUD_DOMAIN}
      OBJECTSTORE_SWIFT_USER_NAME: ${OBJECTSTORE_SWIFT_USER_NAME}
      OBJECTSTORE_SWIFT_USER_PASSWORD: ${OBJECTSTORE_SWIFT_USER_PASSWORD}
      OBJECTSTORE_SWIFT_PROJECT_NAME: ${OBJECTSTORE_SWIFT_PROJECT_NAME}
      OBJECTSTORE_SWIFT_CONTAINER_NAME: ${OBJECTSTORE_SWIFT_CONTAINER_NAME}
      OBJECTSTORE_SWIFT_URL: ${OBJECTSTORE_SWIFT_URL}
      OBJECTSTORE_SWIFT_SERVICE_REGION: ${OBJECTSTORE_SWIFT_SERVICE_REGION}
    depends_on:
      - db
      - redis

  web:
    build: ./web
    restart: always
    volumes:
      - nextcloud:/var/www/html:ro
      - themes:/var/www/html/themes:ro
    environment:
      VIRTUAL_HOST: ${NEXTCLOUD_DOMAIN}
      LETSENCRYPT_HOST: ${NEXTCLOUD_DOMAIN}
      LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL_ADDR}
    depends_on:
      - app
    networks:
      - proxy-tier
      - default

  cron:
    image: nextcloud:fpm-alpine
    restart: always
    volumes:
      - nextcloud:/var/www/html
      - themes:/var/www/html/themes
    entrypoint: /cron.sh
    depends_on:
      - db
      - redis

  proxy:
    build: ./proxy
    restart: always
    ports:
      - 80:80
      - 443:443
    labels:
      com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
    volumes:
      - conf.d:/etc/nginx/conf.d
      - certs:/etc/nginx/certs:ro
      - vhost.d:/etc/nginx/vhost.d
      - html:/usr/share/nginx/html
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - ./proxy/uploadsize.conf:/etc/nginx/conf.d/uploadsize.conf:ro
    networks:
      - proxy-tier

  letsencrypt-companion:
    image: jrcs/letsencrypt-nginx-proxy-companion
    restart: always
    volumes:
      - certs:/etc/nginx/certs
      - vhost.d:/etc/nginx/vhost.d
      - html:/usr/share/nginx/html
      - /var/run/docker.sock:/var/run/docker.sock:ro
    networks:
      - proxy-tier
    depends_on:
      - proxy

volumes:
  db:
  nextcloud:
  certs:
  vhost.d:
  html:
  conf.d:
  themes:
    driver: local
    driver_opts:
     type: none
     o: bind
     device: /root/del-nextcloud-docker/themes

networks:
  proxy-tier:

nextcloud swift configuration block (within nc's config.php):

[...]
  'objectstore' =>
  array (
    'class' => 'OC\\Files\\ObjectStore\\Swift',
    'arguments' =>
    array (
      'autocreate' => false,
      'user' =>
      array (
        'name' => 'some-username',
        'password' => 'awesome-password',
        'domain' =>
        array (
          'name' => 'Default',
        ),
      ),
      'scope' =>
      array (
        'project' =>
        array (
          'name' => 'some-digitonly-project-name',
          'domain' =>
          array (
            'name' => 'Default',
          ),
        ),
      ),
      'serviceName' => 'swift',
      'region' => 'BHS',
      'url' => 'https://auth.cloud.ovh.net/v3/',
      'bucket' => 'some-container-name',
    ),
),
[...]

Problem description: While trying to access nextcloud, we're getting the following error message on the first attempt: "Storage unauthorized. Connection reset while connecting to keystone, verify the keystone url Storage is temporarily not available"

And then, the second attempt shows the following: "Storage is temporarily not available"

The nextcloud.log file shows the following (it contains thousands of entries): {"reqId":"5keEz8XxvG9EgLIYFoPO","level":3,"time":"2021-04-01T12:29:37+00:00","remoteAddr":"xxx.xxx.xxx.xxx","user":"--","app":"core","method":"GET","url":"/login","message":{"Exception":"OCP\\Files\\StorageNotAvailableException","Message":"","Code":1,"Trace":[{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Availability.php","line":243,"function":"checkAvailability","class":"OC\\Files\\Storage\\Wrapper\\Availability","type":"->","args":[]},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php","line":228,"function":"file_exists","class":"OC\\Files\\Storage\\Wrapper\\Availability","type":"->","args":["appdata_occ0g1uhrn5f/js/core/merged-template-prepend.js"]},{"file":"/var/www/html/lib/private/Files/View.php","line":1341,"function":"file_exists","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->","args":["appdata_occ0g1uhrn5f/js/core/merged-template-prepend.js"]},{"file":"/var/www/html/lib/private/Files/View.php","line":1390,"function":"getCacheEntry","class":"OC\\Files\\View","type":"->","args":[{"cache":{"__class__":"OC\\Files\\Cache\\Cache"},"scanner":null,"watcher":null,"propagator":null,"updater":null,"__class__":"OCA\\Files_Trashbin\\Storage"},"appdata_occ0g1uhrn5f/js/core/merged-template-prepend.js","/appdata_occ0g1uhrn5f/js/core/merged-template-prepend.js"]},{"file":"/var/www/html/lib/private/Files/Node/Root.php","line":201,"function":"getFileInfo","class":"OC\\Files\\View","type":"->","args":["/appdata_occ0g1uhrn5f/js/core/merged-template-prepend.js"]},{"file":"/var/www/html/lib/private/Files/Node/Folder.php","line":140,"function":"get","class":"OC\\Files\\Node\\Root","type":"->","args":["/appdata_occ0g1uhrn5f/js/core/merged-template-prepend.js"]},{"file":"/var/www/html/lib/private/Files/Node/Folder.php","line":149,"function":"get","class":"OC\\Files\\Node\\Folder","type":"->","args":["merged-template-prepend.js"]},{"file":"/var/www/html/lib/private/Files/SimpleFS/SimpleFolder.php","line":72,"function":"nodeExists","class":"OC\\Files\\Node\\Folder","type":"->","args":["merged-template-prepend.js"]},{"file":"/var/www/html/lib/private/Template/JSCombiner.php","line":117,"function":"fileExists","class":"OC\\Files\\SimpleFS\\SimpleFolder","type":"->","args":["merged-template-prepend.js"]},{"file":"/var/www/html/lib/private/Template/JSCombiner.php","line":103,"function":"isCached","class":"OC\\Template\\JSCombiner","type":"->","args":["merged-template-prepend.js",{"__class__":"OC\\Files\\SimpleFS\\SimpleFolder"}]},{"file":"/var/www/html/lib/private/Template/JSResourceLocator.php","line":116,"function":"process","class":"OC\\Template\\JSCombiner","type":"->","args":["/var/www/html","core/js/merged-template-prepend.json","core"]},{"file":"/var/www/html/lib/private/Template/JSResourceLocator.php","line":72,"function":"cacheAndAppendCombineJsonIfExist","class":"OC\\Template\\JSResourceLocator","type":"->","args":["/var/www/html","core/js/merged-template-prepend.json"]},{"file":"/var/www/html/lib/private/Template/ResourceLocator.php","line":79,"function":"doFind","class":"OC\\Template\\JSResourceLocator","type":"->","args":["js/merged-template-prepend"]},{"file":"/var/www/html/lib/private/TemplateLayout.php","line":365,"function":"find","class":"OC\\Template\\ResourceLocator","type":"->","args":[["core/js/dist/main","js/dist/files_fileinfo","js/dist/files_client","js/merged-template-prepend","core/l10n/fr","And 12 more entries, set log level to debug to see all entries"]]},{"file":"/var/www/html/lib/private/TemplateLayout.php","line":193,"function":"findJavascriptFiles","class":"OC\\TemplateLayout","type":"::","args":[["core/js/dist/main","js/dist/files_fileinfo","js/dist/files_client","js/merged-template-prepend","core/l10n/fr","And 12 more entries, set log level to debug to see all entries"]]},{"file":"/var/www/html/lib/private/legacy/OC_Template.php","line":183,"function":"__construct","class":"OC\\TemplateLayout","type":"->","args":["error",""]},{"file":"/var/www/html/lib/private/Template/Base.php","line":132,"function":"fetchPage","class":"OC_Template","type":"->","args":[]},{"file":"/var/www/html/lib/private/legacy/OC_Template.php","line":299,"function":"printPage","class":"OC\\Template\\Base","type":"->","args":[]},{"file":"/var/www/html/index.php","line":45,"function":"printErrorPage","class":"OC_Template","type":"::","args":["","Storage is temporarily not available",503]}],"File":"/var/www/html/lib/private/Files/Storage/Wrapper/Availability.php","Line":94,"Hint":"Storage is temporarily not available","CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36","version":"21.0.0.18"}

Now, if we revert back the NC's config.php to local storage (eg: by removing the objectstore block) and restart containers, nextcloud works just fine. If we configure the exact same object storage as an external storage, it works very well. The issue really comes when trying to configure the same object storage as a primary storage.

Please let me know if you need more information and how we could get this issue fixed.

Thanks,

dataenligne avatar Apr 01 '21 12:04 dataenligne

I'm experiencing the same issue on OVH. Running version: 21.0.1-fpm

Xartos avatar May 04 '21 18:05 Xartos

I also had some issues setting up OVH Object Storage as main storage but managed to make it work. Here is the environment variables I set :

  - OBJECTSTORE_SWIFT_URL=https://auth.cloud.ovh.net/v3
  - OBJECTSTORE_SWIFT_USER_NAME=user-xxxxx (OVH Users and Roles)
  - OBJECTSTORE_SWIFT_USER_PASSWORD=xxxxxxxxxxxxxxxx (OVH Users and Roles)
  - OBJECTSTORE_SWIFT_PROJECT_NAME=123456789 (Tenant Name in RC config file you can get from OVH Users and Roles)
  - OBJECTSTORE_SWIFT_REGION=GRA (Bucket region)
  - OBJECTSTORE_SWIFT_CONTAINER_NAME=nextcloud (Bucket name)

Also check that you don't have any trailing space in your values

gclotault avatar Feb 03 '22 14:02 gclotault

Hi @dataenligne - This sounds like a configuration matter rather than a bug in the community Docker image. Hopefully you got this worked out with some of the suggestions from other people that commented and/or through another channel. Since this channel is for bug reports with the Docker image, I don't think this Issue being open here is necessary any longer. I suggest using the Nextcloud Help Forum for any follow-up.

If you agree with my assessment, can you close this Issue out here to avoid confusion? Thanks!

joshtrichards avatar Jul 23 '23 14:07 joshtrichards

Closing as a config matter and one that appears dealt with (see my prior comment).

joshtrichards avatar Oct 21 '23 19:10 joshtrichards