- Fly NodeJS FTP Server
A simple FTP server on node JS for Fly.io (based on ftp-srv npm package).
-
Install flyctl.
-
Install NodeJS into your PC.
-
Install Visual Studio Code application into your PC.
-
In the VS Code application, select "Clone Git Repository", insert git url, and open the folder with clonned code.
https://github.com/rybonka/fly-nodejs-ftp-server.git
-
In the VS Code terminal, install the required Node.js modules and dependencies:
npm install express ftp-srv path && npm install uuid@latest
-
Edit the
name
in thefly.toml
to one of your choice:app = "fly-nodejs-ftp-server"
-
Edit the
primary_region
and set the value of the closest fly.io region to you:primary_region = "waw"
-
The
[env]
block has anADDRESS
value. Run thefly info
command to get your app's IPv4 address, and replace213.188.xxx.xxx
with your app's IPv4 address:ADDRESS = "213.188.xxx.xxx"
Leave other configurations as they are until you understand what they mean and the effect of changing them.
-
Edit the
pasv_url
in theserver.js
. Runfly info
command to get your app's IPv4 address, and replace213.188.xxx.xxx
with your app's IPv4 address:pasv_url: "ftp://213.188.xxx.xxx"
-
Edit the
username
andpassword
in theserver.js
with desired login credentials to your FTP folder.username === 'user' && password === 'test'
This is a basic FTP server setup. Feel free to customize it according to your needs and requirements.
-
Run
flyctl launch --ha=false
in the VS code terminal.- On the question "Would you like to copy its configuration to the new app? (y/N)", select yes.
- On the question "Do you want to tweak these settings before proceeding? (y/N)", select yes.
- In the opened "Fly Launch" window, check your app launch configurations, and set:
Port = 8080
,VM Sizes = shared-cpu-1x
,VM Memory = 256MB
, click "Confirm Settings". - On the question "Create .dockerignore from 1 .gitignore files? (y/N)", select no.
$ flyctl launch --ha=false An existing fly.toml file was found for app fly-nodejs-ftp-server ? Would you like to copy its configuration to the new app? Yes ? Do you want to tweak these settings before proceeding? Yes ? Create .dockerignore from 1 .gitignore files? No Platform: machines ✓ Configuration is valid Now: run 'fly deploy' to deploy your NodeJS app.
-
Allocate dedicated IP addresses to your FTP server using the console.
- IPv6 address (free of charge):
fly ips allocate-v6
- Please decide whether you need a dedicated IPv4 (cost: $2 per month) or a shared IPv4 (free of charge, but you cannot connect to the FTP server via shared IPv4 unless your ISP supports IPv6). Run the appropriate command according to your choice, whether you need a dedicated or shared IPv4 (only 1 command):
fly ips allocate-v4
fly ips allocate-v4 --shared
-
Open
fly.toml
file in VS code, and setinternal_port = 8080
in the[http_service]
block (it has changed to3000
for some reason, so we need to restore the initial value8080
). -
Run
flyctl deploy --ha=false
to deploy your FTP server app.$ flyctl deploy --ha=false ==> Verifying app config This deployment will: * create 1 "app" machine ------- ✔ Machine e64df51a792744 [app] update finished: success
-
If you need to adjust any settings in the code, make the edits, save changes, and deploy the changes by running
flyctl deploy --ha=false
to redeploy your FTP server's code.
- Open FTP client, e.g. WinSCP (or any other FTP client) and
- in the Host Name, enter the name of your fly application defined in the
fly.toml
file plus .fly.dev (e.g.fly-nodejs-ftp-server.fly.dev
). - Port:
21
- User Name:
user
or new username defined in server.js file - Password:
test
or new password defined in server.js file
- in the Host Name, enter the name of your fly application defined in the
If you deploy the code "as is" without modifying any data in the fly.toml or server.js files, access to the FTP folder will still be available from the client side, but only if your ISP has IPv6 support.
Fly NodeJS FTP Server is licensed under the MIT License. See the LICENSE file for details. Feel free to copy and use it as you wish.
If you encounter issues or wish to contribute to Fly NodeJS FTP Server application, please open an issue or submit a pull request. Thank you.