Closed ericjanofski closed 1 year ago
I see no documentation about basset. Am I supposed to be running commands with basset?
Hey @ericjanofski . Sorry for your bad experience, basset should be a tool to make developers life easier, not difficult.
From my experience with Sail, the problem usually is the symlink. You can try to run php artisan basset:check
to see if it's working ok.
You can, and should run basset commands. Basset will be part of your build pipeline, or pushing to prod, whatever you call it.
Basset converts the cdn links into local files when pushing to production if you configure it to do so. You can find a detailed description in https://github.com/Laravel-Backpack/basset/blob/main/readme.md
Let me know what you've tried and it's not working, maybe I get a better picture of your issue.
Cheers
Thanks for the assist. When I run php artisan basset:check I get:
Initializing basset check ......................................................................... DONE
Checking cache storage ............................................................................ DONE
Fetching a basset ................................................................................ ERROR
ERROR cURL error 7: Failed to connect to krhc-digital-donor-wall.test port 3104 after 3 ms: Connection refused
APP_URL is correct My public disk reads as such: 'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), 'url' => env('APP_URL').'/storage', 'visibility' => 'public', 'throw' => false, ],
Was there some initial setup that needed to happen that I didn't do? Again, I don't remember seeing any basset documentation when installing Backpack.
Could this have something to do with me setting my FILESYSTEM_DISK=s3 in the .env file?
Could this have something to do with me setting my FILESYSTEM_DISK=s3 in the .env file?
I don't think so, no. Basset will use the public
disk or any disk specified in basset config. If you would like basset to use s3 you would need to set it in basset config.
I see you use a custom port. By any chance your APP_URL
also include the port? like: 'APP_URL' => 'https://krhc-digital-donor-wall.test:3104',
if not, do you mind adding it ?
Let me know. Cheers.
The port is present in my .env file app_url.
Is there supposed to be a basset config file in my config section? I don't see any basset config.
thank you!
It's strange I can see the asset here: http://krhc-digital-donor-wall.test:3104/storage/basset/vendor/backpack/basset/tests/Helpers/basset-test.js and it renders the test fine in a browser, but the basset:check times out even though it's pointing to the same file.
There will be a config file if you publish it, it's optional https://github.com/Laravel-Backpack/basset/blob/main/readme.md#installation
php artisan vendor:publish --provider="Backpack\Basset\BassetServiceProvider"
will get you the config file.
Can you post a screenshot of your console errors in the developer console ?
What's the output of php artisan basset:clear && php artisan basset:cache
?
Cheers
I will ping @promatik here. If the above does not work I am a bit out of ideas but maybe @promatik can read up on what we've tried and come up with a solution.
Cheers
okay, progress, I was running the php artisan command in the sail instance and it wasn't working. when I simply ran php artisan basset:clear, basset:cache and then basset:check, it seemed to work. Can you share what I would need to do to push my site to production? Is there a command similar to npm run build that would be what finalized the files before I push my git repo?
Thanks, I am happy you found the issue 🙏
It should be php artisan basset:fresh
(it's the above commands combined clear and cache), every time you push to production. Basset will get the links from the files, cache them and serve the assets as local files.
If you are uploading using a zip, vapor or some other exotic thing there are docs on the basset readme explaining some caveats/working process to deal with some specific scenarios.
Let's say, the "usual deploy" would only need basset:fresh 👍
Let me know if I can help you with something else.
Cheers
Pedro, with your help, I have it all straightened out. Thank you for taking the time to assist. It's very much appreciated.
Turns out since the storage folder is .gitignored, I had to run php artisan basset:fresh on the production server.
I do believe it would help out others if there was some documentation of the basset components. Perhaps a section on deploying? Not sure what would be best here, but I know it was a bit difficult to learn about this service after problems arose after deploying. Is it just me? :)
Anyway, thank you so much!
First of all, I have the APP_URL set properly. I've pushed the site to production and I get no css. If I set the APP_ENV to local, i get css, but the pages say they are expired.
I've developed locally with laravel sail and vite. I've ran npm run build to build the css files.
Can anyone tell me what is up with this? It's been a fight to get this to this point and I have to push this live for review!