Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy Backpack for Laravel in production #5496

Closed
AlonMoshe opened this issue Apr 14, 2024 · 4 comments
Closed

Deploy Backpack for Laravel in production #5496

AlonMoshe opened this issue Apr 14, 2024 · 4 comments
Assignees
Labels

Comments

@AlonMoshe
Copy link

AlonMoshe commented Apr 14, 2024

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.

Copy link

welcome bot commented Apr 14, 2024

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:

  • Bug Reports, Feature Requests - Github Issues (here);
  • Quick help (How do I do X) - Gitter Chatroom;
  • Long questions (I have done X and Y and it won't do Z wtf) - Stackoverflow, using the backpack-for-laravel tag;
  • Showing off something you've made, asking for opinion on Backpack/Laravel matters - Reddit;

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
Copy link
Contributor

pxpm commented Apr 15, 2024

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:

  • clone your app repo
  • composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader
  • php artisan migrate --force
  • php artisan basset:clear && php artisan basset:cache ### this is the only thing related to backpack, the rest is Laravel standard. ###
  • php artisan optimize:clear

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

@jcastroa87 jcastroa87 self-assigned this Apr 15, 2024
@AlonMoshe
Copy link
Author

AlonMoshe commented Apr 17, 2024

Hi @pxpm, thanks for the response.

Problem solved.

The problem was with my Virtualhost configuration in Apache.

Once again, many thanks.

@AlonMoshe
Copy link
Author

Problem Solved - Solution was in Virtualhost configuration of Apache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

No branches or pull requests

3 participants