Deployment guidelines?

Hi all,

I’m currently writing a deploy script that makes use of rsync to deploy my Kirby 4 site to a shared hosting provider, and I noticed that there is no real “deployment” page in the docs or the cookbook. The only “official” place where I found for example the information which folders not to synchronize with rsync was the .gitignore file in the starterkit.

So I would suggest that this may be a good resource to have for beginners. The page could also cover the site/media cache folders and how/why to not include them in a deployment, or when it is wise to delete the cache folders.

What do you guys think? Or have I just missed it? I know that there are some articles about specific deployment scenarios, but I couldn’t find the “pure basics”…

No, couldn’t find anything either.

So basically you would never deploy the following folders:

  • media folder (is basically like a cache folder, can result in issues when deployed)
  • site/cache
  • site/sessions

Regarding files,

  • .gitignore (doesn’t hurt if you deploy it)
  • .htaccess (doesn’t hurt if you deploy it)

And then all the stuff that you create in your project that you don’t want to deploy (src files of your build pipeline etc.)

1 Like

@derjere i use rsync to deploy via bash script triggered by NPM scripts.

it allows deployments and content syncing from the remote. Also has a dry run mode which will show you what will change without actually changing it.

If you want to put your own script together, this is a good crash course Sync large quantities of files or directories between local machine and server with rsync

you can use a text file to exclude stuff which basically works like git ignore (file system depth doesnt matter)

should have put the media folder folder on the exclude list i gues… that can be different on the server vs local. You should probably add that.

Thanks so much, and good to know that I’m not (yet) going blind :smiley:
What is your opinion on deleting/emptying the “media” and “site/cache” folder after a deployment? Is it a good idea or rather useless?