Laravel Horizon deployed via Google App Engine, processes do not start - laravel

I am having trouble starting the processes/queues for a job server deployed to Google App Engine. In the Horizon dashboard, the instance names are visible, but no processes show and jobs do not execute.
While running the code on my localhost, processes/queues do start and execute jobs. I confirmed that the horizon.php config is correct and matches my APP_ENV, yet still, no processes start.
Any guidance is appreciated!

Horizon opens and closes php processes with the proc_open and proc_close functions which are on the list of permanently disabled functions in Google App Engine. After adding these to the whitelist_functions configuration under the runtime_config in the app.yaml everything works great.

Related

How to migrate Laravel database on Docker onto Google Cloud

My Laravel app is running on docker using Linux commands on a Windows Machine. This means instead of using 'php artisan' commands, I use 'sail artisan' commands. I am able to migrate locally onto the SQL server on docker (sail artisan migrate) and am able to deploy the app onto Google Cloud (gcloud app deploy). The final bit of my puzzle piece is migrating the database onto the Google Cloud SQL server.
When I was first setting the app up, I had problems with this so I exported the SQL server, uploaded it to Google Cloud and then deployed it manually which was fine for a one-off but I now have things I would like to change about the database structure without losing all the data. I also figured it was about time I learnt to do it properly anyway.
I have attempted to use the instructions on Google's community tutorial, however, this guide presupposes the project does not yet exist whereas I am working with a pre-existing application and a pre-existing database. I tried to jump into the tutorial halfway through but I couldn't get the Cloud SQL proxy to work.
After a bit more research, I found this article which I got partway through, however, once I got to the part needing TCP or Unix sockets, neither set of commands will run without error on my Ubuntu terminal.
If anyone knows of any useful articles or has had this problem themself, I would greatly appreciate your help.
Additional Info:
Laravel Framework 8.69.0
Vue version 3.0.5
Docker Engine Community 20.10.8
SQL server 'europe-west2'
I'm not aware of anyway to run sail/artisan command line commands on GCP.
However in ./vendor/facade/ignition/src/Solutions/RunMigrationsSolution.php there is the following function
public function run(array $parameters = [])
{
Artisan::call('migrate');
}
which can be used to programmatically run migrations.
So in ./routes/web.php make a route like
Route::get('/run_migrate',
[DataController::class, 'runMigrate']
)->middleware(['auth', 'verified'])->name('run_migrate');
and in ./app/Http/Controllers/DataController.php add the function
public function runMigrate() {
Artisan::call('migrate');
}
Now after signing in as an authorised user (or if you remove the auth middleware you won't need to sign in) you can go to https://your-app-url.com/run_migrate and it will run any outstanding migrations.
To be able to do this the schema table has to exist so you will have to import your local database to start.

How to deploy a web app without stop and restart

I built the project to binary file and deployed it to server before. and start it with nohup. But if I updated my code and rebuild my program. I must to kill the process first, then updated the file and start again.
My problem is:
The app must be down with at least few seconds.
I must update file manually (login the server, kill process, replace file, and then start it)
Is there anyway to hot update the program, something like PHP? I just need update my code to server by git (or svn or others way). then the server will rebuild app and graceful restart it.
Usually you run more than one instance of your web application behind a reversed proxy, eg nginx, or any other load balancer. If the few second downtime is an issue for you then you need to have a HA setup anyway. And in such setup you can do a rolling update, where you are replacing instances one by one.
Quick googling will let you find instructions how to do the deployment eg: https://www.digitalocean.com/community/tutorials/how-to-deploy-a-go-web-application-using-nginx-on-ubuntu-18-04

How to restart a single instance automatically in PCF when is going down or crashed

I have a SpringBoot application deployed in PCF scaled to 12 instances. One or two instances are going down. I want to restart those 2 instances instead of restarting the application automatically. How do you restart a single instance automatically in PCF when it is going down or when it crashed?
I am using the following command to restart a single instance manually:
cf restart-app-instance APP_NAME INDEX
There is nothing you need to do. The Cloud Foundry platform will monitor your application via the configured health check and automatically restart it.
If that's not happening, you would want to look into why it's not being restarted automatically and not try to hack together some other way of restarting it.
Can you try something.
Delete the instance at the index:
cf curl DELETE /v2/apps/$(cf app APP_NAME --guid)/instances/INDEX_OF_THE_INSTANCE
Reference: http://apidocs.cloudfoundry.org/272/apps/terminate_the_running_app_instance_at_the_given_index.html
Wait for sometime, so that CF can recreate the instance.
I have not tried this in my lab, and if I get any update I will post it here in comments.
Thank,
Chandan Patra

Laravel web app stopped working

So I have this unique issue
I have a laravel app that is like alexa and it uses several apis including dmoz, google, json to fetch data about domains.
It has a feature where admin can bulk upload the websites and starts the cron and it keeps updating websites by itself.
Now after reaching approx 1000 websites, the app simply stopped.
I have to use CHOWN -R user /path/to/directory again to get it working.
However after doing this my cron stopped working
I flushed the cronjob and cronb manager tables from the database and delete cron.lock file and then resubmit websites and then start the cron.
Now the cron seems to be working because the rows started to appear in cron manager and cronjob tables and also confirmed by the cron output log, however its not appearing on the website.
Following are my laravel logs.
http://pastebin.com/iYuFmD4p
any idea...???

Stuck OpenShift Application

My application hang up. Because of that I wanted to delete the application but it's not possible. OpenShift just shows me: "Unable to perform action on app object. Another operation is already running" when I want to delete the application from the web interface.
Unable to perform action on app object. Another operation is already running.
When I check the status of my application then it is unknown. It shows "unknown" for my Tomcat server and also for my database server.
What can I do now to get my app back to live?
It looks like your error is caused by intermittent API failures on OpenShift, so there is nothing that you can do (except you work for OpenShift).
You can check the OpenShift Online Status Page to see whether the API errors are still present. To receive the latest status updates you can also follow OpenShift Operations on Twitter or join this IRC Channel: #openshift on irc.freenode.net.
I think the problem will be resolved quickly.
This may be caused by Tomcat running out of memory. Try rhc app force-stop -a [your_app] in the rhc command line tools. This should kill all running threads in your app even if it's out of memory. Then, if you want to restart the app, use rhc app start.
Source: https://help.openshift.com/hc/en-us/articles/202399040-How-to-restart-an-application-

Resources