Connection Timeout to vfunction-mysql Container from vfunction-vfapi Containers due to UFW Deny Rules
Overview of the Issue
This issue occurs in the following circumstances:
- An organization attempts to install a vFunction Server on a Linux VM with an Operating System that support Uncomplicated Firewall (UFW), such as Ubuntu
- Unexpectedly, the installation script throws a Console error:
Verifying system status:
vfunction-fluentd: healthy
vfunction-mysql: healthy
vfunction-nginx: healthy
vfunction-vfapi-parser: healthy
vfunction-vfapi-idp: exited
vfunction-vfapi-measurements: unhealthy
vfunction-vfapi-organizations: exited
vfunction-vfapi-users: exited
vfunction-monit: healthy
vfunction-vfapi-otlp: healthy
vfunction-vfapi-dm: unhealthy
Something went wrong while trying to run dockers: vfunction-vfapi-idp, vfunction-vfapi-measurements, vfunction-vfapi-organizations, vfunction-vfapi-users, vfunction-vfapi-dm.
Please check logs under /var/log/vfunction or consult vFunction support
Installation finished with an error :(
- Checking the Docker Logging for one of the Unhealthy vfunction-vfapi Containers shows a Connection Timeout when trying to access the vfunction-mysql Container
docker logs vfunction-vfapi-organizations
Running organizations
+ echo 'Running organizations'
+ cd /opt/vfunction-vfapi/organizations/
+ ./organizations
{"level":"fatal","s":"organizations","time":"2025-06-20T20:15:59Z","caller":"/src/vfapi/infra/dal.go:65","message":"failed to open db: dial tcp 172.18.0.1:3306: connect: connection timed out"}
2025/06/20 20:15:59 /src/vfapi/infra/dal.go:38
[error] failed to initialize database, got error dial tcp 172.18.0.1:3306: connect: connection timed out
+ sleep 11
Steps to Resolve the Issue
The following steps can be used to resolve this issue:
- SSH to the Linux VM
- Ensure UFW is installed and enabled
apt install ufw
ufw enable
- Set UFW to allow traffic over Port 3306
ufw allow 3306
- Run the vFunction installation script again:
bash /opt/vfunction/server-installation/install.sh
### When prompted to proceed with the installation and reset all data, type "y"