Setup FRP server on Heroku and Client on Local (Ubuntu currently). Support FRP server on Ubuntu as well and other alternatives.
Note:
Currently, we need two ports to build communication between frps and frpc, but Heroku don't support self-defined port...
Additional sad news. Since November 28, 2022, Heroku no longer offers its users a free tier or free Dynos...
# Install on Ubuntu
sudo snap install --classic heroku
# Check Installation
heroku --version
# Login
heroku login
IMPORTANT: Heroku dynamically assigns your app a port, so you can't set the port to a fixed number.
Deploy Button
# View logs
$ heroku logs --tail
# List the dynos for an app
$ heroku ps
Free dyno hours quota remaining this month: 550h 0m (100%)
Free dyno usage for this app: 0h 0m (0%)
For more information on dyno sleeping and how to upgrade, see:
https://devcenter.heroku.com/articles/dyno-sleeping
# If an app is down, you can restart it (assume it's web.1)
heroku restart web.1
This is the server you want to use as a springboard
# Create new app
$ heroku create your-server-name
Creating ⬢ your-server-name... done
https://your-server-name.herokuapp.com/ | https://git.heroku.com/your-server-name.git
# Stack the app to `container`
heroku stack:set container
# Check current git remote
git remote -v
# Upload changes to Github
git push origin master
# Upload changes to Heroku
git push heroku master
Check the logs to see if the survice is running,
and because Heroku automatically bind the port,
so you may want to check the port so that you can set the frpc.ini
heroku logs --app=your-server-name
Server setting
...
If want to use the docker for Heroku outside of Heroku, remember to add
-e PORT=7000
argument and open necessary ports (e.g. 7000, 6000)
This is the computer you want to connect to
# Setup binary executables
bash get_frp_local.sh
Now you should be able to use frps
and frpc
.
Change settings in frpc.ini
to your heroku address.
# Start client
frpc -c frpc.ini
better run with
tmux
Setup Systemd Service to Auto Start on Reboot (optional but recommend)
# Copy configure file and start frpc
bash setup_frp_client_systemd.sh
# Stop service
systemctl stop frpc.service
This is the server you want to use as a springboard
cd UbuntuFRPServer
# Install docker first (https://gist.github.com/daviddwlee84/9ba69aa231a19be54b6f09ae0d158683#file-install_docker-sh) bash install_docker.sh
# Build docker image
docker build -t frp .
# Run server
docker run -d -p 7000:7000 -p 6000:6000 -p 7500:7500 frp
Assume you already got
frps
binaries, otherwise checkout here.
# Start server
frps -c frps.ini
better run with
tmux
# Copy configure file and start frps
bash setup_frp_server_systemd.sh
# Stop service
systemctl stop frps.service
# After modify /etc/frpc.ini, restart the frpc
systemctl restart frpc.service
Make sure you have enable script executing
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope LocalMachine
(Run as administrator)And there is potential that Windows thinks the
frp*.exe
is a virus. This is how to configure:
- Search "Virus & threat protection"
- Goto "Virus & threat protection settings" and click "Manage settings"
- Goto "Exclusions" and click "Add or remove exclusions"
- Add this folder (i.e. the repository directory) (because sometime it delete
*.zip
right away)- Add "C:\frp" (default install path of my script)
# Setup binary executables & Auto run FRPC at system startup (run as administrator)
./setup_frp_windows.ps1
# Check scheduled jobs
ScheduledJob
# Unregister job
Unregister-ScheduledJob -Name FRPC
# To kill background service (run as administrator)
Get-Process frpc
Stop-Process -Id xx
Connect SSH
ssh -oPort=6000 username@frp-server-ip-address
# equivalent
ssh -p 6000 username@frp-server-ip-address
If you setup with FRP Server - Ubuntu
Go to http://frp-server-ip-address:7500
and login with admin
for both account and password.
must set either
custom_domains
orsubdomain
for http or httpscustom_domains and subdomain should set at least one of them
otherwise, you can just use tcp
Use type tcp
.
Or set custom_domains = { server_addr }
.
Expose necessary port without using FRP
Check out here.
Works in Windows
# Add
netsh interface portproxy add v4tov4 listenaddress=localaddress listenport=localport connectaddress=destaddress connectport=destport
# Remove
netsh interface portproxy delete v4tov4 listenaddress=localaddress listenport=localport
(TODO) seems frp doesn't support special reference parsing
from configparser import ConfigParser, ExtendedInterpolation
config = ConfigParser(interpolation=ExtendedInterpolation())
config.read('frpc.ini')
config['http']['custom_domains']
frpc
?!frpc.ini
(& http
connection as well)Heroku
General
Official
git update-index --assume-unchanged frpc.ini