FTP route from nodejs ftp-srv

Hey everyone,

we're using traefik to rproxy resources on a cluster,
and on one of the containers need to establish an FTP server,
which works ok and can connect + upload files when running locally.
The ftp server runs on nodejs ftp-srv - npm

We were able to list container on traefik dashboard at TCP tab but it ends marked with an error where it states: Router Details
STATUS
Error
PROVIDER Docker
RULE HostSNI(*)
NAME ftp@docker
SERVICE ftp-service
ERRORS:
entryPoint "other" doesn't exist
no valid entryPoint for this router

The labels on the container Dockerfile for FTP are as follows:
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="21"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65500"
LABEL traefik.tcp.routers.ftp.service="ftp-service"
LABEL traefik.tcp.routers.ftp.entrypoints="other"
LABEL traefik.tcp.routers.ftp.rule="HostSNI(*)"

The FTP service is running and can see flow on console when running it on nodejs,
this is the error comming from Filezilla FTP Client: 500 The given address is not yours (Error: Failed to retrieve directory listing).
And this is the error occurring on nodejs console "SocketError: The given address is not yours.

As additional info, I'm running this on a domain I've dnsmasqed with 127.0.0.1 domain.com, so the docker container can be reached on that domain. any clue would be really helpful, thanks.

Hi @gmesml

Where is the definition of the endpoint other? Is it in a static configuration file that wasn't mounted correctly?

We're building the images using this Dockerfile:

FROM node:14.16-alpine3.12
WORKDIR /usr/src/app
LABEL traefik.enable="true"
LABEL traefik.http.services.ftp.loadbalancer.server.port="3300"
LABEL traefik.http.routers.ftp.rule="PathPrefix(`/`, `/rest`)"
LABEL traefik.http.routers.ftp.priority="10"
LABEL traefik.http.routers.ftp.entrypoints="web"
LABEL traefik.http.routers.ftp.tls="false"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="21"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65500"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65501"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65502"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65503"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65504"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65505"
LABEL traefik.tcp.routers.ftp.service="ftp-service"
LABEL traefik.tcp.routers.ftp.entrypoints="other"
LABEL traefik.tcp.routers.ftp.rule="HostSNI(`*`)"
ENV NODE_ENV=development
EXPOSE 3300
EXPOSE 21/tcp
EXPOSE 65500-65505
CMD [ "npm", "run" , "start:dev" ]

then run a container like this:

docker run -it --network internal --name ftp -p 3300:3300 -p 21:21 -v "$(pwd)":/usr/src/app ftpimage

I don't know where the definition of endpoint/entrypoint other is, though tried to replace it with ftp, am just assuming the endpoints are predefined.

I'm new to traefik and trying to understand how it does rproxy services.

You'll have to define the entrypoint in traefik's static configuration. The only default one is http on port 80 (checked on v2.4).

https://doc.traefik.io/traefik/routing/entrypoints/

This won't work as you're expecting:

LABEL traefik.tcp.services.ftp.loadbalancer.server.port="21"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65500"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65501"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65502"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65503"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65504"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65505"

You're just redefining the same label over and over.

I'm pretty sure for this to even have a chance of working you will need an entrypoint,router and service for each passive port you are using as well as port 21 for each too. It will be a lot of labels.

/aside Why FTP ?

I was following this github issue:

On this Dockerfile I'm just adding trafeik labels for one of the containers which is this ftp,
on the other hand on main traefik server I can see this definitions:

[entryPoints]
  [entryPoints.web]
    address = ":80"
  [entryPoints.websecure]
    address = ":443"

Would adding ftp here with port 21 solve the matter? (Going to try)
I thought having indefinite labels would make no probs when it comes to trafeik reading labels from other docker containers ? Am I wrong?

When there's different systems being integrated there are some old software running on ftp and insecure protocols and trying to make some retrofit integration to modern software...

Thanks a lot for the last sentence, it was quite instructive.

Digging the Traefik server configs I was able to open the route services on entrypoints,
now I'm getting range error from FTP Server!
RangeError [ERR_SOCKET_BAD_PORT]: options.port should be >= 0 and < 65536.

Indeed there need to be pairs for port service and entrypoint.

As you can see in the referenced issue, an entrypoint is created for each port:

      - --entrypoints.entrypoint-ftp.address=:21
      - --entrypoints.entrypoint-ftp-passive-0.address=:30000
      - --entrypoints.entrypoint-ftp-passive-1.address=:30001
      - --entrypoints.entrypoint-ftp-passive-2.address=:30002
      - --entrypoints.entrypoint-ftp-passive-3.address=:30003
      - --entrypoints.entrypoint-ftp-passive-4.address=:30004
      - --entrypoints.entrypoint-ftp-passive-5.address=:30005
      - --entrypoints.entrypoint-ftp-passive-6.address=:30006
      - --entrypoints.entrypoint-ftp-passive-7.address=:30007
      - --entrypoints.entrypoint-ftp-passive-8.address=:30008
      - --entrypoints.entrypoint-ftp-passive-9.address=:30009
      ...

And likewise in the router rules and services, note that each one has an incrementing value on the label.

- traefik.tcp.routers.router-ftp.entrypoints=entrypoint-ftp
      - traefik.tcp.routers.router-ftp.rule=HostSNI(`*`)
      - traefik.tcp.routers.router-ftp.service=service-ftp
    
      - traefik.tcp.routers.router-ftp-passive-0.entrypoints=entrypoint-ftp-passive-0
      - traefik.tcp.routers.router-ftp-passive-0.rule=HostSNI(`*`)
      - traefik.tcp.routers.router-ftp-passive-0.service=service-ftp-passive-0

      - traefik.tcp.routers.router-ftp-passive-1.entrypoints=entrypoint-ftp-passive-1
      - traefik.tcp.routers.router-ftp-passive-1.rule=HostSNI(`*`)
      - traefik.tcp.routers.router-ftp-passive-1.service=service-ftp-passive-1
...
...
...
  - traefik.tcp.services.service-ftp.loadbalancer.server.port=21

      - traefik.tcp.services.service-ftp-passive-0.loadbalancer.server.port=30000
      - traefik.tcp.services.service-ftp-passive-1.loadbalancer.server.port=30001
      - traefik.tcp.services.service-ftp-passive-2.loadbalancer.server.port=30002
...
1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.