DEV Community

Cover image for Learn How to Disable ClamAV in Your Appwrite Stack and Reduce Memory Usage
Damodar Lohani for Appwrite

Posted on • Edited on

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

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.

Top comments (4)

Collapse
 
dokkaebi profile image
S. Peter Choe

In 0.7 and higher, you'll get a ERROR: Service 'appwrite' depends on service 'clamav' which is undefined. error after following these steps. Simply finding the depends_on section and removing clamav in docker_compose.yml will get rid of this.

Collapse
 
lohanidamodar profile image
Damodar Lohani

Thanks @dokkaebi for finding and reporting the issue.

Collapse
 
dokkaebi profile image
S. Peter Choe

Thanks for article and the flutter appwrite tutorials that jumpstarted my team's work!

Thread Thread
 
lohanidamodar profile image
Damodar Lohani

Thank you. Glad it was helpful. Do provide more suggestions to make more awesome resources for Appwrite