-
-
Notifications
You must be signed in to change notification settings - Fork 1
use fly api to create exit nodes #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jsiebens
wants to merge
5
commits into
main
Choose a base branch
from
cloud-provision
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,96 +1,43 @@ | ||
| # inlets-on-fly | ||
|
|
||
| inlets-on-fly automates the task of creating an [inlets Pro](https://inlets.dev) exit-server (tunnel server) on the [fly.io](https://fly.io) platform. | ||
| inlets-on-fly automates the task of creating an [inlets Pro](https://inlets.dev) HTTP exit-server (tunnel server) on the [fly.io](https://fly.io) platform. | ||
|
|
||
| This automation started as a bash script which you can find [here](https://gist.github.com/jsiebens/4cf66c135ecefe8638c06a16c488b201) | ||
|
|
||
| Read more in the blog post [Run an inlets Pro tunnel server for free on fly.io](https://inlets.dev/blog/2021/07/07/inlets-fly-tutorial.html) | ||
|
|
||
| ## Pre-requisites | ||
|
|
||
| inlets-on-fly is actually a little wrapper around flyctl, so make sure you have that CLI installed and that you are authenticated. | ||
| inlets-on-fly make HTTP requests to the Fly.io API, so make sure you grab an api token using the flyctl CLI tool. | ||
|
|
||
| - [Installing flyctl](https://fly.io/docs/hands-on/install-flyctl/) | ||
| - [Login To Fly](https://fly.io/docs/getting-started/log-in-to-fly/) | ||
| - [flyctl auth token](https://fly.io/docs/flyctl/auth-token/) | ||
|
|
||
| ## Example | ||
|
|
||
| ``` bash | ||
| $ inlets-on-fly create tcp --region ams --ports 5432,6379 | ||
| Temp dir name: /tmp/inletsfly-486952897 | ||
|
|
||
| Selected App Name: enjoyed-goldfish-6269 | ||
|
|
||
|
|
||
| New app created: enjoyed-goldfish-6269 | ||
| Region Pool: | ||
| ams | ||
| Backup Region: | ||
| fra | ||
| lhr | ||
| Secrets are staged for the first deployment | ||
| Deploying enjoyed-goldfish-6269 | ||
| ==> Validating app configuration | ||
| --> Validating app configuration done | ||
| Services | ||
| TCP 8123 ⇢ 8123 | ||
| TCP 5432 ⇢ 5432 | ||
| TCP 6379 ⇢ 6379 | ||
| ==> Creating build context | ||
| --> Creating build context done | ||
| ==> Building image with Docker | ||
| --> docker host: 20.10.7 linux x86_64 | ||
| Sending build context to Docker daemon 3.072kB | ||
| Step 1/2 : FROM ghcr.io/inlets/inlets-pro:0.9.1 | ||
| ---> 68840e710735 | ||
| Step 2/2 : CMD ["tcp", "server", "--auto-tls-san=enjoyed-goldfish-6269.fly.dev", "--token-env=TOKEN"] | ||
| ---> Running in 16d95f141336 | ||
| ---> a1b634947187 | ||
| Successfully built a1b634947187 | ||
| Successfully tagged registry.fly.io/enjoyed-goldfish-6269:deployment-1641658112 | ||
| --> Building image done | ||
| ==> Pushing image to fly | ||
| The push refers to repository [registry.fly.io/enjoyed-goldfish-6269] | ||
| 8345a2e5488b: Preparing | ||
| c0d270ab7e0d: Preparing | ||
| c0d270ab7e0d: Mounted from grand-tortoise-6149 | ||
| 8345a2e5488b: Mounted from grand-tortoise-6149 | ||
| deployment-1641658112: digest: sha256:9cfddad45c6b112714e8c607219ed1907e14d4a5dc5611d6dc4d07f402bf9507 size: 738 | ||
| --> Pushing image done | ||
| Image: registry.fly.io/enjoyed-goldfish-6269:deployment-1641658112 | ||
| Image size: 19 MB | ||
| ==> Creating release | ||
| Release v2 created | ||
|
|
||
| You can detach the terminal anytime without stopping the deployment | ||
| Monitoring Deployment | ||
|
|
||
| v0 is being deployed | ||
| c7a5572c: ams pending | ||
| c7a5572c: ams running unhealthy [health checks: 1 total] | ||
| c7a5572c: ams running healthy [health checks: 1 total, 1 passing] | ||
| --> v0 deployed successfully | ||
| ================================================================== | ||
| inlets PRO TCP (enjoyed-goldfish-6269) server summary: | ||
|
|
||
| URL: wss://enjoyed-goldfish-6269.fly.dev:8123/connect | ||
| Auth-token: aDdfDfl5uu4pmYzTxG066uLcosnkyyF27OQFCryZTWaAA2r8qCTbob8CErCnJOYm | ||
| $ export FLY_API_TOKEN=$(fly auth token) | ||
| $ inlets-on-fly create | ||
| Host: smooth-honeybee-3106/3d8dd15ce95589, status: created | ||
| [1/500] Host: smooth-honeybee-3106/3d8dd15ce95589, status: active | ||
| inlets Pro HTTPS (0.9.9) server summary: | ||
| IP: smooth-honeybee-3106.fly.dev | ||
| HTTPS Domains: .fly.dev | ||
| Auth-token: sNAZK3MxnAPdcOfIGIsR2yIZpEB6qa5IYRlJ9G4kiB9D8AYydFSoiY2QFox9Hwym | ||
|
|
||
| Command: | ||
|
|
||
| # Obtain a license at https://inlets.dev | ||
| # Obtain a license at https://inlets.dev/pricing | ||
| # Store it at $HOME/.inlets/LICENSE or use --help for more options | ||
|
|
||
| # Where to route traffic from the inlets server | ||
| export UPSTREAM="http://127.0.0.1:8000" | ||
|
|
||
| export PORTS="5432,6379," | ||
| export UPSTREAM="localhost" | ||
|
|
||
| inlets-pro tcp client \ | ||
| --url wss://enjoyed-goldfish-6269.fly.dev:8123 \ | ||
| --token aDdfDfl5uu4pmYzExG066uLcosnkyRF27OQFCryZTWaAA2r8qCTbob8CErCnJOYm \ | ||
| --upstream $UPSTREAM \ | ||
| --ports $PORTS | ||
|
|
||
| inlets-pro http client --url "wss://smooth-honeybee-3106.fly.dev:8123" \ | ||
| --token "sNAZK3MxnAPdcOfIGIsR2yIZpEB6qa5IYRlJ9G4kiB9D8AYydFSoiY2QFox9Hwym" \ | ||
| --upstream $UPSTREAM | ||
|
|
||
| To delete: | ||
| flyctl destroy enjoyed-goldfish-6269 | ||
| inlets-on-fly delete --id "smooth-honeybee-3106/3d8dd15ce95589" | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,104 @@ | ||
| module github.com/jsiebens/inlets-on-fly | ||
|
|
||
| go 1.17 | ||
| go 1.18 | ||
|
|
||
| require ( | ||
| github.com/alexellis/go-execute v0.5.0 | ||
| github.com/Khan/genqlient v0.5.0 | ||
| github.com/dustinkirkland/golang-petname v0.0.0-20191129215211-8e5a1ed0cff0 | ||
| github.com/fly-apps/terraform-provider-fly v0.0.16 | ||
| github.com/hashicorp/terraform-plugin-log v0.7.0 | ||
| github.com/imroc/req/v3 v3.22.0 | ||
| github.com/inlets/cloud-provision v0.6.0 | ||
| github.com/miekg/dns v1.1.50 | ||
| github.com/sethvargo/go-password v0.2.0 | ||
| github.com/spf13/cobra v1.2.1 | ||
| golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d | ||
| golang.zx2c4.com/wireguard v0.0.0-20220407013110-ef5c587f782d | ||
| golang.zx2c4.com/wireguard/tun/netstack v0.0.0-20220407013110-ef5c587f782d | ||
| ) | ||
|
|
||
| require ( | ||
| cloud.google.com/go/compute v1.7.0 // indirect | ||
| github.com/Azure/azure-sdk-for-go v59.2.0+incompatible // indirect | ||
| github.com/Azure/go-autorest v14.2.0+incompatible // indirect | ||
| github.com/Azure/go-autorest/autorest v0.11.22 // indirect | ||
| github.com/Azure/go-autorest/autorest/adal v0.9.18 // indirect | ||
| github.com/Azure/go-autorest/autorest/azure/auth v0.5.9 // indirect | ||
| github.com/Azure/go-autorest/autorest/azure/cli v0.4.5 // indirect | ||
| github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect | ||
| github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect | ||
| github.com/Azure/go-autorest/autorest/validation v0.3.1 // indirect | ||
| github.com/Azure/go-autorest/logger v0.2.1 // indirect | ||
| github.com/Azure/go-autorest/tracing v0.6.0 // indirect | ||
| github.com/aws/aws-sdk-go v1.44.75 // indirect | ||
| github.com/beorn7/perks v1.0.1 // indirect | ||
| github.com/cespare/xxhash/v2 v2.1.2 // indirect | ||
| github.com/digitalocean/godo v1.83.0 // indirect | ||
| github.com/dimchansky/utfbom v1.1.1 // indirect | ||
| github.com/dirien/ovh-go-sdk v0.1.1 // indirect | ||
| github.com/fatih/color v1.13.0 // indirect | ||
| github.com/fsnotify/fsnotify v1.5.4 // indirect | ||
| github.com/go-resty/resty/v2 v2.1.1-0.20191201195748-d7b97669fe48 // indirect | ||
| github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect | ||
| github.com/golang-jwt/jwt/v4 v4.2.0 // indirect | ||
| github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect | ||
| github.com/golang/mock v1.6.0 // indirect | ||
| github.com/golang/protobuf v1.5.2 // indirect | ||
| github.com/google/btree v1.0.1 // indirect | ||
| github.com/google/go-querystring v1.1.0 // indirect | ||
| github.com/google/uuid v1.3.0 // indirect | ||
| github.com/googleapis/enterprise-certificate-proxy v0.1.0 // indirect | ||
| github.com/googleapis/gax-go/v2 v2.4.0 // indirect | ||
| github.com/hashicorp/errwrap v1.1.0 // indirect | ||
| github.com/hashicorp/go-cleanhttp v0.5.2 // indirect | ||
| github.com/hashicorp/go-hclog v1.2.2 // indirect | ||
| github.com/hashicorp/go-multierror v1.1.1 // indirect | ||
| github.com/hashicorp/go-retryablehttp v0.7.1 // indirect | ||
| github.com/hetznercloud/hcloud-go v1.35.2 // indirect | ||
| github.com/inconshreveable/mousetrap v1.0.0 // indirect | ||
| github.com/jmespath/go-jmespath v0.4.0 // indirect | ||
| github.com/linode/linodego v1.9.1 // indirect | ||
| github.com/lucas-clemente/quic-go v0.29.0 // indirect | ||
| github.com/marten-seemann/qpack v0.2.1 // indirect | ||
| github.com/marten-seemann/qtls-go1-16 v0.1.5 // indirect | ||
| github.com/marten-seemann/qtls-go1-17 v0.1.2 // indirect | ||
| github.com/marten-seemann/qtls-go1-18 v0.1.2 // indirect | ||
| github.com/marten-seemann/qtls-go1-19 v0.1.0 // indirect | ||
| github.com/mattn/go-colorable v0.1.13 // indirect | ||
| github.com/mattn/go-isatty v0.0.16 // indirect | ||
| github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect | ||
| github.com/mitchellh/go-homedir v1.1.0 // indirect | ||
| github.com/nxadm/tail v1.4.8 // indirect | ||
| github.com/onsi/ginkgo v1.16.5 // indirect | ||
| github.com/ovh/go-ovh v1.1.0 // indirect | ||
| github.com/packethost/packngo v0.25.0 // indirect | ||
| github.com/pkg/errors v0.9.1 // indirect | ||
| github.com/prometheus/client_golang v1.13.0 // indirect | ||
| github.com/prometheus/client_model v0.2.0 // indirect | ||
| github.com/prometheus/common v0.37.0 // indirect | ||
| github.com/prometheus/procfs v0.8.0 // indirect | ||
| github.com/rogpeppe/go-internal v1.9.0 // indirect | ||
| github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9 // indirect | ||
| github.com/spf13/pflag v1.0.5 // indirect | ||
| github.com/vektah/gqlparser/v2 v2.5.0 // indirect | ||
| github.com/vultr/govultr/v2 v2.17.2 // indirect | ||
| go.opencensus.io v0.23.0 // indirect | ||
| golang.org/x/exp v0.0.0-20220827204233-334a2380cb91 // indirect | ||
| golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect | ||
| golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b // indirect | ||
| golang.org/x/oauth2 v0.0.0-20220808172628-8227340efae7 // indirect | ||
| golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64 // indirect | ||
| golang.org/x/text v0.3.7 // indirect | ||
| golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect | ||
| golang.org/x/tools v0.1.12 // indirect | ||
| golang.zx2c4.com/wintun v0.0.0-20211104114900-415007cec224 // indirect | ||
| google.golang.org/api v0.92.0 // indirect | ||
| google.golang.org/appengine v1.6.7 // indirect | ||
| google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc // indirect | ||
| google.golang.org/grpc v1.49.0 // indirect | ||
| google.golang.org/protobuf v1.28.1 // indirect | ||
| gopkg.in/ini.v1 v1.66.6 // indirect | ||
| gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect | ||
| gopkg.in/yaml.v2 v2.4.0 // indirect | ||
| gvisor.dev/gvisor v0.0.0-20211020211948-f76a604701b6 // indirect | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used this to create a TCP exit server previously, so that I could expose SSH. Having TCP would make it useful for inlets-operator too.