#List of commands to run on production server

1 messages · Page 1 of 1 (latest)

bright crystal
#

In JS world you do a production build with npm run build and that's it. You can ship it and it just works, in e.g. Adonis case the only difference is the production environment variable and you get 50 000 req/s out of the box without any cluster mode etc.

The question is, how do I achieve full production mode similar to npm run build in Laravel 10. Forget Livewire, Inertia, etc. Just pure L10 installation that I want to test for hello-world homepage in production.

Is there a list of commands similar to npm run build that would get me there? I want to create a checkbox type of deployment list I follow for each Laravel project.

tepid raven
#

If you just display "Hello, World!" you won't need much, really.
Just run install --no-interaction --prefer-dist --optimize-autoloader --no-dev

You might want to run some Artisan commands related to caching, and queues maybe.. but all of that depends on your setup.

On a basic setup I would run

php artisan cache:clear
php artisan config:cache
php artisan route:cache
bright crystal
#

See, that's the problem. "You might", "it depends", "I would"... I really don't understand how this can compete with something like deploying Adonis. Depoying Laravel on your own is almost impossible for a beginner.

#

I have had a very bad experience when it comes to deploying Laravel to production.

#

I am coming from the Adonis world and it's insane how easy it is there.

#

You have to study Laravel a few months at least to be good at it. Adonis, a weekend is enough.

#

But I am digressing now.

#

Still, a bad taste in my mouth coming from Adonis. Perhaps it's the PHP to blame, I don't know.

somber solar
#

@bright crystal stick with Adonis then :)

I am really questioning if you actually understand nodejs, if you are not able to quickly understand how to host LEMP on any server or by using a heroku-like service for php.

Its nothing to do with laravel.

You can do php artisan serve if you want the npm run build equivalent.

For your adonis app you still need to run it behind some sort of proxy, as you never expose the service directly to the open world. 50k req/s on a hello world is nothing and yes, laravel is slower out of the box but you do not compare them by req/s anyways.

As that seems to be your most concern, fastify clocks in at 70k, laravel at 16k (given on a random benchmark).

Lastly, your server setup for nodejs is very similar to the one of laravel, just that instead of node you install php. (LEMN/LEMP)

bright crystal
#

php artisan serve is more like npm run start

#

and the questioning of node.js and me was inappropriate given your bad example.

#

50k req/s on a hello world is nothing

somber solar
#

Just like your behaviour on this discord, how does that feel?

bright crystal
#

This is a wild claim given Gin will give me around 50k req/s or even less

#

What PHP framework will give you that on a single thread M1 machine?

somber solar
#

You did not understand, the important bit is the hello world

bright crystal
#

Spiral will yield around 6 - 10k

#

And it's using Go server RoadRunner

#

Laravel is giving me sub 500 req/s all the time for hello world

#

Next is around 2500

#

pure php on nginx is I think around 4000 or 5000 req/s

#

but that's just serving one file like `<?php echo "hello world"; ?>

#

And keep in mind that this is a m1 macbook

#

and not a 2gb or 4gb ram DO droplet.

#

DO will be much slower than m1

#

that's why req/s is quite nice for api

#

where requests are flying back and for, especially if you have also a mobile app accompanying your web.

somber solar
#

compare your req/s with actual data and a proper service architecture if you want to know the req/s

bright crystal
#

Adonis in cluster mode

#

will give areound 70k req/s

#

actually 72 - 75 which is Fastify numbers

somber solar
#

so, why not use adonis for api then?

bright crystal
#

I am

#

😉

somber solar
#

thats awesome

bright crystal
#

I just wanted to try Laravel 10 for api how it compares and just the setup is 10x more complicated

#

I want be jumping ship. I dislike PHP. Also, I find Adonis more user orientated and less buisness orientated.

#

Laravel is nowadays about accompanied business solutions. It's inavitable I guess if you become very popular.

#

You can host and deploy and even do a basic CI/CD using just your selfhosted git and PM2 and pm2 deploy

#

with Adonis or other JS apps.

somber solar
#

tell me something new

bright crystal
#

for Laravel there is a gazillion stuff you have to setup and know.

#

😉

somber solar
#

*php

bright crystal
#

It reminds me Clojure

somber solar
#

Docker wants to have a word with you

bright crystal
#

Laravel and Clojure (if you want to use it for a webserver) are similarly convoluted and hard to get going.

somber solar
#

Ever heard of rust, go, python?

bright crystal
#

It's nice, but in the docs there is sail and sail is just for development. Hmm, let me guess , you should use Forge... and hmm... for smooth zero downtime... you should use Envoyer 😉

#

I guess the Lambo is not cheap 😉

somber solar
#

Sail uses docker but sail is not docker

bright crystal
#

sail is a name of a project

#

that is using docker

somber solar
#

You are throwing in random things at this point for the sake of it

#

whats your goal, wanna keep on bitching or actually be helped?

bright crystal
#

the point is, I don't blame people and youtubers and others to pick up Next insted of Laravel

#

the entry barrier difference is enormous

#

or SveltKit or Nuxt

#

or Adonis is you want a nice backend like Laravel

#

OK, signing off.

tepid raven
verbal oxide