{overmind}

intro & use

101

Un remplaçant à foreman?

# reasons

Procfile 101

limitations de foreman

tmux

overmind

Procfile

# 101
<process type>: <command>
  
web: bundle exec rails server -p $PORT

worker:  bundle exec rake jobs:work

"je veux lancer plusieurs services en local"

... sans utiliser docker

limitations de foreman

# backend

mélange de logs

performance

pty vs file

!debug

tmux (101)

# global

terminal multiplexer

sessions multiples

veritable pty

equivalent à screen

overmind

# actor

tmux based

1 session par service/commande

debug friendly

User / actor

user = User.first

# Check if enabled without an actor
Flipper.enabled?(:verbose_logging) # false

# Check if enabled for the given user
Flipper.enabled?(:verbose_logging, user) # false
# actor

User / actor: turning on / off

user = User.first

# enable
Flipper.enable_actor(:verbose_logging, user)

# disable
Flipper.disable_actor(:verbose_logging, user)
# actor

but that's rails console, we don't need that

Group: what we want


# definition in the flipper initializer
Flipper.register(:admins) do |actor, context|
  
  actor.respond_to?(:admin?) && actor.admin?

end

# feature check

user  = User.where(admin: false).first # user who returns false for admin?
Flipper.enabled?(:documentation, user) # false


admin = User.where(admin: true).first # user who returns true for admin?
Flipper.enabled?(:documentation, admin) # true
# groups

block based target definition

flipper-ui

# Flipper UI

/flipper

flipper-ui

# Flipper UI

/flipper access control

Rails.application.routes.draw do
  # ..

  constraints CanAccessFlipperUI do
    mount Flipper::UI.app(Flipper) => "/flipper"
  end

  # ..
end

# well, that's not Meta
class CanAccessFlipperUI
  def self.matches?(request)
    request.env["warden"].user&.team&.root?
  end
end

flipper-ui

# Flipper UI

configuring a feature

expressions

#! BONUS

power feature to look into

# define the property
must_be_21 = Flipper.property(:age).gte(21)
# enable a feature for with property as condition
Flipper.enable :night_club, must_be_21

# Under age
Flipper.enabled? :night_club, User.new(age: 18) #=> false

# Of age
Flipper.enabled? :night_club, User.new(age: 21) #=> true


# Combining
over_21 = Flipper.property(:age).gte(21)
paid = Flipper.property(:paid).eq(true)
vip = Flipper.property(:vip).eq(true)

Flipper.enable :night_club, Flipper.all(over_21, Flipper.any(paid, vip))

https://www.flippercloud.io/docs/features/expressions

Made with Slides.com