Skip to content

Commit df173c0

Browse files
authored
Merge pull request fly-apps#1 from rugwirobaker/update-docs
Docs use flyctl launch
2 parents bb861b4 + e579a2f commit df173c0

File tree

1 file changed

+38
-31
lines changed

1 file changed

+38
-31
lines changed

Diff for: README.md

+38-31
Original file line numberDiff line numberDiff line change
@@ -73,79 +73,86 @@ We are ready to start working with Fly and that means we need `flyctl`, our CLI
7373

7474
## _Configure the App for Fly_
7575

76-
Each Fly application needs a `fly.toml` file to tell the system how we'd like to deploy it. That file can be automatically generated with the command `flyctl init` command. We are going to use one of Fly's builtin deployment configurations for python
76+
Each Fly application needs a `fly.toml` file to tell the system how we'd like to deploy it. That file can be automatically generated with the command `flyctl launch` command. We are going to use one of Fly's builtin deployment configurations for Python.
7777

7878
```cmd
79-
flyctl init
79+
flyctl launch
8080
```
8181
```output
82-
? App Name (leave blank to use an auto-generated name) hellofly-python
83-
84-
? Select organization: demo (demo)
85-
86-
? Select builder: python
87-
Python builtin
88-
Builtins use port 8080
89-
New app created
90-
Name = hellofly-python
91-
Organization = personal
92-
Version = 0
93-
Status =
94-
Hostname = <empty>
95-
96-
App will initially deploy to lhr (London, United Kingdom) region
97-
82+
Creating app in /<path>/python-hellofly-flask
83+
Scanning source code
84+
Detected a Python app
85+
Using the following build configuration:
86+
Builder: paketobuildpacks/builder:base
87+
Selected App Name:
88+
? Select region: lhr (London, United Kingdom)
89+
Created app hellofly-flask in organization personal
9890
Wrote config file fly.toml
91+
We have generated a simple Procfile for you. Modify it to fit your needs and run "fly deploy" to deploy your application.
9992
```
10093

10194
You'll be asked for an application name first. We recommend that you go with the autogenerated names for apps to avoid namespace collisions. We're using `hellofly-python` here so you can easily spot it in configuration files.
10295

103-
Next you'll be prompted for an organization. Organizations are a way of sharing applications between Fly users. When you are asked to select an organization, there should be one with your account name; this is your personal organization. Select that.
96+
Next you'll be prompted for an organization. Organizations allow sharing applications between Fly users. When you are asked to select an organization, there should be one with your account name; this is your personal organization. Select that.
10497

105-
Flyctl also asks you to select a builder. Builders are responsible for constructing the Docker image of your application which is then deployed to Fly's Firecracker VMs. The simplest to use are the builtin builders, which we recommend you use here. Select Python (Python Builtin). If you want to know more about the various builders, see [_Builders and Fly_](/docs/reference/builders/).
98+
Now `flyctl launch` will generate a sample `Procfile` and `fly.toml`, which together will define how fly deploys and launches the application.
10699

107-
One thing to know about the builtin Python builder is that it will automatically copy over the contents of the directory to the deployable image. This is how you can move static assets such as templates and other files to your application. The other thing to know is that it uses a Procfile to run the application; Procfiles are used on other platforms to deploy Python applications so we keep it simple. The Procfile contains instructions for starting the application. Here's the contents of ours:
100+
Update the `Procfile` to look like this:
108101

109102
```Procfile
110103
web: gunicorn hellofly:app
111104
```
112105

113-
This says the web component of the application is served by `gunicorn` (which we mentioned earlier when talking about dependencies) and that should run the hellofly Flask app as we set up for Flask.
106+
This says the web component of the application is served by `gunicorn` (which we mentioned earlier when talking about dependencies) and that it should run the `hellofly` Flask app.
114107

115108
## _Inside `fly.toml`_
116109

117-
The `fly.toml` file now contains a default configuration for deploying your app. In the process of creating that file, `flyctl` has also created a Fly-side application slot of the same name, `hellofly`. If we look at the `fly.toml` file we can see the name in there:
110+
The `fly.toml` file now contains a default configuration for deploying your app. In the process of creating that file, `flyctl` has also created a Fly-side application slot of the same name, `hellofly-python`. If we look at the `fly.toml` file we can see the name in there:
118111

119112
```toml
120-
# fly.toml file generated for hellofly-python on 2021-01-13T15:21:15Z
113+
# fly.toml file generated for hellofly-python on 2021-11-30T17:37:33+02:00
121114

122115
app = "hellofly-python"
123116

124-
[build]
125-
builtin = "python"
126-
127117
kill_signal = "SIGINT"
128118
kill_timeout = 5
119+
processes = []
120+
121+
[build]
122+
builder = "paketobuildpacks/builder:base"
123+
124+
[env]
125+
PORT = "8080"
126+
127+
[experimental]
128+
allowed_public_ports = []
129+
auto_rollback = true
129130

130131
[[services]]
132+
http_checks = []
131133
internal_port = 8080
134+
processes = ["app"]
132135
protocol = "tcp"
136+
script_checks = []
133137

134138
[services.concurrency]
135139
hard_limit = 25
136140
soft_limit = 20
141+
type = "connections"
137142

138143
[[services.ports]]
139144
handlers = ["http"]
140-
port = "80"
145+
port = 80
141146

142147
[[services.ports]]
143148
handlers = ["tls", "http"]
144-
port = "443"
149+
port = 443
145150

146151
[[services.tcp_checks]]
147-
interval = 10000
148-
timeout = 2000
152+
grace_period = "1s"
153+
interval = "15s"
154+
restart_limit = 0
155+
timeout = "2s"
149156
```
150157

151158
The `flyctl` command will always refer to this file in the current directory if it exists, specifically for the `app` name/value at the start. That name will be used to identify the application to the Fly service. The rest of the file contains settings to be applied to the application when it deploys.

0 commit comments

Comments
 (0)