我尝试将 Golang 应用程序部署到 AWS Elastic Beanstalk,但不断收到错误:
ERROR Instance deployment failed. For details, see 'eb-engine.log'.
ERROR [Instance: i-0ca401a7a27c0fe40] Command failed on instance. Return code: 1 Output: Engine execution has encountered an error..
日志错误发生在这里:
[ERROR] An error occurred during execution of command [app-deploy] - [StageApplication]. Stop running the command. Error: chown /var/app/staging/mysql/mysql.sock: no such file or directory
对于上下文,一个简单的 Golang 应用程序可以正确部署。
我手动检查了一个实例,其中
eb ssh
和 /var/app/staging/mysql/mysql.sock
文件实际存在。我试图删除 mysql
文件夹,但仍然遇到相同的错误。另外,我将应用程序配置为使用 SQLite(这个应用程序不是我写的,我只是想部署它)而不是 MySQL,但仍然没有结果
AWS Elastic Beanstalk 专为托管生产中的应用程序而设计,具有高可用性。在这种情况下,通常有多个应用程序服务器(实例)。这些可以随时自动添加或删除。因此,数据库托管在其自己的服务器中,而不是托管在 AWS Elastic Beanstalk 的实例上。这就是为什么您不能使用本地 SQLite 或 MySQL 数据库。您可以使用 AWS RDS 来实现此目的。