26 ms·
Phoenix 1.3.0 Released
- out_of_protocol 9y agoQuote interesting release, many useful features. `action_fallback` looks really nice. Contexts ... not so much imo
- ch4s3 9y agoContexts are in practice pretty nice, and you don't have to use them. I've found that in my own work with 1.3.rc.*, the contexts describe an area of the system and help enforce some separation of concerns. That said, you're free to build everything in one context.
- the_angry_angel 9y ago> Contexts ... not so much imo I'll prefix my comment by saying I'm someone who is more on the sysadmin side of the scale of things. My code isn't pretty, but it generally works well enough to get the job done. I'm learning (probably the most important thing, I guess). Contexts are one of things that I felt the same about. Until I tried really using them, rather than stressing over whether or not I was using them properly. I made the mistake of trying to think of them as microservices, which bogged me down and for my purposes was complete overkill. I've now reached a kind of happy medium, which I've realised that I really should have already been using. I've kinda realised I suck at api design. And for that I'm very thankful to the phoenix team, because it feels like I'm learning.
- fredsir 9y agoContexts might not like nice, but they really are in practice.
- kureikain 9y agoI have an example where context works well for me. I have built an app[0], the app allow user to submit links, either using our web ui or via a bot. When using web ui, they have to login, hence we associate the links with that user. The bot is different, everyone submit via the post share the same `Bot` account. In other words, the process of inserting a link from web ui or via bot is a bit different. Without context, I would use different module or some branch code to distinct between them. I think context solves that nicely for me. --- [0] https://one.betterdev.link https://one.betterdev.link which is an extra version of https://betterdev.link/ https://betterdev.link/
- bratsche 9y agoI love contexts! But if you don't, that's cool too. There are mix tasks for using the older style generators and mix tasks for the newer context style generators. Use whichever you prefer.
- lojack 9y agoContexts are just the default now. Nothing is preventing you from doing things the old way, or from using them in 1.2 without upgrading. If you can think of a better architecture that doesn't involve contexts, then that should absolutely be what you're doing.
- tiffanyh 9y agoWow. In the past few weeks: - Erlang/OTP 20 released, - Elixir 1.5 released And Cowboy 2.0 is in Release Candidate phase. Exciting times.
- srjilarious 9y agoReally excited to see this out. I've been learning Elixir and Phoenix with the 1.3rc and have really been enjoying it! I'm a fan of Contexts myself as that is typically how I architect apps on mobile as well. I like having everything separated more explicitly and testable individually and Contexts seem to promote that in a really nice way.
- gregpardo 9y agoI actually love the domain driven work done in this release. I think it was a bold move from the team and breaks them even further away from Rails on EVM that people tend to think. I have been bit so many times with trying to figure out where to put things like authentication/registration in a traditional MVC rails like app.
- charleshan 9y agoAwesome, nice work!
- fareesh 9y agoI'm spending all my free time with Phoenix. I come from a Rails, Laravel, Django and a bit of .NET Core background. So far I am extremely impressed. I'm surprised it has not been adopted by that many folks in production.
- aaron-lebo 9y agoShhh, the first rule of Phoenix Club is that you don't tell everyone that it is the best web stack out there.
- sotojuan 9y agoFar, far too late for that here in HN :-)
- dopeboy 9y agoI'm a django guy. I have no experience with functional programming. What would a transition to phoenix + elixir look like for me?
- aaron-lebo 9y agoIt's more Rails than Django but once you've seen one MVC framework you've seen them all. I'd suggest: https://pragprog.com/book/phoenix/programming-phoenix https://pragprog.com/book/phoenix/programming-phoenix In structure it reminds me a lot of the very first Rails book co-authored by DHH. It's a good way to get into the language/framework.
- dopeboy 9y agoThanks for the link. One thing I hated about Rails when I tried it was the level of magic involved. Does Phoenix suffer from that at all?
- aaron-lebo 9y agoPhoenix works within existing Elixir constructs like macros and modules, so it keeps a lot of the nice interfaces of Rails without the magic, how things work is pretty straightforward. It is worth stating that the way Erlang/Elixir manage processes is completely different than most other languages and that has to be grokked at some point. Thankfully the framework abstracts a lot of that. The Elixir and Phoenix docs are also pretty good. They're not Django-level (what is), but they're good.
- bnchrch 9y agoI've been working professionally in Elixir/Phoenix for the past 4 months. Summary: It's amazingly productive, pleasant to work with and simple. Coming from a background spanning Python/Django, C#/.net and Node/Express I really believe it blows them out of the water. Thank you for all the hardwork of the Phoenix team and the amazing community you've made.
- GiorgioG 9y agoAs a .NET developer by day, I'm curious what you like about Elixir over C#/.NET? I have a copy of Elixir in Action on my nightstand, I just haven't had a chance to crack it open yet.
- bnchrch 9y agoPattern Matching makes it easy to write small, understandable code The Concurrency Model is simple to the point where creating a whole pubsub system to handle events, push out notifications, and handles backpressure can be done in < 100 lines with no additional datastores or frameworks. Finally the pipe operator is like C#'s LINQ statements but with so much more power and flexibility, hard to explain but I highly recommend cracking open that book on your nightstand!
- Rovanion 9y agoThe Elixir pipe operator |> is the equivalent of the Clojure thread first macro ->, right?
- digitalzombie 9y agoGonna do phoenix for a side project. I'm just a bystander reading about erlang and elixir for awhile. Did web dev in php and a little bit of nodejs. But I think what you guys doing are great. I'm glad Elixir and Phoenix came about it really helps drive the language into a field (web dev) and get people to notice. And that one implementation of figuring out how people is log off or not that is in Phoenix was really sweet when you presented it.
- brightball 9y agoGreat news! Been waiting for this so I could tinker and then make a pitch to my office where I think it's an ideal fit.
- ranyefet 9y agoThanks for the hard work! Looking for to upgrade
- s0l1dsnak3123 9y agoWe’ve been using Phoenix at my company in production for over a year now. So far the experience has been overwhelmingly positive, our team have totally come round to its adoption, our server costs have come down and our response times have gone down also. Coming from Rails, the ecosystem isn’t quite there yet, but it is far more mature than rails’ was this early on. The hardest thing for us has been deployment, but we’ve solved that internally, including giving back by building exrm_deb (it works with distillery too!) to compile the entire project into a Debian package. If you haven’t already looked at Phoenix (and Ecto!) give it a try :)
- bobwaycott 9y agoReleases as a .deb?! Awesome!
- s0l1dsnak3123 9y agoYou can have them as RPM as well if you are so inclined! https://github.com/smpallen99/exrm-rpm https://github.com/smpallen99/exrm-rpm
- hack4supper 9y agoThats really neat...gonna check it out. Thanks for sharing. Here is the link for anyone else: https://github.com/johnhamelink/exrm_deb https://github.com/johnhamelink/exrm_deb
- adam_seeliger 9y agoGood to hear.
- Tistel 9y agoWe are using Elixir and Phoenix. Its amazbalz. The properties of the erlang VM (100k processes, individually garbage collected etc) are going to make it a killer platform. (edited)
- softwarelimits 9y agoPhoenix is great! I only wish there was one recommended way for authentication and authorization - there are so many [1] different libraries that I got stuck in researching the options - I am confused, do not know which one to use. What is your preferred way? I would like to avoid to implement every little detail on my own - to get security done right was the main reason for me using open source libraries. It would be great if there was one official way to make it easier to implement app security with the framework. I feel that this is the only missing part in phoenix - but it is a very important one. BTW: does anybody know some tool that generates a phoenix api from a json-schema? Thanks! [0] https://github.com/h4cc/awesome-elixir#authentication https://github.com/h4cc/awesome-elixir#authentication
- hajto 9y agoAuth : Guardian
- sergiotapia 9y agoThe beautiful thing about Phoenix framework is that there is no "one-true way" to do things. Rails is omakase, Phoenix is not, and that's a good thing. You want the whole enchilada? Use Guardian. Need oauth? Use ueberauth. Just want email and password? Use comeonin to hash your password. It's liberating to know exactly how your system works and that it's not hidden behind some magical blackbox like Devise.
- softwarelimits 9y agoA blackbox is not what I was asking for. I would be happy to find the features you described (and many more) in one (extensible) place like e.g. Phoenix.Security.
- sergiotapia 9y agoThe problem with that approach is that imagine if Phoenix had a Phoenix.Security.sign_in function. How do you want to sign in? With a cookie? With a server-side session? With a database session? With an authentication token GET params? With an authentication token in the header? You make the choices for your specific use case and implement them using laser-focused, great packages. One system I built authenticates with an `authenticationToken` GET params, I look for that in a Plug, then assign the current_user to the conn object. For non-api requests, I use plain old sessions.
- playing_colours 9y agoWould you suggest to choose Elixir / Phoenix for an api for a startup? Is it too risky now, or good enough + very attractive?
- out_of_protocol 9y agoI will. The only risk is finding devs - there are too few that know elixir. Not hard to switch though ;)
- qaq 9y agoIt's used by fairly big projects/Companies bet365, Bleacher Report, New Relic,Discord, PagerDuty, Puppet labs, FireEye etc.
- brightball 9y agoI had not heard New Relic was using it
- qaq 9y agohttps://elixirforum.com/t/senior-software-engineer-new-relic/2258 https://elixirforum.com/t/senior-software-engineer-new-relic...
- karmajunkie 9y agoJust me personally, I probably wouldn't do it in anything else... Not that there aren't some other good options out there depending on your background. I just prefer Elixir, I know it scales in both maintenance and performance (the former being the more difficult goal in my mind) I think the market is growing such that finding engineers who a) have experience, or b) want experience with it, won't be a real problem. I can tackle software and hardware problems alike, there are good options for integrating native code when performance counts, and in general I consider it to be the safest option available to me.
- abritinthebay 9y agoI'm biased as my company (Bleacher Report) uses it extensively for this exact purpose but yes: do it. It's great.
- Gaelan 9y agoI had to switch to the home page and go below the fold to figure out what Phoenix was (a web framework in Elixir).
- misterbowfinger 9y agoAre there any "here be dragons" for Phoenix? Does it play well with legacy systems? Support for different protocols, etc.
- karmajunkie 9y agoYMMV on protocols, just depends on what you're looking for. Most reasonable protocols you'd want are supportable. The only time I've been left scratching my head was trying to get the VM running on a SOCKS proxy, which I think probably speaks more to my lack of familiarity with doing so (though in the source of this I found that the native SOCKS libraries were removed some time ago. We're using it at a client as a kind of nexus of all our legacy systems, in fact.
- cutler 9y agoI don't think Elixir has production-level support for gRPC which is a bit of a deal-breaker for me.
- Ndymium 9y agoThere seem to be plenty of gRPC libraries for Erlang though, according to a quick googling.
- slashdotdash 9y agoFor anyone curious about Phoenix and Elixir, I can sincerely recommend the following resources to get you started: - Programming Phoenix by Chris McCord, Bruce Tate, and José Valim [1] - The Little Elixir & OTP Guidebook by Benjamin Tan Wei Hao [2] - Elixir in Action by Saša Jurić [3] Phoenix initially attracted me to Elixir, I've stuck around for that and the OTP platform: pattern matching, process based concurrency (actor model), supervision, immutability, macros, and more. "Elixir took the Erlang virtual machine, BEAM, and put a sensible face on it. It gives you all the power of Erlang plus a powerful macro system." – Dave Thomas [1] https://startlearningelixir.com/r/programming-phoenix https://startlearningelixir.com/r/programming-phoenix [2] https://startlearningelixir.com/r/the-little-elixir-and-otp-guidebook https://startlearningelixir.com/r/the-little-elixir-and-otp-... [3] https://startlearningelixir.com/r/elixir-in-action https://startlearningelixir.com/r/elixir-in-action
- sergiotapia 9y agoThis is the best Elixir material I've used: https://pragmaticstudio.com/elixir https://pragmaticstudio.com/elixir You build you a simple HTTP server using Elixir and learn a lot of the core language and architecture choices when writing Elixir code. It doesn't pester you with this is an int, this is a string. You just start building this HTTP server out and learn about Elixir along the way.
- rbankston 9y agoLearned a lot from the pragmaticstudio resource as well and couldn't recommend it highly enough.
- jmcgough 9y ago+1 on "The Little Elixir & OTP Guidebook". It's a generally good introduction to OTP, though the book has a lot more errors than I'm used to seeing (their github code differs without explanation from the code in the book at times, and sometimes one or the other won't run successfully).
- myth_drannon 9y agoElixir in Action is a bit outdated, no?
- dmix 9y agoThe directory reorganization is a good sign that Elixir/Phoenix are not simply rehashing Ruby/Rails for the sake of popularity but are willing to prioritize what makes the most sense for this particular language - and asking how they can improve upon what already exists. I recently ported my app from 1.2->1.3 and moving away from Models to Contexts/Data was a simple transition that makes a lot of sense. The `data` files (aka your new models) are basically where the schema for your model lives and the `context` (your models API) is the interface for your data. For example when building a blog: Instead of having User, Session, Post, and Comment models which contains your DB schema, business logic, and interfaces for getting/setting data all models directory ala Rails: blog/app/models/comment.rb blog/app/models/post.rb blog/app/models/session.rb blog/app/models/user.rb blog/app/controllers/... blog/app/views/... you instead create a namespace for each group of data: lib/blog_app/accounts/accounts.ex lib/blog_app/accounts/session.ex lib/blog_app/accounts/user.ex lib/blog_app/blog/blog.ex lib/blog_app/blog/comment.ex lib/blog_app/blog/post.ex lib/blog_app/web/controllers/... lib/blog_app/web/views/... And in your data file `lib/blog_app/blog/post.ex` for example, you'd keep just your schema defining the fields like "title, permalink, body, etc" and code to handle validations and virtual attributes. Then in your context file `lib/blog_app/blog/blog.ex` you define the API that access your data. So from your controller instead of calling: Post.all Comment.all Comment.find(1) User.new({..}) You now call: Blog.list_posts Blog.list_comments Blog.get_comment(1) Accounts.create_user({..}) It makes for a very logical structure for your MVC code.
- deleted 9y ago[deleted]
- samtechie 9y agoDoes Phoenix 1.3.0 fully support Elixir 1.5? I keep getting warnings when compiling since I upgraded to Elixir 1.5.
- pmarreck 9y agoIt does. You may also need to upgrade your mix dependencies, I'm sure many of their authors are busy fixing the deprecation warnings as I type
- jrs95 9y agoI've always been intrigued by Phoenix/Elixir but I was worried it may just be a fad. Seems like it's had solid growth over the last couple years though, so I may end up diving into it over the weekend.
- kornish 9y agoDoes anyone have any favorite open-source Phoenix codebases?
- reledi 9y agohttps://github.com/thechangelog/changelog.com https://github.com/thechangelog/changelog.com
- bostonvaulter2 9y agohexpm the package manager website is open source: https://github.com/hexpm/hexpm https://github.com/hexpm/hexpm Firestorm is another: https://github.com/dailydrip/firestorm https://github.com/dailydrip/firestorm
- Kiro 9y agoHow are people hosting their Phoenix projects? I'm used to Heroku or Laravel Forge. I don't really want to mess too much with servers.
- pmarreck 9y agoMe neither. Devops is a hat I wasn't interested in wearing. Which is why I tried Gigalixir[1] and never looked back. It's sort of like Heroku for Phoenix/Elixir, but without the daily restarts and with hot upgrades and the ability to run a BEAM cluster. Jes (owner) has been super responsive and deploys are trivial... just like I like it. Also got Postgres running in google cloud (a new offering!) and that's worked great as well. Sparkpost for an email API and Timber.io for cloud logs have also been stellar. Sweet dashboards. You get a lot at the free tier on these. [1] https://www.gigalixir.com https://www.gigalixir.com
- bostonvaulter2 9y agoPhoenix works well on Heroku: https://hexdocs.pm/phoenix/heroku.html https://hexdocs.pm/phoenix/heroku.html I also want to try gigalixir which has a free tier: https://gigalixir.com/ https://gigalixir.com/
- pmarreck 9y agoNote that Heroku has some drawbacks with regards to Elixir: 1) Daily restarts, which kill any app-side state such as a cache or ETS table 2) Can't take advantage of any clustering 3) Can't do hot upgrades
- lojack 9y agoIn a datacenter on bare metal :-) I also work on a number of side projects with coworkers and we host those in Heroku. Can't really speak to how well that'd work if they were more than just side projects, but it works for us.
- jonathanreinink 9y agoBeen following Phoenix for a while now. It looks amazing! One small complaint: the lack of code highlighting in the documentation really bugs me.
- miguelrochefort 9y agoHow is it better than F# and Akka.NET?
- iagooar 9y agoWhy not turn the question around. Since this is a post about Elixir & Phoenix, why do you think it's not better than F# and Akka.NET?
- nobleach 9y agoI wouldn't say "better". Like any other framework, many things have to be weighed. In the case of F#, it's a fantastic language with a fantastic runtime. It is still "windows only"* for the moment though. Akka (and yes, I realize that you mentioned .NET) is also very good in its varieties. Scala being one of the ones that I've actually used. I believe where the sweet-spot is for Elixir, in general is that Rubyists will feel mostly at home. The language itself is just very, very nice. Phoenix continues this by copying some of the nice ideas from Rails. But again, It's not better than the language and tech that you mentioned, but it fits a certain swath of developers. I wouldn't recommend someone who is well versed in F# with Akka.NET drop what they're doing to migrate. *Yes, I'm aware of Mono, but I've been completely unhappy with my experience using it.
- jaequery 9y agoIt's truly amazing when you see the numbers yourself, as Elixir/Phoenix produces some wicked TTFB(time to first byte) speed and concurrent performances you can't get from other languages. I wouldn't be surprised to see one elixir server replacing 5x - 10x servers.
- renrutal 9y agoIn some cases, more like 30x - 75x: http://www.techworld.com/apps-wearables/how-elixir-helped-bleacher-report-handle-8x-more-traffic-3653957/ http://www.techworld.com/apps-wearables/how-elixir-helped-bl...
- neya 9y agoI use Phoenix with all my newer projects. The performance is stellar. I single-handedly was able to create what many startups out there have built with 100s of thousands of engineers[1] in a short period of time. This may be possible with Rails too, but then, I found a lot of things are much more convenient to get done in Phoenix than in Rails - For example, Contexts (nested models), Routes, etc. When I started with Phoenix I was anxious that the experience was going to be just like when I first tried out Play/Scala, but no. To my surprise, my experience was fantastic. Truly, this framework allows you to focus on your business problems rather than fighting with configurations/conventions. One of the best decisions the team has made is introducing the concept of contexts from DDD[2]. Initially, I was pretty confused, but now, I simply cannot imagine myself going back once that I've understood it. It's basically breaking down your business into smaller tiny modules, like I've done in [1]. The other thing I love about Phoenix is the concept of umbrella applications. I'm not sure if Rails has an equivalent, but I think this alone is worth exploring Phoenix for. I don't even have micro-services in my architecture yet, but because of these patterns, I'll be able to break out and scale my application if I require to, in the future. Phoenix has proven to me that it can not only scale performance-wise, but also architecture-wise. Last time I tried developing [1], it was in PHP and I had to hire 5 devs to get it done..6 months later and we still weren't done. However, in just a matter of weeks, I was able to finish a complete working prototype of this mammoth application, with UI and frontend. As for my production setup, I use Docker + AppEngine (using a custom VM) and it has served me really well. The performance is top notch and everything works so flawless. As for the language itself, I really love Elixir. I simply cannot imagine going back. It really forces you to think differently about your code. Last time I tried to learn a functional language, it was Scala - also a beautiful language on top of the JVM. But, the problem is, it's so academic in the sense that even a good book on scala had 400+ pages. Some of them had 700+ pages. But Elixir isn't like that, you can pick up the language in a matter of weeks (YMMV, it took me 2) AND build a project in no time. For Elixir, if you're coming from a Ruby background, you'll be able to pick it up fairly easy. However, you will find it challenging when you hit a situation where you would have used a traditional for loop, but in Elixir, you would be forced to re-architect your code. And that's a good thing. [1] https://news.ycombinator.com/item?id=14785209 https://news.ycombinator.com/item?id=14785209 [2] https://martinfowler.com/bliki/BoundedContext.html https://martinfowler.com/bliki/BoundedContext.html
- desireco42 9y agoOh finally! I've been using RC for quite a while now. Glad it is out.
- richjdsmith 9y agoAwesome work Chris, thanks for everything you and the team are doing!