Static content directory together with automatic site deployments

Hi guys, I’m working on a custom kirby build for my portfolio site.

My current install works as follows:

Hosted on Digital Ocean Ubuntu LAMP Stack Droplet, I have also configured dropbox to sync with my local machine so I can easily edit and update content.

I deploy site updates (other than content) using deploybot, and how this works is, deploy pushes every new build to a /var/html/releases folder and appends a release number to the end of the folder name for each build and then symbolic links the latest build to /var/www/current

I’ve updated my apache2 config to point to /var/www/current but as deploy creates a new folder for the site each time it’s deployed I have to keep the content folder outside of this if I wish to manage my content via dropbox.

I’ve managed to move my content folder out to /var/www/content and this is successfully syncing with dropbox.

I configured this by creating a site.php in the root of the site /var/www/current this file will get placed by deploybot at the end of each deployment so as not to break my local install.

My site loads fine, displays all my content and updates via dropbox however my images won’t load. This is where I’m out of ideas. I’ve enough linux experience to have got me to this point but I’m not that experienced in PHP so I’ve likely butchered my site.php file to see my files but incorrectly. Any help would be great guys. I’m happy to write my process up in detail to help other users achieve a similar install if interested.

Kirby Docs - Custom folder Locations

My custom site.php

    <?php

// Stored on the servers as site.php to override the default kirby content folder

$kirby = kirby();
// configuration goes here

// changing the directory
$kirby->roots->content = '/var/www/content';
// changing the url
$kirby->urls->content = $kirby->urls()->index() . '/content';

?>

The problem is that the content directory is now outside of the webroot, meaning that you can’t access the files over HTTP, which is a requirement to make the images or other files work.

Can you configure deploybot to run a custom command inside the site directory after deploying? If so, you can let it link the content directory from /var/www/content/ to /var/www/current/content. You can then remove the site.php again and your images should work.

Thanks for the idea, I’ll give this a try and let you know if it works

Did you have the chance to try it out? Did it work?

Hey Lukas,

Thanks for checking in, Simplest solutions often work best :wink:

It’s close but then I was having some issues with folder permissions and panel, so I’m doing a chmod on the content directory post deploy and that seems to solve the issue, however I’m not having another strange problem where dropbox see’s my changes and it appears to sync but doesn’t update correctly on the site. Once I get to the bottom of it I’ll post the solution.