How to install Appwrite on Synology NAS

1. Install Container Manager package

In DiskStation Manager, Open Package Center and install Container Manger package.

2. Create directory for Docker’s project

  • Open File Station and create directory to store Appwrite. For this example: /volume1/docker/appwrite.

  • Then, create the following directories:

    /volume1/docker/appwrite/storage/builds
    /volume1/docker/appwrite/storage/cache
    /volume1/docker/appwrite/storage/certificates
    /volume1/docker/appwrite/storage/config
    /volume1/docker/appwrite/storage/functions
    /volume1/docker/appwrite/storage/influxdb
    /volume1/docker/appwrite/storage/mariadb
    /volume1/docker/appwrite/storage/redis
    /volume1/docker/appwrite/storage/uploads
    

3. Setup Docker Compose file.

  • Download Appwrite base docker-compose.yml and .env files

  • Open docker-compose.yml in code editor, under traefik: edit the following from:

    ports:
      - 80:80
      - 443:443
    

    To

    ports:
      - 8080:80
      - 8443:443
    

    For this example, port 8080 and 8443 is use to gain access to Appwrite. You can change it to other ports that you want to use.

    Edit volumes: from:

    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - appwrite-config:/storage/config:ro
      - appwrite-certificates:/storage/certificates:ro
    

    To:

    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /volume1/docker/appwrite/storage/config:/storage/config:ro
      - /volume1/docker/appwrite/storage/certificates:ro
    
  • Under appwrite: edit the following volumes: from:

    volumes:
      - appwrite-uploads:/storage/uploads:rw
      - appwrite-cache:/storage/cache:rw
      - appwrite-config:/storage/config:rw
      - appwrite-certificates:/storage/certificates:rw
      - appwrite-functions:/storage/functions:rw
    

    To

    volumes:
      - /volume1/docker/appwrite/storage/uploads:/storage/uploads:rw
      - /volume1/docker/appwrite/storage/cache:/storage/cache:rw
      - /volume1/docker/appwrite/storage/config:/storage/config:rw
      - /volume1/docker/appwrite/storage/certificates:/storage/certificates:rw
      - /volume1/docker/appwrite/storage/functions:/storage/functions:rw
    cap_add:
      - SYS_ADMIN
    
  • Under appwrite-worker-deletes: edit volumes: from:

    volumes:
      - appwrite-uploads:/storage/uploads:rw
      - appwrite-cache:/storage/cache:rw
      - appwrite-functions:/storage/functions:rw
      - appwrite-builds:/storage/builds:rw
      - appwrite-certificates:/storage/certificates:rw
    

    To

    volumes:
      - /volume1/docker/appwrite/storage/uploads:/storage/uploads:rw
      - /volume1/docker/appwrite/storage/cache:/storage/cache:rw
      - /volume1/docker/appwrite/storage/functions:/storage/functions:rw
      - /volume1/docker/appwrite/storage/builds:/storage/builds:rw
      - /volume1/docker/appwrite/storage/certificates:/storage/certificates:rw
    
  • Under appwrite-worker-builds: edit volumes: from:

    volumes:
      - appwrite-functions:/storage/functions:rw
      - appwrite-builds:/storage/builds:rw
    

    To

    volumes:
      - /volume1/docker/appwrite/storage/functions:/storage/functions:rw
      - /volume1/docker/appwrite/storage/builds:/storage/builds:rw
    
  • Under appwrite-worker-certificates: edit volumes: from:

    volumes:
      - appwrite-config:/storage/config:rw
      - appwrite-certificates:/storage/certificates:rw
    

    To

    volumes:
      - /volume1/docker/appwrite/storage/config:/storage/config:rw
      - /volume1/docker/appwrite/storage/certificates:/storage/certificates:rw
    
  • Under openruntimes-executor edit volumes: from:

    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - appwrite-builds:/storage/builds:rw
      - appwrite-functions:/storage/functions:rw
      # Host mount nessessary to share files between executor and runtimes.
      # It's not possible to share mount file between 2 containers without host mount (copying is too slow)
      - /tmp:/tmp:rw
    

    To

    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /volume1/docker/appwrite/storage/builds:/storage/builds:rw
      - /volume1/docker/appwrite/storage/functions:/storage/functions:rw
      # Host mount nessessary to share files between executor and runtimes.
      # It's not possible to share mount file between 2 containers without host mount (copying is too slow)
      - /tmp:/tmp:rw
    
  • Under mariadb: edit volumes: from:

    volumes:
      - appwrite-mariadb:/var/lib/mysql:rw
    

    To

    volumes:
      - /volume1/docker/appwrite/storage/mariadb:/var/lib/mysql:rw
    
  • Under redis: edit volumes: from:

    volumes:
      - appwrite-redis:/data:rw
    

    To

    volumes:
      - /volume1/docker/appwrite/storage/redis:/data:rw
    
  • If using clamav, under clamav: edit volumes: from:

    volumes:
      - appwrite-uploads:/storage/uploads
    

    To

    volumes:
      - /volume1/docker/appwrite/storage/uploads:/storage/uploads
    
  • Under influxdb: edit volumes: from:

    volumes:
      - appwrite-influxdb:/var/lib/influxdb:rw
    

    To

    volumes:
      - /volume1/docker/appwrite/storage/influxdb:/var/lib/influxdb:rw
    
  • Remove or comment out the unused named volumes:

    # volumes:
    #  appwrite-mariadb:
    #  appwrite-redis:
    #  appwrite-cache:
    #  appwrite-uploads:
    #  appwrite-certificates:
    #  appwrite-functions:
    #  appwrite-builds:
    #  appwrite-influxdb:
    #  appwrite-config:
    
  • Save and move both edited docker-compose.yml and .env files to /volume1/docker/appwrite.

4. Create Appwrite project in Container Manager

  • Open Container Manager -> Project -> Create.

  • Fill up Project Name and click Set Path.

  • Choose directory where did you stored docker-compose.yml and .env files. For this example: /volume1/docker/appwrite. Then click Select.

  • Choose "Use existing an docker-compose.yml to create the project" and click OK.

  • In Web portal settings click Next.

  • In Summary click Done.

  • Wait until build process is completed. The final line in Terminal will be Exit code: 0. Then click Close.

  • You can access Appwrite via https://[YOUR-NAS-IP-ADDRESS]:8443 or other ports you’ve edited in docker-compose.yml file.

Why not use named volume and NFS?

I tried but with no success.

  • NFS is enabled in Control Panel -> File Services -> NFS. The “Maximum NFS protocol” is set to NFSv4.

  • Permission is created in Control Panel -> Shared Folder -> docker -> Edit -> NFS Permissions with “Non-privileged” and “Cross-mount” set to Allowed.

  • In docker-compose.yml, the named volumes set to:

    volumes:
      appwrite-mariadb:
        type: nfs
        o: addr=[NAS-IP-ADDRESS],nfsvers=4
        device: :/volume1/docker/appwrite/storage/mariadb
      appwrite-redis:
        type: nfs
        o: addr=[NAS-IP-ADDRESS],nfsvers=4
        device: :/volume1/docker/appwrite/storage/redis
      appwrite-cache:
        type: nfs
        o: addr=[NAS-IP-ADDRESS],nfsvers=4
        device: :/volume1/docker/appwrite/storage/cache
      appwrite-uploads:
        type: nfs
        o: addr=[NAS-IP-ADDRESS],nfsvers=4
        device: :/volume1/docker/appwrite/storage/uploads
      appwrite-certificates:
        type: nfs
        o: addr=[NAS-IP-ADDRESS],nfsvers=4
        device: :/volume1/docker/appwrite/storage/certificates
      appwrite-functions:
        type: nfs
        o: addr=[NAS-IP-ADDRESS],nfsvers=4
        device: :/volume1/docker/appwrite/storage/functions
      appwrite-builds:
        type: nfs
        o: addr=[NAS-IP-ADDRESS],nfsvers=4
        device: :/volume1/docker/appwrite/storage/builds
      appwrite-influxdb:
        type: nfs
        o: addr=[NAS-IP-ADDRESS],nfsvers=4
        device: :/volume1/docker/appwrite/storage/influxdb
      appwrite-config:
        type: nfs
        o: addr=[NAS-IP-ADDRESS],nfsvers=4
        device: :/volume1/docker/appwrite/storage/config
    

Docker just doesn’t seem to managed to map the volumes. It could be some permission issue, but I can’t seem to figure it out what actually happened.

Further Reading