Laravel-Backpack / CRUD

Build custom admin panels. Fast!
https://backpackforlaravel.com
MIT License
3.17k stars 896 forks source link

Deploy Backpack for Laravel in production #5496

Closed AlonMoshe closed 7 months ago

AlonMoshe commented 7 months ago

Bug report

What I did

  1. Started a new Laravel project: composer create-project laravel/laravel:^11.0 example-app
  2. Create a model and migration
  3. set .env
  4. Installed backpack:
    composer require backpack/crud php artisan backpack:install

What I expected to happen

When I browse to app_url/admin I expect to see backpack login page.

What happened

when I browse to app_url/admin, I get "The requested URL was not found on this server." instead. If I browse to app_url I see Laravel screen

What I've already tried to fix it

  1. Make sure permission and ownership of files are ok.
  2. Firewall is open
  3. Experimenting, I noticed that if in the .env file environment is set to production, backpack will not install , i.e., the installation gets stuck.

Is it a bug in the latest version of Backpack?

Yes

Just for the record, the system on which I am working is a VPS, AlmaLinux 8.9

After I run composer update backpack/crud the bug... is it still there?

Yes.

However, I get a message from composer that reads:

Composer could not detect the root package (laravel/laravel) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version Loading composer repositories with package information Updating dependencies Nothing to modify in lock file Installing dependencies from lock file (including require-dev) Nothing to install, update or remove Generating optimized autoload files

Illuminate\Foundation\ComposerScripts::postAutoloadDump @php artisan package:discover --ansi

INFO Discovering packages.

backpack/basset ............................................................................................................................. DONE backpack/crud ............................................................................................................................... DONE backpack/generators ......................................................................................................................... DONE backpack/theme-tabler ....................................................................................................................... DONE creativeorange/gravatar ..................................................................................................................... DONE laravel/sail ................................................................................................................................ DONE laravel/tinker .............................................................................................................................. DONE nesbot/carbon ............................................................................................................................... DONE nunomaduro/collision ........................................................................................................................ DONE nunomaduro/termwind ......................................................................................................................... DONE prologue/alerts ............................................................................................................................. DONE spatie/laravel-ignition ..................................................................................................................... DONE

86 packages you are using are looking for funding. Use the composer fund command to find out more!

@php artisan vendor:publish --tag=laravel-assets --ansi --force

INFO No publishable resources for tag [laravel-assets].

No security vulnerability advisories found.

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

PHP VERSION:

8.3.6

PHP EXTENSIONS:

Core, date, libxml, openssl, pcre, zlib, filter, hash, json, pcntl, random, readline, Reflection, SPL, session, standard, sockets, bz2, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, iconv, exif, mysqlnd, PDO, Phar, SimpleXML, sodium, sqlite3, tokenizer, xml, xmlwriter, xsl, mcrypt, mysqli, pdo_mysql, pdo_sqlite, xmlreader, zip, Zend OPcache

LARAVEL VERSION:

11.3.1.0

BACKPACK PACKAGE VERSIONS:

backpack/basset: 1.3.1 backpack/crud: 6.7.6 backpack/generators: v4.0.5 backpack/theme-tabler: 1.2.8

Many thanks,

Alon.

welcome[bot] commented 7 months ago

Hello there! Thanks for opening your first issue on this repo!

Just a heads-up: Here at Backpack we use Github Issues only for tracking bugs. Talk about new features is also acceptable. This helps a lot in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that.

Backpack communication channels:

Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome awesome community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch.

Thank you!

-- Justin Case The Backpack Robot

pxpm commented 7 months ago

Hey @AlonMoshe

Thanks for the question. Indeed, you shouldn't "install" backpack in production. The installation process should be run only locally first time you require the package.

When you deploy to production the steps should be more or less like this:

There may be some additional steps that may be required depending on your project like restarting the queue workers etc, but that's outside of backpack scope.

Let me know if that helps.

Cheers

AlonMoshe commented 7 months ago

Hi @pxpm, thanks for the response.

Problem solved.

The problem was with my Virtualhost configuration in Apache.

Once again, many thanks.

AlonMoshe commented 7 months ago

Problem Solved - Solution was in Virtualhost configuration of Apache.