简体   繁体   English

在 AWS Beanstalk 上的控制器方法中运行 Artisan 命令

[英]Run Artisan command in controller method on AWS Beanstalk

I hosted my Laravel Application on AWS Beanstalk, I created a Postgres RDS and connect with to my application, the application can confirm that there is a connection to the database我在 AWS Beanstalk 上托管了我的 Laravel 应用程序,我创建了一个 Postgres RDS 并连接到我的应用程序,应用程序可以确认存在与数据库的连接确认到数据库连接

but, for some reasons, I cannot ssh to the database using Putty, to run my artisan commands, so I am not able to run my migrations, I am looking for other means to run my migrations.但是,由于某些原因,我无法使用 Putty SSH 到数据库来运行我的工匠命令,所以我无法运行我的迁移,我正在寻找其他方式来运行我的迁移。 I tried using .ebextension/init.config ,我尝试使用.ebextension/init.config 在此处输入图像描述 but when I push my code, The CodePipeline is not deploying it, so I decide to run the migration with a controller.但是当我推送我的代码时,CodePipeline 没有部署它,所以我决定使用控制器运行迁移。 工匠控制器 The route路线路线 I ran that command on my local, it works, but when I run it on Production, I am getting 500 |我在本地运行该命令,它可以工作,但是当我在生产上运行它时,我得到500 | Server Error , when I check the log, this is what I got服务器错误,当我检查日志时,这就是我得到的日志 2021/11/05 00:42:08 [error] 3918#3918: *43 open() "/var/www/html/public/artisan/command/migrate" failed (2: No such file or directory),

my question is why is the command attaching the URL to a directory,我的问题是为什么将 URL 附加到目录的命令,

and how can I run my migration on AWS Beanstalk instance以及如何在 AWS Beanstalk 实例上运行我的迁移

This wont work as when you are trying to deploy the app, the code is not yet there.这不起作用,因为当您尝试部署应用程序时,代码还不存在。 You would have to write the elastic beanstalk hooks to execute after the code is there in the directory and then run commands using hook files.您必须编写弹性 beanstalk 钩子才能在代码位于目录中之后执行,然后使用钩子文件运行命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM