HTTP 500 Laravel 5 app using dokku on digital ocean - laravel-5

So i followed the tutorial about deploying a larval 5 application using dokku and it worked but i have a HTTP ERROR 500
can't see any logs using dukku logs
so i used
dokku run app /bin/bash
started another local server in the app directory and curl it to see in storage/logs
No supported encrypter found. The cipher and / or key length are invalid.
which mean the APP_KEY is incorrect (i have it in .ENV in my local env) but when i push to my VPS it remove the whole line
using
dokku run wizzserv php artisan key:generate
result in
Application key [xxxxxxxxxxxxxxxxxxxxxxxxxxxx] set successfully.
but it's not working
TL;DR
pushed my code which work locally to Digital Ocean using dokku
deployement succeed but getting HTTP 500
error about APP_KEY random string
dokku remove it from .ENV

i corrected it by just add
dokku config:set MyApp APP_KEY=XXXXXXX
where i generated the xxxxxxx using dokku run AppName php artisan key:generate
now it's working

Related

Heroku Laravel 500 (Internal Server Error) oauth-public.key does not exist

OAUTH Public Key is Here
oauth-public.key is exist
I uploaded a question board using Laravel, Vue, RESTful API on Heroku.
When I log in and add a question, I get a 500 (Internal Server Error) called
"Key path \"file:///app/storage/oauth-public.key\" does not exist or is not readable".
Github: https://github.com/2020software/Sample-Vuedev
Heroku Question board: https://samplevueqa.herokuapp.com/
Login id : text#example.com
Login pw: password
Thank you for those who have solved the same problem!
Verify that the file in fact doesn't exist, rather than just having incorrect permissions
Verify that it also doesn't exist in app/storage/app. I've had it happen where Passport's default location for creating new keys didn't quite match where the Auth middleware was looking. You can fix this in config/filesystems.php if need be.
Make sure to run php artisan passport:keys
I runned heroku ps:exec -a your_app_name next run php artisan passport:keys I solved!!

Install laravel passport in laravel vapor environment

Installing Passport worked for the local environment of Laravel Vapor. But after deploying it to production an error occured:
After searching the error message it seems that we need to run php artisan passport:install like mentioned here.
How can we do that with Laravel Vapor? Is there a way to get access to the server via ssh?
Vapor doesn't have a permanent filesystem; each HTTP request hits a new Lambda instance.
The docs have some info on deploying Passport keys. On Vapor, your best bet is going to be using Vapor's "secrets" system to put them into the environment, then doing:
php artisan vendor:publish --tag=passport-config
which will then provide the option to load the encryption keys from your environment variables:
You'll want to name your secrets PASSPORT_PRIVATE_KEY and PASSPORT_PUBLIC_KEY in Vapor.

Laravel deployment with deployer fails updating shared/.env file

Im quite new to laravel and the concept of CI/CD. But i have invested the last 24 hours to get something up and running. Actually i'm using gitlab.com as repo. There i have configured the CI/CD functionality.
The deployments should be done to SRV1 which has configured its corresponding user with a cert. The SRV1 should then clone the necessary files from the gitlab repo by using deployer. The gitlab repo also has the public key from SRV1 user. This chain is working quite good
The problem now is, that i want to update the .env file placed under shared/.env using the .gitlab-ci.yml file. But for some reasons, this won't work:
Here is my file: https://pastebin.com/RsjQf9L3
Basically, the deployment is done by this command sequence:
- cp .env.staging .env
- php artisan key:generate
- php artisan config:clear
- php artisan config:cache
- php artisan deploy dev.morast.ch -s upload
I thought, that wen doing
- cp .env.staging .env
It will replace the content of shared/.env with the content of .env.staging
In fact, the file gets replaced (i see it due to the date code) but the content don't equals the .env.staging file.
What do i wrong? Thanks for your help.
By the way, i always get an
The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.
Maybe this could also be related to my .gitlab-ci.yml file?
thanks!

Email verification link using localhost in a production environment

I have a Laravel 6.7.0 app deployed on AWS Elastic Beanstalk.
The environment variables are set using Elastic Beanstalk config files (not .env file).
I have set the env variables to production including the APP_URL. The env('APP_URL') and the config('app.url') are returning the correct value (which is my live domain name) except for the email verification link which is returning localhost. The APP_URL is working fine in all other emails including the password reset email.
I tried cache:clear and config:clear on the server but still no luck. Any ideas on how to debug this?
I guess you should run
php artisan queue:restart
if you are running queues for sending e-mails
Your Email verification link display local host on production because url is wrong change url to {{url('/verificationlink')}}

SSL Certificate on Laravel Development

I have an application which i am using 'php artisan serve' command to run it on my mobile. I want to test it on my mobile but i have an API which requires HTTPS. So how can i configure this? I want to test this before I put this live.
Here is how my artisan command looks like:
php artisan serve --host=192.168.1.18 --port=80
The IP is my local machines IP Address which i am accessing from my mobile.
I have tried looking up google but i couldn't find the answer i was looking for.
Thanks
You can use self-signed SSL for own server.
1 - Download the certificate.
2 - Add or edit this line in php.ini config:
curl.cainfo = "[path_to_cerfificate]\cacert.pem"
3 - Then restart your server
Done.

Resources