【问题标题】:Is there a way to allow cloudbuild steps to access the Cloud SQL in GCP有没有办法让 cloudbuild 步骤访问 GCP 中的 Cloud SQL
【发布时间】:2019-08-26 13:26:15
【问题描述】:

我正在设置云构建触发器以部署 PHP/Symfony 应用程序。当 docker 文件运行 php app/console assetic:dump 命令以创建资产时,我收到以下错误。

SQLSTATE[HY000] [2002] Connection timed out 
[PDOException] 

SQLSTATE[HY000] [2002] Connection timed out
[Doctrine\DBAL\Driver\PDOException] 


An exception occurred in driver: SQLSTATE[HY000] [2002] 
Connection timed out 
[Doctrine\DBAL\Exception\ConnectionException] 

我已经决定尝试让 docker 容器连接到数据库,而不是尝试修复 symfony 应用程序,因为我对框架或 php 了解不够。

是否可以进行设置,以便我可以在 CLOUDSQL 端允许某种 IP 来允许这些连接?

【问题讨论】:

  • 我在另一个 SO 帖子中看到,您可以使用额外的构建步骤来运行云 sql 代理并以这种方式连接:stackoverflow.com/a/52366671 但我也希望有一个更简单的解决方案......
  • chmod_007 提供的解决方案对您有用吗?
  • @alextru 我还没有尝试过。

标签: docker networking google-cloud-platform google-cloud-sql google-cloud-build


【解决方案1】:

此处的答案描述了在同一步骤中设置代理的解决方案:

Run node.js database migrations on Google Cloud SQL during Google Cloud Build

【讨论】:

    猜你喜欢
    • 2019-12-25
    • 2021-12-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-18
    • 1970-01-01
    • 2021-01-17
    • 2020-05-01
    相关资源
    最近更新 更多