Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Modern Make for modern (Rails) programmers

Modern Make for modern (Rails) programmers

Ivan Nemytchenko

August 05, 2021
Tweet

More Decks by Ivan Nemytchenko

Other Decks in Programming

Transcript

  1. Modern Make
    for
    modern (RAILS) developers
    Ivan Nemytchenko, @inem, inem.at
    RubyConf Brasil 2020
    CRASH COURSE

    View Slide

  2. Ivan Nemytchenko
    • rubyist since 2006
    • former GitLabber
    • teacher
    • railshurts.com author
    • freelance/consulting

    View Slide

  3. • painlessrails.com

    View Slide

  4. http://urban-connect.ch

    View Slide

  5. What to expect here
    • What’s the problem?
    • The basics
    • Advanced stuff
    • Examples from real project
    • Principles

    View Slide

  6. Make?

    View Slide

  7. What’s the problem?

    View Slide

  8. Modern Developer?
    • Dev+Ops
    • Multiple stacks (Rails + JS for example)
    • Multiple projects
    • Multiple environments (dev, ±docker, ssh)

    View Slide

  9. Command line interface tools
    • git
    • ssh
    • rails
    • bundle
    • docker
    • docker-compose
    • heroku
    • aws
    • ansible
    • ansible-playbook
    • yarn
    • …

    View Slide

  10. Command line interface tools

    View Slide

  11. What’s the problem?
    ansible-playbook -i inventory/production --
    tags "deploy" app-server.yml --become-
    user=app --extra-vars=extra.txt --vault-
    password-file="~/.ansible/vault.txt" -vvv

    View Slide

  12. What’s the problem?
    ansible-playbook -i inventory/production --
    tags "deploy" app-server.yml --become-
    user=app --extra-vars=extra.txt --vault-
    password-file="~/.ansible/vault.txt" -vvv
    Imperative, not declarative!

    View Slide

  13. • Imperative, not declarative
    • Implementation, not semantics
    • Have to remember a lot of low-level
    details
    • Outdated README-s
    What’s the problem?

    View Slide

  14. Deployment
    ansible-playbook -i inventory/production --
    tags "deploy" app-server.yml --become-
    user=app --extra-vars=extra.txt --vault-
    password-file="~/.ansible/vault.txt" -vvv

    View Slide

  15. How about?
    make deploy

    View Slide

  16. make deploy

    View Slide

  17. Run tests
    MINITEST_REPORTER=SpecReporter bundle exec
    bin/rails test

    View Slide

  18. Make test

    View Slide

  19. Yay!
    • You can use Make now!

    View Slide

  20. Modern Make
    In practice

    View Slide

  21. Why not … ?
    • Rake
    • Yarn
    • Bash scripts

    View Slide

  22. USE Make
    AS GLUE BETWEEN
    TECHNOLOGIES!

    View Slide

  23. Principles
    • No instructions in Readme!
    • Semantics first!
    • Duplication is ok!
    • StackOverflow → Makefile

    View Slide

  24. Modern make
    http://makefile.site
    http://re.dopo.st/201015204327
    http://inem.at

    View Slide