spbaniya's avatar

How to separate public and storage folder in Lumen

To change the public and storage folder, I tried these code in bootstrap/app.php:

$publicPath = env('PUBLIC_PATH', app()->basePath() . DIRECTORY_SEPARATOR . 'public');
$storagePath =  env('STORAGE_PATH', app()->basePath() . DIRECTORY_SEPARATOR . 'storage');
$app->instance('path.config', app()->basePath() . DIRECTORY_SEPARATOR . 'config');
$app->instance('path.storage', $storagePath);
$app->instance('path.public', $publicPath);

And added different folder names for each PATH but still the application is picking the old folder names. Please suggest, what am I missing and how could I fix the issue

Lumen: ^6.3

0 likes
2 replies
martinbean's avatar

@spbaniya Why are you trying to change the built-in paths in Lumen? What are you looking to achieve?

spbaniya's avatar

For deployments, I want to separate, user files and application code.

So in general I want to achieve this: While deployment, I want to make the deployment least down time. And for that, I

  1. Clone latest production branch as separate folder
  2. Do composer install on the new folder
  3. Create symlink of the new folder to live

So for this reason, I need to separate storage and public as there will be user's files

Please or to participate in this conversation.