$30 off During Our Annual Pro Sale. View Details »

The Perfect Neos Project Setup

The Perfect Neos Project Setup

There are many ways to start a new Neos-based project and there is a multitude of tools involved. These slides introduce a "perfect" way to set up a Neos project. A recording of the presentation is available at https://youtu.be/hWJSK0pE1H0

Karsten Dambekalns

April 13, 2018
Tweet

More Decks by Karsten Dambekalns

Other Decks in Programming

Transcript

  1. The Perfect
    Neos Project Setup

    View Slide

  2. Karsten Dambekalns
    Karsten Dumbledore

    View Slide

  3. View Slide

  4. The Perfect
    Neos Project Setup

    View Slide

  5. The Best
    Neos Project Setup

    View Slide

  6. A Good
    Neos Project Setup

    View Slide

  7. What I Consider A Good
    Neos Project Setup

    View Slide

  8. Disclaimer
    The term "best practice" along with "perfect" is very misleading.
    There is never the best solution, only a solution that is the best fit in
    a given situation.
    Keep your brain moving, question what you have and try something
    new every now and then.
    Take everything you are going to hear as something to think about,
    never as a rule.
    There is no silver bullet.

    View Slide

  9. Project Management

    View Slide

  10. Content First

    View Slide

  11. Who do we want to reach?
    What are their goals?
    What do we need to make reaching those
    goals possible?

    View Slide

  12. Create customised
    content types.
    No more unstructured
    blobs of text!

    View Slide

  13. Adopt an agile
    working mode

    View Slide

  14. Some truths
    Doing development in sprints is not SCRUM.
    Kanban does not magically finish your project.
    Not giving a fixed price (or even an estimate) to your
    client might be hard.
    But spending days or even weeks to come up with a
    plan that will inevitably change anyway would be
    waste.

    View Slide

  15. Get your project
    management right, so
    you can focus on the
    following things…

    View Slide

  16. Development
    “as such”

    View Slide

  17. Know your docs:
    manual, references,
    API

    View Slide

  18. flowframework RTD
    Flow
    Requirements, Installation, Configuration

    View Slide

  19. Neos references RTD
    Flow references
    Neos references

    View Slide

  20. neos.github.io

    View Slide

  21. Know your options

    View Slide

  22. Settings.yaml

    View Slide

  23. Know your ecosystem

    View Slide

  24. neos.io/download-and-extend/
    packages.html
    packagist.org

    View Slide

  25. discuss
    discuss.neos.io

    View Slide

  26. Stay focused

    View Slide

  27. Implement only what
    you need.
    Don't use a package
    you only need 10% of.

    View Slide

  28. An example is not
    using Neos.NodeTypes

    View Slide

  29. Write tests

    View Slide

  30. View Slide

  31. Write useful tests

    View Slide

  32. Do the dishes

    View Slide

  33. View Slide

  34. View Slide

  35. Learn and understand

    View Slide

  36. View Slide

  37. But… eventually you
    must understand the
    tools you use.

    View Slide

  38. Think about Fusion.
    It seems intimidating at first, then you
    start to get the hang of it.
    And think "Ah, that's how it works!”
    Except it doesn’t.
    And then things start to feel awkward.

    View Slide

  39. Keep learning. Adopt new
    things. Question your own
    best practice.
    Take the time, it's worth it.

    View Slide

  40. Development
    Environment

    View Slide

  41. Tools

    View Slide

  42. Developers being able to
    chose their tools are happier.
    Let me choose some

    tools for you…

    View Slide

  43. vi vs. emacs

    View Slide

  44. IDE vs. Editor

    View Slide

  45. Use an IDE

    View Slide

  46. phpstorm screenshot

    View Slide

  47. PhpStorm
    by Jetbrains

    View Slide

  48. Neos plugin
    by Christian Vette 

    https://github.com/cvette/intellij-neos
    Fluid plugin
    by Stefan Galinski
    https://www.sgalinski.de/typo3-produkte-webentwicklung/typo3-fluid-phpstorm-intellij/

    View Slide

  49. ZSH

    View Slide

  50. Oh-My-ZSH
    and the
    Flow Framework Helper

    View Slide

  51. flow helper video

    View Slide

  52. github.com/sandstorm/
    oh-my-zsh-flow-plugin

    View Slide

  53. VCS

    View Slide

  54. View Slide

  55. Using a version control
    system is not optional.

    View Slide

  56. Technology

    View Slide

  57. Use the newest
    version of PHP

    View Slide

  58. View Slide

  59. Stay up-to-date

    View Slide

  60. An update a day, keeps
    the downtime away

    View Slide

  61. Check security
    Consider using a service like Symfony Security
    Monitoring or implement something using the
    SensioLabs Security Checker or roave/security-
    advisories.

    View Slide

  62. Redis

    for caching

    View Slide

  63. Elasticsearch

    You Know, for Search

    View Slide

  64. PostgreSQL
    Can roll back DDL

    View Slide

  65. Technologies like these can add a lot of value to a project
    and knowing them allows to apply them when needed.

    View Slide

  66. Works on my machine

    View Slide

  67. Running things locally
    For ages all I had was a local setup
    of Apache with mod_php and name-
    based virtual hosting, combined
    with dnsmasq.

    View Slide

  68. Just clone any Flow-based project
    into a directory and it's available
    through the web server.

    View Slide

  69. Must switch globally between PHP
    versions if needed, every project
    has the same environment (PHP
    modules, settings, …), specific tools
    a project needs would need to be
    installed on my machine, …

    View Slide

  70. View Slide

  71. With Docker every project can be
    run in an environment that can
    closely match the production
    environment.

    View Slide

  72. Docker Compose provides a way to
    define the needed environment
    using a simple YAML file.

    View Slide

  73. View Slide

  74. View Slide

  75. docker-compose-
    up.sh

    View Slide

  76. github.com/neos/Neos.NeosIo
    docker-compose.yml
    docker-compose-up.sh
    .env

    View Slide

  77. Make yourself
    comfortable.
    It will make you more
    productive.

    View Slide

  78. Managing
    Dependencies

    View Slide

  79. Created with graph-composer

    View Slide

  80. Composer

    View Slide

  81. View Slide

  82. Composercat

    View Slide

  83. composercat
    screenshot

    View Slide

  84. Semantic Versioning

    View Slide

  85. semver checker

    View Slide

  86. semver.mwl.be

    View Slide

  87. Add composer.lock

    to version control!

    View Slide

  88. composer install
    is different from
    composer update

    View Slide

  89. Keep things together

    View Slide

  90. Dependency chain
    vs.
    loading order

    View Slide

  91. View Slide

  92. View Slide

  93. Repository of

    test/a
    Repository of

    test/b
    Repository of

    test/distribution
    Need to commit in
    three repositories
    Must update
    composer.lock after
    every change to test/a
    and test/b

    View Slide

  94. Repository of

    test/b
    Repository of

    test/distribution

    and test/a
    Need to commit in two
    repositories; must
    update composer.lock
    after every change to
    test/b

    View Slide

  95. Repository of

    test/distribution and
    test/a and test/b
    Need to commit in one
    repositories
    Must update composer.lock
    only after changes to
    dependencies in test/a or
    test/b

    View Slide

  96. • Use path repository for
    composer
    • Exclude source folder from IDE
    • Ignore Packages in VCS
    • Composer will “install” via
    symbolic links
    • Dependencies are resolved as
    expected
    • One repository to rule them all

    View Slide

  97. monorepo manifest

    View Slide

  98. composer create-project
    neos/splash
    This is still work
    in progress, but
    hopefully useable
    soon…

    View Slide

  99. Dependencies are not
    a necessary evil,
    but an important part
    of your project

    View Slide

  100. Managing
    Configuration

    View Slide

  101. Configuration
    overrides

    View Slide

  102. Application

    context

    View Slide

  103. Application contexts
    (can) have a hierarchy

    View Slide

  104. Development Staging Live
    Development Production/Staging Production/Live

    View Slide

  105. Development Production/Staging Production/Live

    View Slide

  106. Development Production/Staging Production/Live

    View Slide

  107. Development Production/Staging Production/Live

    View Slide

  108. View Slide

  109. Define
    FLOW_CONTEXT
    on all servers

    View Slide

  110. Configuration is code,
    treat it accordingly

    View Slide

  111. Hosting & Deployment

    View Slide

  112. Automate deployment
    Surf – Deployer

    View Slide

  113. Automate automation
    Jenkins – Travis CI – GitLab CI – Codeship – CircleCI

    View Slide

  114. Hosting options

    View Slide

  115. simple

    View Slide

  116. simple
    uberspace

    View Slide

  117. managed

    View Slide

  118. managed
    proServer – all-inkl.com

    View Slide

  119. complex

    View Slide

  120. complex
    Digital Ocean – Docker – Kubernetes

    View Slide

  121. nightmare

    View Slide

  122. You have a managed server, but the hoster is inflexible.
    You must not change server settings yourself, but the
    admin is in a meeting. No access to log files, but the
    support sends the logs except the interesting line at the
    end. SSH is possible, but permissions don’t match. You
    need PHP 7, but are stuck at version 5.3, because of other
    customers on the same server.
    Every developer at some point in history

    View Slide

  123. Hosting options

    View Slide

  124. Flownative Beach
    www.flownative.com/beach.html

    View Slide

  125. Karsten Dambekalns
    karsten@flownative.com
    @kdambekalns
    www.flownative.com
    @flownative

    View Slide

  126. View Slide