繁体   English   中英

firebase 的多环境设置未按预期部署

[英]Multi environment setup for firebase not deploying as expected

所以,我正在帮助某人完成一个由其他人开发的项目,但他离开了。 好吧,不太相关,但我正在努力让多环境设置运行。 希望有人能把我推向正确的方向。

一开始只有一个环境。 只有生产。 但是对于更改,我希望在生产环境旁边运行一个环境。 这将是演出。

我一直在搜索 web 以了解如何设置它,我得到了一些工作。 它似乎部署了所有内容,但是在暂存环境中看不到更改。

这是我现在在我的自述文件中的内容:

#### Deploy to staging

Build the application: `npm run build`

Make sure you are at the correct environment: `firebase use staging`

And apply the target (??) ; `firebase target:apply hosting staging exp-game-staging`

Now you can deploy with:
Initially, for fresh deploy: `firebase deploy`
And later for consequent deployments: `firebase deploy --only hosting`

这给出了以下 output:

=== Deploying to 'exp-game-staging'...

i  deploying hosting
i  hosting[exp-game-staging]: beginning deploy...
i  hosting[exp-game-staging]: found 739 files in dist/exp-game-staging
✔  hosting[exp-game-staging]: file upload complete
i  hosting[exp-game-staging]: finalizing version...
✔  hosting[exp-game-staging]: version finalized
i  hosting[exp-game-staging]: releasing new version...
✔  hosting[exp-game-staging]: release complete

✔  Deploy complete!

Project Console: https://console.firebase.google.com/project/***/overview
Hosting URL: https://***.web.app

对于这些文件,这似乎可行,但它仍在使用暂存环境中的生产数据库。 在本地,情况并非如此,当我在本地开发时,它按预期使用了登台数据库。

有谁知道我在这里错过了什么?

我了解到您正尝试在 Firebase 项目中创建两个环境,一个用于生产,另一个用于暂存,但您遇到的问题是暂存阶段正在使用生产环境中的数据库。

创建两个单独的环境时,请务必参考文档中提到的步骤。 此外,建议为这两种环境创建单独的数据库。

您可以通过将数据备份到存储桶,然后从那里将其恢复到另一个数据库来实现这一点。

此外,您可以在此处参考此 Firestore 备份/导出/导入信息。

如果您使用的是 Firebase RTDB,而不是 Firestore - 此文档可能会有所帮助。

暂无
暂无

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

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