Skip to content

Commit c6057a4

Browse files
authored
Announcement and updates to Elixir v1.9 (elixir-lang#1268)
1 parent 22da0a1 commit c6057a4

File tree

8 files changed

+486
-93
lines changed

8 files changed

+486
-93
lines changed

‎_data/getting-started.yml‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,11 @@
101101
- title: Doctests, patterns and with
102102
slug: docs-tests-and-with
103103

104-
- title: Distributed tasks and configuration
105-
slug: distributed-tasks-and-configuration
104+
- title: Distributed tasks and tags
105+
slug: distributed-tasks
106+
107+
- title: Configuration and releases
108+
slug: config-and-releases
106109

107110

108111
- title: Meta-programming in Elixir

‎_includes/search.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<divclass="widget news">
22
<h3>
3-
News: <ahref="/blog/2019/01/14/elixir-v1-8-0-released/">Elixir v1.8 released</a>
3+
News: <ahref="/blog/2019/06/24/elixir-v1-9-0-released/">Elixir v1.9 released</a>
44
</h3>
55
</div>
66

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
layout: post
3+
title: Elixir v1.9 released
4+
author: José Valim
5+
category: Releases
6+
excerpt: Elixir v1.9 is out with releases support, improved configuration and more.
7+
---
8+
9+
Elixir v1.9 is out with releases support, improved configuration, and more.
10+
11+
We are also glad to announce [Fernando Tapia Rico](https://github.com/fertapric) has joined the Elixir Core Team. Fernando has been extremely helpful in keeping the issues tracker tidy, by fixing bugs and improving Elixir in many different areas, such as the code formatter, IEx, the compiler, and others.
12+
13+
Now let's take a look at what's new in this new version.
14+
15+
## Releases
16+
17+
The main feature in Elixir v1.9 is the addition of releases. A release is a self-contained directory that consists of your application code, all of its dependencies, plus the whole Erlang Virtual Machine (VM) and runtime. Once a release is assembled, it can be packaged and deployed to a target as long as the target runs on the same operating system (OS) distribution and version as the machine running the [`mix release`](https://hexdocs.pm/mix/Mix.Tasks.Release.html) command.
18+
19+
Releases have always been part of the Elixir community thanks to Paul Schoenfelder's work on [Distillery](https://github.com/bitwalker/distillery) (and EXRM before that). Distillery was announced in July 2016. Then in 2017, [DockYard](https://dockyard.com/) hired Paul to work on improving deployments, an effort that would lead to [Distillery 2.0](https://dockyard.com/blog/2018/08/23/announcing-distillery-2-0). Distillery 2.0 provided important answers in areas where the community was struggling to establish conventions and best practices, such as configuration.
20+
21+
At the beginning of this year, thanks to [Plataformatec](http://plataformatec.com.br/), I was able to prioritize the work on bringing releases directly into Elixir. Paul was aware that we wanted to have releases in Elixir itself and during [ElixirConf 2018](https://elixirconf.com) I announced that releases was the last planned feature for Elixir.
22+
23+
The goal of Elixir releases was to double down on the most important concepts provided by Distillery and provide extensions points for the other bits the community may find important. [Paul](http://github.com/bitwalker/) and [Tristan](https://github.com/tsloughter) (who maintains [Erlang's relx](https://github.com/erlware/relx)) provided excellent feedback on Elixir's implementation, which we are very thankful for. [The Hex package manager is already using releases in production](http://blog.plataformatec.com.br/2019/05/updating-hex-pm-to-use-elixir-releases/) and we also got feedback from other companies doing the same.
24+
25+
Enough background, let's see why you would want to use releases and how to assemble one.
26+
27+
### Why releases?
28+
29+
Releases allow developers to precompile and package all of their code and the runtime into a single unit. The benefits of releases are:
30+
31+
* Code preloading. The VM has two mechanisms for loading code: interactive and embedded. By default, it runs in the interactive mode which dynamically loads modules when they are used for the first time. The first time your application calls `Enum.map/2`, the VM will find the `Enum` module and load it. There’s a downside. When you start a new server in production, it may need to load many other modules, causing the first requests to have an unusual spike in response time. Releases run in embedded mode, which loads all available modules upfront, guaranteeing your system is ready to handle requests after booting.
32+
33+
* Configuration and customization. Releases give developers fine grained control over system configuration and the VM flags used to start the system.
34+
35+
* Self-contained. A release does not require the source code to be included in your production artifacts. All of the code is precompiled and packaged. Releases do not even require Erlang or Elixir in your servers, as they include the Erlang VM and its runtime by default. Furthermore, both Erlang and Elixir standard libraries are stripped to bring only the parts you are actually using.
36+
37+
* Multiple releases. You can assemble different releases with different configuration per application or even with different applications altogether.
38+
39+
* Management scripts. Releases come with scripts to start, restart, connect to the running system remotely, execute RPC calls, run as daemon, run as a Windows service, and more.
40+
41+
### 1, 2, 3: released assembled!
42+
43+
You can start a new project and assemble a release for it in three easy steps:
44+
45+
$ mix new my_app
46+
$ cd my_app
47+
$ MIX_ENV=prod mix release
48+
49+
A release will be assembled in `_build/prod/rel/my_app`. Inside the release, there will be a `bin/my_app` file which is the entry point to your system. It supports multiple commands, such as:
50+
51+
*`bin/my_app start`, `bin/my_app start_iex`, `bin/my_app restart`, and `bin/my_app stop` - for general management of the release
52+
53+
*`bin/my_app rpc COMMAND` and `bin/my_app remote` - for running commands on the running system or to connect to the running system
54+
55+
*`bin/my_app eval COMMAND` - to start a fresh system that runs a single command and then shuts down
56+
57+
*`bin/my_app daemon` and `bin/my_app daemon_iex` - to start the system as a daemon on Unix-like systems
58+
59+
*`bin/my_app install` - to install the system as a service on Windows machines
60+
61+
### Hooks and Configuration
62+
63+
Releases also provide built-in hooks for configuring almost every need of the production system:
64+
65+
*`config/config.exs` (and `config/prod.exs`) - provides build-time application configuration, which is executed when the release is assembled
66+
67+
*`config/releases.exs` - provides runtime application configuration. It is executed every time the release boots and is further extensible via config providers
68+
69+
*`rel/vm.args.eex` - a template file that is copied into every release and provides static configuration of the Erlang Virtual Machine and other runtime flags
70+
71+
*`rel/env.sh.eex` and `rel/env.bat.eex` - template files that are copied into every release and executed on every command to set up environment variables, including ones specific to the VM, and the general environment
72+
73+
We have written [extensive documentation on releases](https://hexdocs.pm/mix/Mix.Tasks.Release.html), so we recommend checking it out for more information.
74+
75+
## Configuration
76+
77+
We also use the work on releases to streamline Elixir's configuration API. A new `Config` module has been added to Elixir. The previous configuration API, `Mix.Config`, was part of the Mix build tool. However, since releases provide runtime configuration and Mix is not included in releases, we ported the `Mix.Config` API to Elixir. In other words, `use Mix.Config` has been soft-deprecated in favor of `import Config`.
78+
79+
Another important change related to configuration is that `mix new` will no longer generate a `config/config.exs` file. [Relying on configuration is undesired for most libraries](https://hexdocs.pm/elixir/library-guidelines.html#avoid-application-configuration) and the generated config files pushed library authors in the wrong direction. Furthermore, `mix new --umbrella` will no longer generate a configuration for each child app, instead all configuration should be declared in the umbrella root. That's how it has always behaved, we are now making it explicit.
80+
81+
## Other improvements
82+
83+
There are many other enhancements in Elixir v1.9. The Elixir CLI got a handful of new options in order to best support releases. `Logger` now computes its sync/async/discard thresholds in a decentralized fashion, reducing contention. `EEx` (Embedded Elixir) templates support more complex expressions than before. Finally, there is a new `~U` sigil for working with UTC DateTimes as well as new functions in the `File`, `Registry`, and `System` modules.
84+
85+
## What's next?
86+
87+
As mentioned earlier, releases was the last planned feature for Elixir. We don't have any major user-facing feature in the works nor planned. I know for certain some will consider this fact the most excing part of this announcement!
88+
89+
Of course, it does not mean that v1.9 is the last Elixir version. We will continue releasing shipping new releases every 6 months with enhancements, bug fixes and improvements. You can see the [Issues Tracker](http://github.com/elixir-lang/elixir/issues) for more details.
90+
91+
We also are working on some structural changes. One of them is move the `mix xref` pass straight into the compiler, which would allow us to emit undefined function and deprecation warnings in more places. We are also considering a move to [Cirrus-CI](https://cirrus-ci.org/), so we can test Elixir on Windows, Unix, and FreeBSD through a single service.
92+
93+
It is also important to highlight that there are two main reasons why we can afford to have an empty backlog.
94+
95+
First of all, Elixir is built on top of Erlang/OTP and we simply leverage all of the work done by Ericsson and the OTP team on the runtime and Virtual Machine. The Elixir team has always aimed to contribute back as much as possible and those contributions have increased in the last years.
96+
97+
Second, Elixir was designed to be an extensible language. The same tools and abstractions we used to create and enhance the language are also available to libraries and frameworks. This means the community can continue to improve the ecosystem without a need to change the language itself, which would effectively become a bottleneck for progress.
98+
99+
Check [the Install section](/install.html) to get Elixir installed and read our [Getting Started guide](http://elixir-lang.org/getting-started/introduction.html) to learn more. We have also updated our [advanced Mix & OTP](https://elixir-lang.org/getting-started/mix-otp/introduction-to-mix.html) to talk about releases. If you are looking for a more fast paced introduction to the language, see the [How I Start: Elixir](http://howistart.org/posts/elixir/1/index.html) tutorial, which has also been brought to the latest and greatest.
100+
101+
Have fun!

0 commit comments

Comments
(0)