Learn How to Disable ClamAV in Your Appwrite Stack and Reduce Memory Usage

Damodar Lohani - Feb 8 '21 - - Dev Community

Though it is not recommended to disable ClamAV due to security concerns, some of you might wish to disable it for performance improvements or low system resources during development.

ClamAV is a heavy memory process as it holds its entire virus DB (~1GB) on the container memory for fast scanning of files. This tutorial will cover how to successfully disable ClamAV in your Appwrite stack and reduce resource consumption.

Disable ClamAV in appwrite container

Using the environment variable _APP_STORAGE_ANTIVIRUS, you can either disable or enable the antivirus. To disable it, in your docker-compose.yml file under appwrite service in the environment section, find _APP_STORAGE_ANTIVIRUS and set its value to disabled. This will disable the antivirus checking during new file uploads.

Remove ClamAV Container

Once you have disabled the antivirus in the Appwrite container, you can now successfully remove the ClamAV container without causing any issue.

If you are already running the containers, first stop the ClamAV container using docker-compose stop clamav and remove the stopped container using docker-compose rm clamav. Finally, you can remove the clamav service from your docker-compose.yml file and under appwrite service in the depends_on section remove clamav as well.

ClamAV service looks like. You can completely remove all of these lines.

  clamav:
    image: appwrite/clamav:1.2.0
    container_name: appwrite-clamav
    networks:
      - appwrite
    volumes:
      - appwrite-uploads:/storage/uploads
Enter fullscreen mode Exit fullscreen mode

If you are not running the Appwrite containers, you can simply remove the clamav service from your docker-compose.yml file and under appwrite service in the depends_on section remove clamav, then you are done.

Note: In production, we advise not to disable the ClamAV as it protects against uploads of malicious files in Appwrite storage. Disabling it will not compromise your Appwrite server, as no storage files are being executed, but it will remove an extra security layer that adds more security to your project's users.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .