At work, I had the need of implement a virus scanner for all files uploaded to the server.
Well lets give a chance the clamav a deamon virus scanner opensource.
I found a project what implement a rest api very easy!
https://github.com/benzino77/clamav-rest-api/
I run the docker compose of the proyect and works like charm!
It use clamav in a docker container, an a api rest application to scan the file, using a network connector.
I'm not a big fan of docker, for run the docker project by hand, but dokku handle very well and can manage (deploy, maintain, etc) very well without effort.
With the good advice of the core developer from dokku. I can implement very fast the solution in dokku.
Then let's jump in....
โโโโโโโโ
โ โ
โโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโ โ N โ
โ โ clamav-net โ โ proxyโ G โ
โ Clamav (clamd) โโโโโโโโโโโโโโโโโโโค Rest API :3000 โโโโโโโโโค I โ
โ โ โ โ โ N โ
โโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโ โ X โ
โ โ
โ :443โ
โ โ
โโโโโโโโ
Basically this is implemented by dokku..
first the nginx proxy the http request to the rest api application
which is listen at :3000 in the container, to do that needs to communicate with clamd the deamon which scan the file and return the result to the apirest.
Easy right ?
My first approach to solve this is creating a plugin doing that but @savant Jose Gonzales from dokku suggest better create two dokku apps using https://dokkupose.netlify.app
The I paste the docker-compose file to the dokkupose and for my surprise it give exactly all the commands needed to deploy in dokku. Feeling like this:
Then the only missing here is the network link between clamd and the rest-api. I handle it by hand.
I left you the script i made to create the solution with comments:
Question?
What about the signature updates ?
In container handle it by automatically and update daily
you don't know about dokku ?
Dokku
Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen.
Sponsors
Become a sponsor and get your logo on our README on GitHub with a link to your site. [Become a sponsor]
Backers
Support us with a monthly donation and help us continue our activities. [Become a backer]
Requirements
A fresh VM running any of the following operating systems:
- Ubuntu 20.04 / 22.04 / 24.04 (amd64/arm64) - Any currently supported release
- Debian 11+ (amd64/arm64)
An SSH keypair that can be used for application deployment. If this exists before installation, it will be automatically imported into dokku.
Otherwise, you will need to import the keypair manually after installation using dokku ssh-keys:add
.
Installation
To install the latest stable release, run the following commands as a user who has access to sudo
:
wget -NP . https://dokku.com/install/v0.35.5/bootstrap.sh
sudo DOKKU_TAG=v0.35.5 bash bootstrap.sh
You can then proceed to configureโฆ
It's like heroku but selfhosted.
Top comments (0)