FtpServer icon indicating copy to clipboard operation
FtpServer copied to clipboard

Google Cloud Storage as file system

Open sebastianbk opened this issue 6 years ago • 1 comments

Hi,

I implemented Google Cloud Storage as a backend in this project and, just as I published it, I realized it would probably be a much better idea to just include it in your project.

Could you help me out make the changes required and create the pull request? The bulk of the work is already done, as all of the interfaces have already been implemented and tested.

If needed, I could provide a Google Cloud Storage bucket for testing.

Looking forward to hearing from you. :smiley:

sebastianbk avatar May 14 '19 06:05 sebastianbk

Hi,

your project looks really good.

Here are my thoughts to make it easier for others to use:

Prepare for FTP server V3.0

It would be good if you could target the latest 3.0 rc of the FTP server.

Server application

Maybe you can create the "GcsFtpServer" as additional sample application with a docker file? A README.md would be good too 😁 .

Docker support

It would be nice if you could load the following from the file system:

  • Server configuration
  • PKCS#12 container (X509 certificate/PFX file)
  • Logger configuration
  • my-service-account.json for the GCS StorageClient

Ideally, the server should load the files from Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "GcsFtpServer").

BTW: You can use EXPOSE 10000-10009 in the docker file.

This should be the goal for using the docker container:

cd samples/GcsFtpServer
dotnet publish -c Release
docker build -t sebastianbk/google-storage-ftp .
docker run -it \
    -p 21:21 \
    -p 10000-10009:10000-10009 \
    -v /usr/share/GcsFtpServer \
    sebastianbk/google-storage-ftp \
    ftpserver

The FTP server always uses port 21. It doesn't use ports 989/990 or port 20 (yet), but port 20 is only used for active connections, which usually doesn't work.

Configuration

I think that it might be beneficial if you could leverage Microsoft.Extensions.Configuration for configuring the application.

You could also use:

  • Microsoft.Extensions.Configuration.Json for the server configuration
  • Microsoft.Extensions.Configuration.EnvironmentVariables for overriding the server configuration from the environment variable
  • Microsoft.Extensions.Options for GCS options (e.g. [BUCKET-NAME]) loaded from the server configuration

The configuration file should cover the following parts:

  • Server configuration (external IP, port range?)
  • GCS configuration ([BUCKET-NAME], StorageClient?)
  • TLS support (enable/disable, PKCS#12 file name)

Logging

  • Optionally enable logging to "Stackdriver Logging"
  • Optionally enable logging to file (which can be redirected to the host file system)
  • Console logging enabled (optional?)

Authorization (membership provider)

I'm not sure what the best solution would be. I guess that supporting a build variable or environment variable to configure the password might or might not be sufficient.

fubar-coder avatar May 14 '19 08:05 fubar-coder