Deploying Kirby with Dokku ("The home page does not exist")

Hey, I finished the implementation of my new blog in Kirby 4 locally. I now want to deploy it to my server and was planning on using Dokku like all my other apps. I’ve been following the instructions in the cookbook.

Unfortunately once I deploy it and access the url I’m seeing this error.

Kirby\Exception\NotFoundException thrown with message "The home page does not exist"

Stacktrace:
#6 Kirby\Exception\NotFoundException in /app/kirby/src/Cms/App.php:1239
#5 Kirby\Cms\App:resolve in /app/kirby/config/routes.php:164
#4 Kirby\Http\Route:{closure} in [internal]:0
#3 Closure:call in /app/kirby/src/Http/Router.php:120
#2 Kirby\Http\Router:call in /app/kirby/src/Cms/App.php:338
#1 Kirby\Cms\App:call in /app/kirby/src/Cms/App.php:1191
#0 Kirby\Cms\App:render in /app/index.php:5

Any idea on how to approach this? Is there something that changed in Kirby 4 and the cookbook isn’t up to date any more?

Thanks!

The reason for the above error message was that if you set up the site locally already you’ll then have to copy the content / media / site directory to the newly created volume as otherwise it’s missing. Fixed this by copying the files.

Unfortunately I’m still running into 404 issues now, the home page loads but any link I click is 404’ing, locally everything worked nicely.

Any ideas on the difference between a local environment and the dokku environment?

PS: Could be updated in the cookbook:

What’s missing in the cookbook is that you have to set the base url to your full https url, as otherwise your assets (css / js) will try to load from the http base url (as it’s behind the dokku nginx load balancer + lets encrypt if you follow the cookbook) which will fail.

This is now all resolved, there were 3 issues in total so I’m detailing them here for others who run into the same issue:

  1. If you use a persistent volume in Dokku to keep your content / media / site directories and you’ve set up your site locally already with all the content / modifications you want you’ll have to rsync the content of these folders from your local machine to the persistent volume folders. The are most likely located in /var/lib/dokku/data/storage/<your persistent directory>.

  2. If you are using dokku letsencrypt:enable <app> to host your app under a https url you’ll have to set the urls field in your config to the https url, otherwise Kirby doesn’t seem to understand it’s running behind https and the asset urls (JS, CSS) will fail to load

  3. Make sure you have a .htaccess file in the root level of your project. You can download the one from the plainkit repository.