You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+38-31
Original file line number
Diff line number
Diff line change
@@ -73,79 +73,86 @@ We are ready to start working with Fly and that means we need `flyctl`, our CLI
73
73
74
74
## _Configure the App for Fly_
75
75
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.
77
77
78
78
```cmd
79
-
flyctl init
79
+
flyctl launch
80
80
```
81
81
```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
98
90
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.
99
92
```
100
93
101
94
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.
102
95
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.
104
97
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.
106
99
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:
108
101
109
102
```Procfile
110
103
web: gunicorn hellofly:app
111
104
```
112
105
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.
114
107
115
108
## _Inside `fly.toml`_
116
109
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:
118
111
119
112
```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
121
114
122
115
app = "hellofly-python"
123
116
124
-
[build]
125
-
builtin = "python"
126
-
127
117
kill_signal = "SIGINT"
128
118
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
129
130
130
131
[[services]]
132
+
http_checks = []
131
133
internal_port = 8080
134
+
processes = ["app"]
132
135
protocol = "tcp"
136
+
script_checks = []
133
137
134
138
[services.concurrency]
135
139
hard_limit = 25
136
140
soft_limit = 20
141
+
type = "connections"
137
142
138
143
[[services.ports]]
139
144
handlers = ["http"]
140
-
port = "80"
145
+
port = 80
141
146
142
147
[[services.ports]]
143
148
handlers = ["tls", "http"]
144
-
port = "443"
149
+
port = 443
145
150
146
151
[[services.tcp_checks]]
147
-
interval = 10000
148
-
timeout = 2000
152
+
grace_period = "1s"
153
+
interval = "15s"
154
+
restart_limit = 0
155
+
timeout = "2s"
149
156
```
150
157
151
158
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