GithubHelp home page GithubHelp logo

superfly / flyctl Goto Github PK

View Code? Open in Web Editor NEW
1.3K 26.0 219.0 14.19 MB

Command line tools for fly.io services

Home Page: https://fly.io

License: Apache License 2.0

Go 97.89% Shell 0.85% HTML 0.01% Makefile 0.07% Ruby 0.01% Dockerfile 0.96% PowerShell 0.16% TypeScript 0.01% Procfile 0.01% Nix 0.02% JavaScript 0.02%
flyio-tools

flyctl's Introduction

flyctl

flyctl is a command-line interface for fly.io

Note: Most installations of flyctl also alias flyctl to fly as a command name and this will become the default name in the future. During the transition, note that where you see flyctl as a command it can be replaced with fly.

Installation

Using a Package Manager

Homebrew (macOS, Linux, WSL)

brew install flyctl

To upgrade to the latest version:

brew upgrade flyctl

Install Script

Download flyctl and install into a local bin directory.

MacOS, Linux, WSL

Installing the latest version:

curl -L https://fly.io/install.sh | sh

Installing the latest pre-release version:

curl -L https://fly.io/install.sh | sh -s pre

Installing a specific version:

curl -L https://fly.io/install.sh | sh -s 0.0.200

Windows

Run the Powershell install script:

iwr https://fly.io/install.ps1 -useb | iex

Downloading from GitHub

Download the appropriate version from the Releases page of the flyctl GitHub repository.

Getting Started

  1. Sign into your fly account
fly auth login
  1. List your apps
fly apps list
  1. View app status
fly status -a {app-name}

App Settings

flyctl will attempt to use the app name from a fly.toml file in the current directory. For example, if the current directory contains this file:

$ cat fly.toml
app: banana

flyctl will operate against the banana app unless overridden by the -a flag or other app name setting in the command line.

Building on Windows

There is a simple Powershell script, winbuild.ps1, which will run the code generation for the help files, format them, and run a full build, leaving a new binary in the bin directory.

Running from branches on your local machine

Run scripts/build-dfly to build a Docker image from the current branch. Then, use scripts/dfly to run it. This assumes you are already authenticated to Fly in your local environment.

Contributing guide

See CONTRIBUTING.md

flyctl's People

Contributors

alichay avatar azazeal avatar benwaffle avatar billyb2 avatar btoews avatar codepope avatar dalperin avatar dangra avatar davissp14 avatar dependabot[bot] avatar fideloper avatar gwuah avatar haileys avatar jeromegn avatar jipperinbham avatar jphenow avatar jsierles avatar kzys avatar lubien avatar matttpt avatar michaeldwan avatar mrkurt avatar ndarilek avatar pborzenkov avatar rubys avatar rugwirobaker avatar senyosimpson avatar shortdiv avatar tqbf avatar tvdfly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flyctl's Issues

Deploying container fails due to unhealthy allocations

Hi,
I'm trying to deploy an example docker app from erlang/docker-erlang-example using flyctl deploy.

The container runs using regular docker locally, builds fine when doing flyctl deploy, but eventually fails with
Failed due to unhealthy allocations - no stable job version to auto revert to
See attached output of flyctl deploy --verbose:

docker_deploy_error.txt

Inconsistent CLI commands structure

I noticed flyctl apps had the destroy and list sub-commands, but no create. To create an app, one has to use flyctl create.

Should we move that to flyctl apps create for consistency?

Cert validation instructions for wildcards are wrong

When you add a wildcard, it instructs you to include the *. in the CNAME record, like this:

DNS Validation Instructions = CNAME _acme-challenge.*.<hostname> => <hostname>.620j.flydns.net
DNS Validation Hostname = _acme-challenge.*.<hostname>

internal_port in fly.toml should be removed

As it currently stands, the setting invites users to change it. But, changing it just breaks the deployment process by making the health checks fail. Removing health checks has no effect in the toml, so am assuming that they are hard wired in place to port 8080.

So, until we have a changable internal_port, we should remove the generation of said port number and replace with explicit direction to use port 8080 in the enclosed application.

Unknown error during deploy

Using flyctl 0.7.x, doing flyctl create or flyctl deploy with either the go-example or csharp-example I eventually get:
Error An unknown error occured.

Any ideas? I can send a copy of the strace output if that helps :)

Thanks!

Redirect http to https

Is there's a way to redirect http to https requests? otherwise, we can add a config in fly.toml for that

panic on deploy when fly.toml missing or empty

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xcf4941]
goroutine 1 [running]:
github.com/superfly/flyctl/docker.dockerfileSource(0xc0004aa3c0, 0x7, 0x0, 0x17f1df8)
    /github/workspace/docker/build.go:39 +0x91
github.com/superfly/flyctl/docker.(*DeployOperation).BuildAndDeploy(0xc0000886c0, 0xc0004aa3c0, 0x7, 0x0, 0x0, 0x0, 0x0)
    /github/workspace/docker/build.go:72 +0x23e
github.com/superfly/flyctl/cmd.runDeploy(0xc000356280, 0x0, 0x0)
    /github/workspace/cmd/deploy.go:64 +0x2cf
github.com/superfly/flyctl/cmd.BuildCommand.func1(0xc0001e7180, 0xc00048c8a0, 0x1, 0x3)
    /github/workspace/cmd/command.go:223 +0x172
github.com/spf13/cobra.(*Command).execute(0xc0001e7180, 0xc00048c7b0, 0x3, 0x3, 0xc0001e7180, 0xc00048c7b0)
    /go/pkg/mod/github.com/spf13/[email protected]/command.go:830 +0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0x17c8d80, 0xc00051ff20, 0x43b90a, 0x1776040)
    /go/pkg/mod/github.com/spf13/[email protected]/command.go:914 +0x2fb
github.com/spf13/cobra.(*Command).Execute(...)
    /go/pkg/mod/github.com/spf13/[email protected]/command.go:864
github.com/superfly/flyctl/cmd.Execute()
    /github/workspace/cmd/root.go:34 +0x66
main.main()
    /github/workspace/main.go:6 +0x20

Can't deploy local docker image

When I build a docker image locally and try to deploy it to Fly get an error

How to reproduce:

  • Build an image with docker docker build ...
  • Check the image using docker images and its there and found
  • Try to deploy it using flyctl deploy -a APP_NAME --image IMAGE_NAME

it returns

Error Unable to access image IMAGE_NAME: 401 Unauthorized

Also the same happens if I try to deploy a docker image that is located in Github's docker registry

Buildpacks seem to fail on remote builds

This works fine locally, but flyctl deploy on a buildpack app without docker running fails like so

➜  regionping git:(master) flyctl deploy
==> Validating app configuration
--> done
   Services
      TCP 80/443 ⇢ 3000
Deploy source directory '/home/kurt/code/fly.io/examples/regionping'
Docker daemon unavailable, performing remote build...
Error Project does not contain a Dockerfile or specify a builder

cc @jeromegn

Fresh deploy of docker image appears to fail with no deployment

Deploy app with -i and versioned image... reports no deployment. Check with info and that reports it is running.

Also, destroy app and recreate with same name and deployment will succeed

~/tmpdeply
❯ flyctl apps create --name proxydohtest
? Select organization: Dj (dj)
New app created
  Name     = proxydohtest
  Owner    = dj
  Version  = 0
  Status   =
  Hostname = <empty>

? Overwrite file '/Users/dj/tmpdeply/fly.toml' Yes
Wrote config file fly.toml

~/tmpdeply
❯ flyctl deploy -i flyio/doh-proxy:0.1.19
==> Validating app configuration
--> done
   Services
      TCP 80/443 ⇢ 8080
==> Creating Release
Release v0 created
==> Monitoring Deployment
You can detach the terminal anytime without stopping the deployment
No deployment available

~/tmpdeply
❯ flyctl info
App
  Name     = proxydohtest
  Owner    = dj
  Version  = 0
  Status   = running
  Hostname = proxydohtest.fly.dev

Services
  TASK   PROTOCOL   PORTS
  app    tcp        80 => 8080 [HTTP]
                    443 => 8080 [TLS, HTTP]

IP Addresses
  TYPE   ADDRESS                                CREATED AT
  v4     77.83.140.210                          10s ago
  v6     2a09:8280:1:2748:d15c:5a85:4b7f:3384   10s ago

Skip app mismatch confirmation for readonly commands

flyctl requires confirmation if the app name in fly.toml doesn't match the -a flag or FLY_APP_NAME variable. This should only apply to write commands like deploy not readonly commands like status and logs.

segfault in cli on remote build failure

Build complete - failed
==> Monitoring Deployment
You can detach the terminal anytime without stopping the deployment
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x18f4a17]
goroutine 1 [running]:
github.com/superfly/flyctl/cmd.watchDeployment(0xc0003f5400, 0x0, 0x0)
        /github/workspace/cmd/deploy.go:168 +0x517
github.com/superfly/flyctl/cmd.runDeploy(0xc0003f5400, 0x0, 0x0)
        /github/workspace/cmd/deploy.go:99 +0x72e
github.com/superfly/flyctl/cmd.BuildCommand.func1(0xc00021cf00, 0x23d5820, 0x0, 0x0)
        /github/workspace/cmd/command.go:223 +0x172
github.com/spf13/cobra.(*Command).execute(0xc00021cf00, 0x23d5820, 0x0, 0x0, 0xc00021cf00, 0x23d5820)
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:830 +0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0x23acc80, 0xc00052bf20, 0x103b2ca, 0x235a340)
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:914 +0x2fb
github.com/spf13/cobra.(*Command).Execute(...)
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:864
github.com/superfly/flyctl/cmd.Execute()
        /github/workspace/cmd/root.go:34 +0x66
main.main()
        /github/workspace/main.go:6 +0x20

deploy -i appears to lose image tag or overwrite it

Using flyctl deploy -i flyio/hellofly:first didn't generate any flyctl error but on deployment, error came back saying

Failed Allocations
  1) e65312c9 in iad
    Events
      2020-01-20T12:15:07Z   Received          Task received by client
      2020-01-20T12:15:07Z   Task Setup        Building Task Directory
      2020-01-20T12:15:08Z   Not Restarting    Error was unrecoverable
      2020-01-20T12:15:08Z   Alloc Unhealthy   Unhealthy because of failed task
      2020-01-20T12:15:08Z   Killing           Sent interrupt. Waiting 5s before force killing
      2020-01-20T12:15:08Z   Driver Failure    rpc error: code = Unknown desc = unable to create microvm: error downloading manifest: Get https://registry-1.docker.io/v2/flyio/hellofly/manifests/latest: http: non-successful response (status=404 body="{\"errors\":[{\"code\":\"MANIFEST_UNKNOWN\",\"message\":\"manifest unknown\",\"detail\":{\"Tag\":\"latest\"}}]}\n")
v3 failed - Failed due to unhealthy allocations - no stable job version to auto revert to

Note the tag showing with the microvm is latest, not first. As this didn't (at the time) exist in the repo it errored. But it wasn't pulling first but pulling latest and failing.

`flyctl dbs info <name>` fails

This is a handful of issues in one. First, an invalid hash id just shows a boring generic error:
image

Second, flyctl dbs show --help doesn't actually say you need to pass an ID through (it doesn't say anything about an arg).

Third, is there a reason for flyctl dbs show <name> to not work?

flyctl certs create ... does not provide instructions on next steps

When run, we get something like

  Hostname                    = example.com
  Configured                  = true
  Issued                      =
  Certificate Authority       = lets_encrypt
  DNS Provider                = enom
  DNS Validation Instructions =
  DNS Validation Hostname     =
  DNS Validation Target       = example.com.5xzw.flydns.net
  Source                      = fly
  Created At                  = 0001-01-01T00:00:00Z
  Status                      =

Which doesn't help progress.... later, after an unspecced time,

> flyctl certs show codepope.wtf
  Hostname                    = codepope.wtf
  Configured                  = true
  Issued                      = ecdsa, rsa
  Certificate Authority       = lets_encrypt
  DNS Provider                = enom
  DNS Validation Instructions = CNAME _acme-challenge.codepope.wtf => codepope.wtf.5xzw.flydns.net.
  DNS Validation Hostname     = _acme-challenge.codepope.wtf
  DNS Validation Target       = codepope.wtf.5xzw.flydns.net
  Source                      = fly
  Created At                  = 1m24s ago
  Status                      = Ready

Which has the desired information.

Either the command should wait until it has the information to say what next for the user to do, or it should make an immediate estimate of what's needed as instructions.

Spammy output when run on CI tools

The animated console output really spams up CI system logs now. I think it was better a month or so ago, but I could be mis-remembering.

[2020-01-19T22:05:56+00:00] Creating build context... ⣾ ������������������������������������������������������������������������������������Creating build context... ⣽ ������������������������������������������������������������������������������������Creating build context... ⣻ ������������������������������������������������������������������������������������Creating build context... ⢿ ������������������������������������������������������������������������������������Creating build context... ⡿ 

Error (Terminal coloring issues)

Seems there's some coloring issues with flyctl, not a big deal, worth noting.

I'm running flyctl_0.0.74_Windows_x86_64.tar.gz

flyctl coloring issue

Something to do with the fmt go package, not sure. :)

Log lines of just \r come back json formatted

It yields funky strings like this:

2020-02-17T23:15:07.150Z 60274011  [notice] > node server.js
2020-02-17T23:15:07.150Z 60274011  [notice] {"app":3752,"alloc":"60274011","message":"\r"}
2020-02-17T23:15:07.385Z 60274011  [notice] Pinging from ams at 2020-02-17T23:15:07.379Z

Add `--force` option to deploy command

Provide a way to abort any in-progress deployments and force a deployment through. Useful when a deployment is needed for an app that couldn't get to a healthy state.

Panic on deploy with long app name

Successfully built 4d856c12beff
[2020-01-25T09:22:12+00:00] Successfully tagged registry.fly.io/sdfjiklmasdflkjsdflkjsdflkjsdl:deployment-1579944078
[2020-01-25T09:22:12+00:00] panic: runtime error: slice bounds out of range [:76] with length 71

They retried with a shorter name and it worked just fine!

It'd be nice to use local `builder` directories

Maybe something like flyctl build --builder /path/to/my/dev/builder/.

I'm trying to make a static builder work and it's just slightly different enough from docker build to give me hives.

Soft launch `flyctl`

We need to soft launch flyctl, which is (paradoxically) mostly doing things outside of this repo. Still, a good place for a checklist. Soft launch just means we swap out the fly.io site + docs without making any yuge announcements. The primary goal for doing this is so when we start directing people to this tool, and they visit the site + login/register we don't create any nasty surprises for users

Todos

  • Prep future.fly.io: rip out stuff that's incomplete, tidy up what we're keeping
  • Make future.fly.io live
  • Move JS runtime docs to js.fly.io (or similar)
  • Fix signup flow from CLI, it seems to dump people to the dashboard with no further instructions
  • Fix signup flow from homepage, we should direct people to "how to use flyctl after they signup

Group `status` allocations by region

Allocations
  ID         VERSION   TASK   REGION   DESIRED   STATUS     CREATED
  5d987d7d   106       app    iad1     run       running    13m24s ago
  b276b308   106       app    atl1     run       running    13m26s ago
  5b81df7d   106       app    ord1     run       running    13m31s ago
  687442c2   106       app    atl1     run       running    13m34s ago
  138414c5   106       app    ord1     run       running    13m50s ago
  2ef7b382   106       app    mrs1     run       running    13m50s ago
  4259b83e   106       app    fra2     run       running    13m50s ago
  db139398   106       app    sin1     run       running    13m50s ago
  df97ab0a   106       app    iad1     run       running    13m50s ago

I'd like to see these grouped by version, region.

"Stage" secrets, only include in deploy

I'd like to be able to stage new secrets, and then roll them out as part of a deploy. We could do this by letting people specify a secrets-file for deploy.

Accept TLS handshake options in service configuration

Users should be able to specify options in a service's TLS handler. Maybe the handlers needs to be refactored to allow for options (a map) instead of just a string.

Options:

  • default servername to use to fetch a certificate if no SNI is provided or if the certificate for the provided SNI is not found
  • minimum TLS version supported (1.2 or 1.3)
  • ALPNs accepted (h2, for example)
  • Client auth CA
  • Client auth required? (maybe that's automatic if there's a CA present).

These should be stored for each service and sent alongside to nomad. They will be picked up by fly-proxy.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.