Docker
Frontiers of Development Productivity in Rails

Summarized using AI

Frontiers of Development Productivity in Rails

Rafael França • September 26, 2024 • Toronto, Canada

In the video "Frontiers of Development Productivity in Rails" presented by Rafael França at Rails World 2024, the speaker explores the enduring impact of the Rails framework on developer productivity and how it has maintained its relevance for two decades. Despite its strengths, França argues that there is still room for improvement, particularly in the setup and configuration environments for development.

Key points discussed in the talk include:
- Rails Doctrine: Rails is built on principles that prioritize developer happiness, notably the philosophy of 'convention over configuration' which simplifies the coding process by reducing the need for extensive configuration across various libraries.
- Challenges of Environment Setup: França shares personal anecdotes about the difficulties faced when setting up Rails applications, particularly relating to Ruby versions and database configurations, illustrating a common experience among developers.
- Historical Development Environment Solutions: He reviews various methods for setting up development environments, from using Bash scripts and Vagrant to Docker containers, explaining the advantages and limitations of each approach. For example, while Vagrant provided repeatability, it was heavy and reliant on virtual machines. Docker introduced efficiencies but required additional knowledge of container management, which could complicate the setup process.
- Innovations in Development Containers: França introduces the concept of 'Dev containers', a newer approach that allows developers to create consistent environments without needing to install dependencies directly on their machines. These containers help in maintaining a high level of customization and facilitate more efficient team collaboration.
- Future Directions for Rails: He emphasizes the need for the Rails community to enhance CLI usability, editor integrations, and static type checking in Ruby to further improve productivity and developer experience.

França concludes with a call to action for the community to embrace innovation in these areas and acknowledges that while Rails is performing well in its core pillars, there’s significant work required to elevate development productivity further. His insights reflect a commitment to continuous improvement within the Rails ecosystem, encouraging collective efforts to push the boundaries of what's possible.

Frontiers of Development Productivity in Rails
Rafael França • September 26, 2024 • Toronto, Canada

Rails is known to be one of the best frameworks in terms of empowering developers to build great products, and has kept this place for 20 years. But...can we do better? In his talk at #RailsWorld, Rails Core member Rafael França shows how they are pushing Rails to continue making developers lives easier across new frontiers.

#RubyonRails #Rails #Rails8 #productivity #devcontainers #lsp #developerhappiness

Thank you Shopify for sponsoring the editing and post-production of these videos. Check out insights from the Engineering team at: https://shopify.engineering/

Stay tuned: all 2024 Rails World videos will be subtitled in Japanese and Brazilian Portuguese soon thanks to our sponsor Happy Scribe, a transcription service built on Rails. https://www.happyscribe.com/

Rails World 2024

00:00:11.679 you this talk my name is Rafael francea uh you can find me at
00:00:17.199 Twitter X and GitHub at Rafael franka uh I'm not from
00:00:23.680 Brazil and more specifically from the state of SII that little state in red
00:00:31.119 the smallest one in Brazil right in the coast a sunny warm Tropical
00:00:38.399 Paradise but now I live in Canada so you can imagine how different
00:00:44.719 it is to me especially in the winter I'm a member of the real Scot
00:00:51.160 team since 2012 for those who don't know this is a
00:00:56.680 team responsible for developing def finding the dire of the framework is not a single
00:01:02.280 guy uh since 2014 I keep the first position in the list of alltime
00:01:08.960 contributors of the framework I'm thank you I'm also the
00:01:17.880 person who released rail eight today during a keynote
00:01:25.240 uh and I work at shopi I don't know if you know this company is is our city
00:01:31.119 host here uh at shop five I'm a principal developer in the Ruben rails
00:01:37.200 infrastructure team a team that I help to create and where I'm
00:01:44.479 responsible for setting the direction of Ruby and rails inside the company you
00:01:50.399 might know this team because we created a few projects lately like wet the new
00:01:56.520 huby passer the rubp and and many other contributions to the rail framework in the entire
00:02:05.240 ecosystem but not enough about me and we are here to talk about
00:02:11.840 rails rails has a very defining Doctrine it's a collection of pillars defined by
00:02:19.720 David that drives rail since the first
00:02:24.760 version some of those pillars are things that the community are really proud of
00:02:31.560 for the purpose of this talk I will focus in a few those those pillars first
00:02:38.120 we proud ourselves that rail is optimized for programming happiness not
00:02:43.680 for machines work with rails of the bring
00:02:48.760 your joy Convention of configuration means
00:02:54.360 that you focus your time on writing your code no need to configure different
00:03:01.480 libraries to work together the menu
00:03:07.000 isak this is because ha rail has made a lot of choices for you so you can just
00:03:13.280 focus on what's important for your application and R takes care of make
00:03:22.159 sure that those choices work together the those four pillars are What
00:03:30.159 attracted me to rails and it's the main reason why I still
00:03:36.080 around and rails is actually very good in those four pillars
00:03:43.560 right uh let's put ourselves in the minds of a beginner we want to create
00:03:49.239 our new raos application like we heard today from Real World to
00:03:56.519 IPO we get to the r website read in the rail guide and we want to create this
00:04:03.439 application in the guide we learn that we need to run ra
00:04:08.879 NE but a section before that is telling me that I need toall
00:04:15.120 Ruby how to St Ruby I
00:04:20.959 mean it should be easy right I just need to find the proper way to start Ruby my
00:04:26.840 operational system let's say I'm me a Linux user because I heard that the creator of raos
00:04:33.440 has a new found passion for Linux and his setup is amazing I want to
00:04:39.120 be like that so I right familiar with Linux I know how to use it I use a bon
00:04:44.560 and install a packages is just a matter of running AP install so I apall
00:04:50.520 Ruby but wait a second which vers of Ruby l UB is Ruby 3.2
00:05:00.240 but I heard that the new version is 3.3 so how do you start a different version of the one that come with my
00:05:08.160 operational system so search around I find
00:05:14.320 information about I think call it virtual managers RBM CH Ruby rvm
00:05:21.520 isdf is a letter soup and I I really get confused which
00:05:28.560 one should I pick how many of you use CH Ruby raise your hands a few how about
00:05:37.720 RBM a lot rvm is still anyone using that
00:05:43.000 no ASDF okay a lot and how about
00:05:49.560 Miss hey that's so little okay I going with the majority I use
00:05:57.840 RBM Ruby Al I can finally create my application after I don't know a few
00:06:04.479 hours and I'm going to trust The Chef's Choice and just create a raise
00:06:09.560 application with what's provided to me I run raise new but I the chef shoose SQL light is a
00:06:18.199 great database but I already know how to use my SQL I've been using my SQL for years with PHP so I don't want to learn
00:06:25.960 a new language and a new database at the same time so I deleted my app and search online
00:06:33.919 find that to create a real application for my you need a flag I pass the
00:06:39.599 flag and I generate a new app oops ball fail I don't know why
00:06:47.360 something about a not being able to install it is it seems the is is missing
00:06:54.479 some packages but which one I search around I read the back is I learned that
00:07:01.440 related to the myo thing that I just changed I need a library to be able to
00:07:08.000 install the my single client so I a to get that library with the huge name that
00:07:13.800 I'm not going to say everything works now my secet is properly configured I'm can happily
00:07:20.400 build my app after a few hours of trying to create my first
00:07:25.560 application after some time our little app is out a
00:07:31.000 business and while I could be work alone with it because it's one person
00:07:36.479 framework I need a new team member I tell my new team member to
00:07:43.960 clone the application and now they need to set up it in the same way that they did but
00:07:51.879 again it's a few months I don't remember anymore what they do so I we are back to
00:07:57.199 the same thing how do I show Ruby I used a virtual manager last time but
00:08:03.520 this time my friend on me how do I st rpn from
00:08:09.960 me I search around I learn about home BR I use home to St RBM then can now Ruby
00:08:17.240 again fine great I remember the sty what happens it fails again and why it fails
00:08:25.000 is again the same problem the mying client package is missing I know the name of the single uh client package so
00:08:32.479 I B saw that package just to learn that uh that package exist in this
00:08:38.640 OS is just called my SQL so I again need to find out and finally I can run the
00:08:46.440 test my test fails because I forgot that now I using redit is probably the wrong
00:08:53.160 choice but I chose it anyway and I forgot about it so I I have to RS and
00:09:00.959 finally the application is working in another person machine I can take notes
00:09:06.320 for the next person so they don't have the same problem and we can finally work
00:09:11.519 in our product so you are going to be the judge now how good we are in those
00:09:17.560 four pillars if you look at this right like we just learned that raos is to bring
00:09:25.120 your application from vow to uh IPO but how do you get to the H World
00:09:36.160 anyway uh I'm pretty sure that like many of you had similar
00:09:42.279 experience and my humble opinion is that why we are good on those four pillars
00:09:47.640 after you have application we should be we are not doing enough we need to do
00:09:55.839 more and that's what I here to talk about like what are the frontiers of
00:10:01.399 developing productivity in the framework we love what should else be doing most
00:10:07.200 of the things I talk about is about environment setup like how you improve
00:10:12.839 and how you set up your machine to be able to develop your programs is everything before working
00:10:19.279 the application itself uh some applications require the minimum you can just showell Ruby it's
00:10:26.440 fine you not need my single clients and Etc but many others have very complex
00:10:31.519 systems that require a few uh other dependencies and there are many ways to
00:10:37.560 solve this problem I'm going to talk about a few of them from the first that
00:10:43.040 I heard about and the last one so the first one like is excluding
00:10:49.200 many bash scripts that people create to set up your computers like we had a
00:10:54.600 project I we still have a project called vagrant that's a way to automation creation of virtual machines to be used
00:11:02.200 for development this is what a vate file looks like the language used to
00:11:08.839 configure vant should be familiar to us because it's just Ruby a vant file Define what operational
00:11:17.800 system that VM is going to use what type of network is going to
00:11:23.800 use uh what are the parts that we want to forward to our host operation
00:11:29.920 system what they provide in this case visual box how much memory how many
00:11:36.200 CPUs and you can also use a sh script to show the dependences you
00:11:43.399 want vant is great because it's reusable you can just get this thing that file
00:11:50.320 and share with your colleagues and they should be able to use it as well the
00:11:55.639 environment disposable if anything fails you can just delete the V M and create
00:12:01.519 again and it's repeatable you should always get the same results giving the
00:12:07.480 same input uh
00:12:13.680 but it based the virtual machines so it's heavy and you have to think the
00:12:20.519 data between the host machine the one you are using to developer in the v
00:12:26.920 machine that's really really boxing was not solution for the same
00:12:33.800 problem that was created Years Ago by GitHub that I personally try to use it
00:12:39.880 was a mecos specific provisional project that used a series of puppet models to
00:12:47.079 manage development environment I'm not going to Bor you about the details of how this works but Su face to say that
00:12:54.680 it was a very complex Sy with the own DSL through disclaimer I was one of the
00:13:00.839 maintainers of boxing at the time I thought that maintaining rails was not
00:13:05.959 enough of a fulltime job and I still had a cons job to do and I need some I don't
00:13:12.839 know things in my life so I decid to maintain a very complex open source project that was not one of my briest
00:13:20.079 idea ever but boxing was local since you could run this in your operational
00:13:27.600 system it was reusable able in the same way that uh vant was I could share with
00:13:33.360 my friends and they would get the same results but it it was not repeatable
00:13:39.000 since it would depend on the current state of your machine if you had my already you run box some my sometimes it
00:13:46.000 works sometimes it fail it depends on what you had your machine it was micro specific so I could
00:13:53.320 not use on Linux Nether on Windows and it was very complex because us it
00:14:01.320 puppet with the Advent of containers people start to use Docker as a way to set up the developer
00:14:07.480 environment to illustrate this kind of setup let's get the real contributors
00:14:13.320 application that's open source application that we actually use this
00:14:18.480 setup uh this app is the one that showed that list of real contributors that I show in the first
00:14:24.519 slides so they have def find a do compos configuration like this
00:14:30.040 with two Services defining the application in the
00:14:35.360 database uh in the application you define some like where the application
00:14:40.480 is mounted and you would also set up where the database is found and in the docket
00:14:49.160 file you would be listing the Ruby image like I'm using rubby 334 all the
00:14:55.320 packages I need to install to be able to develop this application packages that for example was related to my setup
00:15:03.759 because I use V and other that was related to the application itself like the push this
00:15:10.040 client so things were mix it then I would just run commands like installing
00:15:15.480 or upgrade Ruby J and installing Ruby this imag show how this works like
00:15:23.000 you have two boxes one is your hos your machine the other one is the container
00:15:29.079 you would have like uh the database in the container and the application
00:15:34.160 running there but your editor your browser and the files are in your computer local to your
00:15:42.000 computer uh and you would need to send explicit commands to The Container so
00:15:47.120 you could not run R server because R is not running your machine you would have
00:15:53.120 to send the dock as that command to be able to run uh rails in that container
00:16:00.720 if you pay attention to rails we released a few years ago I think two
00:16:05.759 years ago a similar idea called dock D that was a way to run ra application
00:16:11.160 inside docket containers as any of those approaches
00:16:18.079 this dock environment had the advantage and disadvantages like it's reusable
00:16:24.519 disposable repeatable like the vant setup but the abstraction leaks you need
00:16:31.000 to know about Docker you need you cannot run just your commands you are using to you need to know that you need to talk
00:16:37.120 with a container to run the commands you using to and you also had that data
00:16:42.920 synchronization that could make your environment completely slow like a g status could take seconds because you're
00:16:50.480 synchronizing uh files between containers and the
00:16:55.600 hos the latest solution for this problem is oh my C like boxing is a suite of
00:17:01.720 scripts to set up your boot machine so the advantage is Advantage
00:17:10.160 are the same as boxing runs everything the host as it's
00:17:15.439 reusable you can share with colleagues but it's not repeatable if you already
00:17:20.640 have a machine setup in order to make work you need to hand sh your if you
00:17:27.160 mess something out and want to reset to a working State you also need to format
00:17:33.360 OS and is Linux specific Bo specific
00:17:40.640 even although omaku is the newest one in real s.u and I working a feature called
00:17:48.280 develop container for rails but wait a second I didn't I just
00:17:53.360 talk about containers in Docker why we have a different topic for the same thing
00:17:59.240 yes that's true but developing containers or Dev containers for short is more than a do setup in the way we
00:18:07.480 saw before is a specification relas Microsoft is supported by many tools
00:18:14.240 like V Cod rubby mind and is even used to implement features like GI the H code
00:18:21.039 space differently of the previous approach you develop inside the container so experience is the same as
00:18:29.159 if you are running everything in the hos so they said how this works let's
00:18:35.320 get the same application rise contributes so that app has a folder called Dev container with three files
00:18:41.760 inside Dev container Json do compos and dock file in the dult J we Define the
00:18:49.720 name of the application that we are using a compos file with Services we are using to
00:18:57.039 develop in this case the application and a push create command in this case
00:19:03.120 the be setup that people are used to use in a rise application and which features
00:19:09.039 of this container we want inside it in this case I want a GitHub SII so I can
00:19:15.200 uh use the GitHub API I want no GS install and I want the push
00:19:22.159 client in the composite file I Define the application itself in the database
00:19:28.440 simp similar to the dock example but we point the application to the docker file
00:19:35.679 and we pass which version of Ruby we want the docker file has aign to sh
00:19:43.720 Ruby is some packages that we need to run this application and I know I we
00:19:49.520 need the G repository inside the container so also CL the get the ra repository so I can do
00:19:56.440 the calculations and run my data let's see it in action so I'm not going
00:20:02.080 to play the entire video but like we go to vs code we tell it to clone the r
00:20:07.400 contribut application I say it's a main branch it starts to load the dev
00:20:13.280 container I open the logs you can see what's happening is basically created a lot of containers I'm not going to play
00:20:19.480 that but in less than three minutes we are going to get a real application set up and in this computer I don't even
00:20:26.280 have Ruby install yet so putting this explanation in a diagram
00:20:35.360 a container is made of images that is like okay the Ruby image
00:20:42.000 and a few features like the three I you show you like connect to post the client
00:20:48.480 and node and some personalization like I want my own things inside it so in the
00:20:54.400 personalization side let's say I clone my DOT files inside it so I can have my G
00:20:59.679 all my uh bashes scripts that I have everything inside the container in the
00:21:04.919 same way I have in my hostos and the image itself is just a
00:21:12.000 composition of many features like the Ruby image the only thing that's there is a ruby feature they saw Ruby in the
00:21:18.360 right version this architecture support a very high level of customization because we
00:21:24.760 can just create containers with a lot of Lego pieces and like have I don't know your own
00:21:31.200 setup for your own application so let's dive in one of the features the Rubik feature I just talk
00:21:37.640 about inside the feature we have two files a def container feature onall sh
00:21:44.279 def feature just this the idea of the feature uh what customization it has for
00:21:51.440 example this feature for vs code is going to install the Ruby LSP extension
00:21:58.960 if you have a v you would install anything else I don't know maybe the LSP
00:22:04.400 plugin for V uh it also sets the path so it PS an
00:22:10.120 environment variable for you so it knows where to find the RBF command for example and also like you can Define
00:22:17.279 dependencies all the features you want to install with this one in this case I install the common U from that
00:22:22.679 containers and I can Define options that I can allow people to customize in this
00:22:27.919 case you can customize the version and inside the install sh is a b
00:22:35.279 script I know but don't worry it's fine uh this script is just install the
00:22:41.080 packages we need to install Ruby he knows about it you don't need to know the feature knows about it for example
00:22:48.159 he knows that you need to start R to be able to compile with Y
00:22:54.320 enable did you know that maybe not but like this is tricky to find out so it
00:23:00.559 also clone RBF uh install RBF in your B so you need
00:23:05.880 to even think about it and you saw the version of Ruby you ask it and also set
00:23:11.840 it as a global oop sorry oh
00:23:18.120 no okay and the other part that like I
00:23:24.640 going to talk about is what this image is right I talk about the feature the image the Ruby image is just a d and a
00:23:32.600 dock file uh in the d i define where the DOA
00:23:37.880 file is found what are all the features you need in this case commod I need git
00:23:45.320 as well and I need the Ruby feature I want to stall and in do file I just start any
00:23:53.240 Bas image it could be a wood Bas image but in our case it's a dbm Bas image
00:23:59.440 if you pay attention which I hope you are because I'm going to ask you in the
00:24:04.600 hall later how Ruby image configuration is very similar to the dev container
00:24:10.200 configuration we just created for application and that's by Design Dev containers are just images this allow us
00:24:18.480 to do things like I don't know build the image specific for application and
00:24:23.919 instead of telling every single one of you to build the image in your machine we can do that on CI and provide to you
00:24:31.559 a red buil image specific for your app that instead of taking three minutes or
00:24:37.039 five or 10 whatever is going to just take the time enough to download the
00:24:42.200 image from the container environment so maybe a few seconds okay so how do I use this rails
00:24:50.279 if you have rail 7.2 you can just create a new raise application and pass a Dev
00:24:55.960 container flag if you have a existing ra application in 7.2 as well
00:25:02.600 you can run the ra container command and it's going to detect what you using and
00:25:08.240 generate the right di container for you but again to run those commands I
00:25:15.200 need Ruby St how do you stall Ruby again I mean for nearly generate Dev container
00:25:21.440 config if I use vs code you just need to install the
00:25:28.960 Dev container extension and you can see all the commands the dev container has
00:25:34.559 in the command pallet so you can open the current project in a Dev container or clone the
00:25:40.960 exist project repository and one of the tips I have to give you is like if you clone
00:25:48.279 the repository inside the container volume not in your machine in the container volume you're going to have
00:25:54.960 operations way faster because we are basically mimicking this setop that I
00:26:00.520 was talking about where uh if you clone your machine you
00:26:06.520 are going to have that sink that I talk about that's bad is slow you should not be doing that but if you CL inside a
00:26:12.840 container you just have that same architecture that I talk about where the client on your host machine the server
00:26:20.360 is there and we don't need to syn the files so like the dock approach the
00:26:28.799 Pros are the same but what are the disadvantages edit to set up
00:26:35.880 maybe because I I bet you are thinking now okay cool Rafael I don't use vs code
00:26:42.000 all the examples you gave is with vs code and since Dev containers were created by Microsoft vs code as well I
00:26:49.640 bet is only going to work with vs code right not really if it's a op spec you
00:26:55.960 can already use Dev container with all the editors I have tried myself with a
00:27:01.279 few of those V code intell V emx and
00:27:06.919 cursor okay but you need the docker right also not really you can use with
00:27:12.799 any container in runtime the ones that I triy myself were like Windows sub system
00:27:20.000 H Cola oback and how about the rail I still need to start Ruby to generate a
00:27:27.000 new application and trying to solve this problem we created a Stalone executable
00:27:33.600 that works any operational system even windows that creates a container to generate the application for
00:27:40.519 you this allow you to get a rise application configur with a Dev container that you can start in your
00:27:47.519 favorite editor in on the early stages like I'm not comfortable with this two
00:27:54.679 yet because I think we need to invest a little bit more it but if
00:28:00.799 works and that's exactly why I'm giving this talk because I think we really should
00:28:07.880 take Serious those four pillars of the doctrine and we need to do more investment this area om and Dev
00:28:16.519 containers are solutions for this environment set up problem but they are not even close to be the experience I
00:28:23.960 want to give to people the CLI required have to run time
00:28:29.840 for example so to run Dev containers you need node I don't like that idea so our
00:28:36.320 want the community to try to build a CLI that can be in any language like Russ
00:28:42.320 that does not require jav s
00:28:48.120 uh anything else we could be investing this area I think so I think editor
00:28:54.600 integration is one of the things I wish we were investing more as a community we
00:29:00.159 have the Ruby LSP and the stimulus LSP right now but we need to do better like
00:29:06.320 we need a better code understanding we need timely information where it matters
00:29:11.399 not after runci to know we have a syntax error in our Ruby program why should I
00:29:18.440 wait for that and since I read in the topic of talk about uh static analysis
00:29:25.200 of code we also I think we need to talk serious about St typing and I know sure
00:29:31.679 none of the incarnations of this for Ruby are good enough yet but a love if
00:29:36.840 we as a community could investigate what could be a great St type is for
00:29:44.320 Ruby we as a community should be pushing forward the frontiers of productivity
00:29:50.200 further and further after all this is a area that we proud ourselves of being good at I hope
00:29:58.440 I was able to create a little bit of curiosity about the subject and I hope to see what our community will create in
00:30:06.039 this space thank you
Explore all talks recorded at Rails World 2024
+17