fly.io-rails 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -169
- data/lib/fly.io-rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a1ac6e55674cfe46c74c4e2f0d4ded6c3787d1dd44d1fd58317f659bf25d201
|
4
|
+
data.tar.gz: eb4403004d3f6fcc9e12b533c62e835b3e4e777d1a810f1cca3f9019a61f47b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0d1d21bb997e5fc5f37a3d6a9975b4572c5bdc31d9f85b1a28010d6cf2d8add6e08dcf7ebdb629377c05517114a5750c0b8a8a3d6145373c613de80bfc99064
|
7
|
+
data.tar.gz: 3e4eb5afd2fa7f080d3a42f8c6e3f49a059c143a4a1a9b38e4e315e40e37988c8793054769b7cf729cc51052178eab07b3084e9af5c07e6997fb2c3b09b9aaab
|
data/README.md
CHANGED
@@ -6,26 +6,7 @@ Add [Fly.io](https://fly.io) support to [Rails](https://rubyonrails.org/).
|
|
6
6
|
|
7
7
|
<u>pre-alpha</u>.
|
8
8
|
|
9
|
-
|
10
|
-
repository as while creating a github repository is an easily reversible act,
|
11
|
-
wiping all memory of a mis-named gem is considerably more challenging.
|
12
|
-
|
13
|
-
It currently is possible to build the gem files, install the prerequisite
|
14
|
-
`ruby-fly` gem, and then install the platform specific gem using `--local`.
|
15
|
-
You can also add the gem to your Gemfile using the `path:` argument to the
|
16
|
-
`gem` statement/method call. Of course, all of this will be taken care of
|
17
|
-
for you once this gem has been published.
|
18
|
-
|
19
|
-
## Quickstart/summary
|
20
|
-
|
21
|
-
```sh
|
22
|
-
rails new demo
|
23
|
-
cd demo
|
24
|
-
bundle add fly.io-rails
|
25
|
-
flyctl auth login
|
26
|
-
bin/rails fly:launch
|
27
|
-
bin/rails deploy
|
28
|
-
```
|
9
|
+
For usage instructions, see [Fly.io Rails Advanced Guide: Terraform](https://fly.io/docs/rails/advanced-guides/terraform/).
|
29
10
|
|
30
11
|
## Build instructions
|
31
12
|
|
@@ -38,152 +19,3 @@ every supported platform as well as an additional gem that doesn't
|
|
38
19
|
include a binary.
|
39
20
|
|
40
21
|
To download new binaries, run `rake clobber` then `rake package` agein.
|
41
|
-
|
42
|
-
## Description
|
43
|
-
|
44
|
-
- `bundle add fly.io-rails`
|
45
|
-
|
46
|
-
This will install `ruby-fly` middleware, add new Rails tasks, extend the
|
47
|
-
channel and job generatotors, and platform binaries for
|
48
|
-
[flyctl](https://github.com/superfly/flyctl#readme). I've followed the
|
49
|
-
trail blazed by [nokogiri](https://nokogiri.org/) and others to make
|
50
|
-
platform binaries happen.
|
51
|
-
|
52
|
-
- `bin/rails fly:launch`
|
53
|
-
|
54
|
-
This won't be a mere front enty to [`flyctl
|
55
|
-
launch`](https://fly.io/docs/flyctl/launch/). It will use
|
56
|
-
[`thor`](https://github.com/rails/thor#thor) to rewrite the configuration
|
57
|
-
for the `production` environment as well as tweak the `Dockerfile` and
|
58
|
-
`fly.toml` based on your application - in particular the configuration for
|
59
|
-
ActiveRecord, ActiveJob, and ActionCable. The people at Fly will know what
|
60
|
-
databases and message queing systems work best on their platform and should
|
61
|
-
make it easy to do the right thing.
|
62
|
-
|
63
|
-
As an example, the default production database for a new application in
|
64
|
-
Rails is sqlite3. Either this will need to be replaced by Postgre in
|
65
|
-
the Rails configuration *or* a volume will need to be defined, mounted,
|
66
|
-
and the Rails configuration modified to point to the new mount point.
|
67
|
-
|
68
|
-
This gem should pick one of those paths as the default, and provide an option to chose other paths.
|
69
|
-
|
70
|
-
- `bin/rails generate channel`, `bin/rails generate job`, etc.
|
71
|
-
|
72
|
-
Rails applications are generally not invented fully formed. They evolve and
|
73
|
-
add features. I don't want people to think about having to configure rails
|
74
|
-
AND configure fly when then add features. Generators that developers
|
75
|
-
already use today should be able to update both the Rails and Fly
|
76
|
-
configurations in a consistent manner.
|
77
|
-
|
78
|
-
For now, both the Rails tasks and generators don't actually modify the Rails
|
79
|
-
configuratio to support Fly, instead they merely output the string `Configuring
|
80
|
-
fly...`. Let your imagination run wild.
|
81
|
-
|
82
|
-
## Motivation
|
83
|
-
|
84
|
-
Oversimplifying and exagerating to make a point, `flyctl launch` generates an
|
85
|
-
initial fly configuration based on the state of the application at launch time
|
86
|
-
but leaves configuring your Rails application up to you. The initial Fly
|
87
|
-
configuration may need to be tweaked, and both the fly and Rails configurations
|
88
|
-
will need to be maintained as the application evolves.
|
89
|
-
|
90
|
-
From a Rails developer perspective, this makes fly an additional framework that
|
91
|
-
must be learned and attended to.
|
92
|
-
|
93
|
-
This can all be changed with a single `bundle add` command. Everything from
|
94
|
-
new `rails` tasks to extending the behavior of existing generators to making
|
95
|
-
changes to configuration to monkeypatching Rails internals itself are on the
|
96
|
-
table.
|
97
|
-
|
98
|
-
A few sublte but important mindset changes are necessary to pull this off:
|
99
|
-
|
100
|
-
* Instead of "we support every (or perhaps even only 'most') Rails
|
101
|
-
configuration" the mindset we should strive for is "we provide a default
|
102
|
-
production configuration that works for most, and provide options to add or
|
103
|
-
replace components as desired".
|
104
|
-
|
105
|
-
We should be bold and daring. We should chose a default web server, a
|
106
|
-
default database, a default active job queue adapter, a default action
|
107
|
-
cable subscription adapter, etc., etc., etc.
|
108
|
-
|
109
|
-
Over time, this should encompas everything needed for monitoring and
|
110
|
-
deployment. Requirements for things like log file management should be
|
111
|
-
anticipated and accounted for.
|
112
|
-
|
113
|
-
* Any configuration artifact that is generated and needs to be checked into
|
114
|
-
the application's source control repository needs to be [beautiful
|
115
|
-
code](https://rubyonrails.org/doctrine#beautiful-code). If you look at
|
116
|
-
configuration files provided by either `rails new` or by rails generators,
|
117
|
-
they have comments. They don't configure things that don't apply to you.
|
118
|
-
|
119
|
-
A concrete example: Rails 7 applications default to import maps. A
|
120
|
-
`Dockerfile` generated for such an app should not contain code that deals
|
121
|
-
with `yarn` or `node_modules`.
|
122
|
-
|
123
|
-
And as a closing remark - to be fair adding Rails support to Fly and adding Fly
|
124
|
-
support to Rails are more complementary than competing efforts.
|
125
|
-
|
126
|
-
## Future
|
127
|
-
|
128
|
-
> Que sera, sera
|
129
|
-
|
130
|
-
-- Doris Day
|
131
|
-
|
132
|
-
I don't know what the future is going to hold, but some guesses:
|
133
|
-
|
134
|
-
* It is plausible that a code base written in Ruby and with access to
|
135
|
-
libraries like [Thos](http://whatisthor.com/) and focused exclusively on
|
136
|
-
Rails may attract more contributions from the Rails community than a
|
137
|
-
codebase written in Go and targetting many disparate frameworks.
|
138
|
-
* Flyctl launch can continue to provide a basic Fly configuration for Rails,
|
139
|
-
but if this effort is successful these configurations would largely be
|
140
|
-
replaced by more tailors configurations that are updated by generators and
|
141
|
-
rake tasks as the application evolves.
|
142
|
-
* Not every flyctl command needs to have a Rails wrapper -- only the common
|
143
|
-
task do. It is quiet OK for developers to deal directly with fly when it
|
144
|
-
makes sence to do so. But those flyctl command that are wrapped may need
|
145
|
-
options added that enable them to be run without the need to prompt the
|
146
|
-
user.
|
147
|
-
* This gem could be built and published alongside the flyctl executables, and
|
148
|
-
`flyctl version update` could detect whether or not it was installed as a
|
149
|
-
gem and react appropriately.
|
150
|
-
|
151
|
-
## Call to Action
|
152
|
-
|
153
|
-
> good ideas and bad code build communities, the other three combinations do
|
154
|
-
> not
|
155
|
-
|
156
|
-
-- Stefano Mazzocchi
|
157
|
-
|
158
|
-
> the best way to get the right answer on the internet is not to ask a
|
159
|
-
> question; it's to post the wrong answer.
|
160
|
-
|
161
|
-
-- Ward Cunningham
|
162
|
-
|
163
|
-
I don't presume that any specific line of code in this initial implementation
|
164
|
-
will last the test of time. Heck, I'm not even confident enough in the
|
165
|
-
proposed name to register the gem, though the name does feel *rails-like* -
|
166
|
-
just take a look at any Rails `Gemfile` to see.
|
167
|
-
|
168
|
-
My hope is that there is enough scaffolding here to not only make clear what
|
169
|
-
the possibilities are, but also enough structure so that it is fairly obvious
|
170
|
-
where new logic should go, together there is not only enough promise and
|
171
|
-
structure to attract a community.
|
172
|
-
|
173
|
-
Some starter ideas:
|
174
|
-
|
175
|
-
* Can we make `bin/rails deploy` smart enough to invoke `flyctl auth login` if
|
176
|
-
you are not logged in and `bin/rails fly:launch` if the application had not
|
177
|
-
previously been launched, with the goal of reducing the number of commands a
|
178
|
-
user has to issue to get started. Also I'm impressed by the way auth login
|
179
|
-
launches a browser, can we do the same for fly launch?
|
180
|
-
|
181
|
-
* While a number of application configuration changes are made through
|
182
|
-
generators, not all are. For example, upgrading the version of Ruby to be
|
183
|
-
used. Perhaps we could create tasks for some of these, but likely it will
|
184
|
-
be worthwhile to create a `fly:reconfig` task.
|
185
|
-
|
186
|
-
Finally, once this repository is in the superfly github organization and
|
187
|
-
a gem has been published, this README should be rewritten from focus on
|
188
|
-
raison d'être and to a focus on what value it would bring to those that
|
189
|
-
install and use it.
|
data/lib/fly.io-rails/version.rb
CHANGED