/site/accounts and deployment

Content created by users in the Panel resides in /content so it is easy enough to use a separate Git repository to manage changes.
But how do you deal with accounts? Every Kirby user can modify his data, change his password, add an avatar (that will go in /assets/avatars, which is another version control problem in itself).

My problem is: I’m currently evaluating deployment strategies, and one of the most widespread seems to use a bare Git repository on the server, then checkout the work tree when something is pushed to the server (thanks to a post-receive hook) that overwrites the site’s files. But then it would overwrite the accounts directory too.

We can’t set a custom path for accounts, otherwise we could move them to the content folder or somewhere.

I can see a few ways to deal with it:

  • moving accounts to content then use symlinks (any security concerns here? Does it even work?)
  • pulling form a standard repo, instead of checking out file from the bare repo (but if there is a conflict the live site is wrecked?)

I’m no Git/deployment wizard though, so I’m stuck. And you, what do do?

In fact, out of the folders in /site, the /accounts folder is the (only) one that can currently be moved elsewhere. Check out the Roots class /kirby/kirby/roots.php.

Damn! I remembered Lukas told about such a feature a long time ago, and even found his PR on Github but it’s still open and I wrongly concluded it was not yet in core.
Thank you for pointing me to /kirby/kirby/roots.php, very interesting!
Also avatars can also be moved, that solves my other issue :gift: :smiley:

You shouldn’t put the accounts into the content dir, otherwise they would be accessible over HTTP. You can however move them completely out of the webroot and set the root in your site.php as Sonja proposed.

Good point. What I had in my was something like

mysite
    kirby
    panel
    site
    …
mysite-content
    content
    avatars
    accounts

Where mysite is a bare repository on the server, and mysite-content a standard one so I can version changes made by editors (probably with the git-commit-and-push-content plugin).