aseigo

aseigo

Explor Elixir E6: Multitenant Apps with Ecto and Triplex

I am finally back with another episode of Exploring Elixir. Sorry for the long wait! My August was split between vacation and starting a new adventure at work, so EE got punted for the month. Back to weekly episodes now though …

In episode 6, we look at using Ecto and Triplex to create multitenant applications. Even for those who have used these tools before, there may be a couple tips in there for you yet, such as how to get the prefix to use from inside a Triplex migration …

Hope you enjoy, as always!

Most Liked

kelvinst

kelvinst

Triplex author here! Really glad to see you enjoyed it to the point of making a video using it!

Your video is really awesome! It has a really nice overview for who wonders what does it do.

I was working on an article/tutorial of how to use it (@BarelyFunctional asked for it), but got no time to finish it yet! I promise I’ll work on it soon…

About the use of prefixes on migrations, that’s a nice catch. I actually had this problem but forgot to document my solution. Just a little thing you probably missed: there is a function that gets the prefix of the running migration for you - Ecto.Migration.prefix/0. It does exactly what you do, but without that much work! :wink:

Thanks @aseigo for all your work!

kelvinst

kelvinst

Added! Thanks for the suggestion!

petersonfs

petersonfs

@kelvinst get a look :slight_smile:

aseigo

aseigo

Dang, I completely missed that somehow. Been there since 2.0 as well! Will update the repo later to simplify with this … thanks, both for this tip but also the library!

aseigo

aseigo

BTW … it is quite difficult to find triplex on hex.pm. It does not mention the magic term “multitenant” or “multitenancy” anywhere in the description, which is probably what many people search for (one such person already popped up in the comments on Reddit, in fact).

hex.pm mangles the markdown in the README.md description which doesn’t help any either. Even then, as someone who did not come to Elixir from Ruby, the reference and link to Apartment didn’t really help me find it, either.

You may wish to consider tweaking the descriptions on github and especially hex.pm to make it more discoverable?

Where Next?

Popular in Screencasts Top

sevensidedmarble
Hey! Here’s a little video I made on how you can start using Neovim for Elixir/Phoenix development: If you like it, pleas...
New
zacksiri
Hey all! We just released 3 episodes on our site explaining how GenServer works. We also released a free episode that shows you how to s...
New
ElixirCasts
I made an episode where we implement passwordless authentication with the Veil library. You can watch it here: https://elixircasts.io/pa...
New
omgneering
This is a part of the ongoing elixir OTP series. The video walks through creating an application, talks about application structure and ...
New
ElixirCasts
I made an episode about deploying with Gigalixir. https://elixircasts.io/deploying-with-gigalixir
New
ElixirCasts
I made an episode for anyone wanting an introduction to testing with Elixir. https://elixircasts.io/introduction-to-testing
New
ElixirCasts
I made a video to cover the basics of routing in Phoenix. https://elixircasts.io/phoenix-routes
New
AlchemistCamp
https://alchemist.camp/episodes/guessing-game I’ve recently re-recorded Lesson 1 from Alchemist Camp. It’s significantly higher quality ...
New
ElixirCasts
I made an episode that shows how you can use the great Number package to convert numbers to different formats like currency, percent, and...
New
ityonemo
I’m doing a 7-part screencast that deep-dives into how Elixir (yup, that’s elixir, not erlang) does processes. Prerequisites are underst...
New

Other popular topics Top

stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
yurko
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 35421 110
New
sacepums
Hey guys. I'm new to elixir and im really stocked about it. But I ran into a bit of problem - I need to convert a date sting, for examp...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New

We're in Beta

About us Mission Statement