Google App Engine (GAE) 应用程序的多域部署
我们希望开发和销售定制的商业 GAE 应用程序。我想要有关在任意 Google Apps 域(即不是 appspot)上部署 GAE 应用程序的信息。
假设我们的公司是 abc.com,我们正在向 def.com 和 xyz.com 销售应用程序。在客户的域上部署我们的应用程序的步骤是什么?
当应用程序部署在多个域上时:
- 代码是否重复或共享?
- 数据存储定义是否重复或共享(或更准确地说是类型)?
- 是否向实体添加了任何域属性?
We would like to develop and sell custom commercial GAE applications. I would like information on the deployment of GAE applications on arbitrary Google Apps domains (i.e. not appspot).
Suppose our company is abc.com and we are selling app to def.com and xyz.com. What are the steps to deploy our app on our customer's domain?
When an app is deployed on many domains:
- Is the code duplicated or shared?
- Is the datastore definition duplicated or shared (or more precisly the kinds)?
- Any domain attribute add to the entity?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于您所描述的“多租户”应用程序,您目前有三个选择:
You have three options at the moment, when it comes to a 'multi-tenant' app such as you describe:
这是可能的,但据我所知,
def.com
&xyz.com
必须注册 Google Apps。一旦您的潜在客户在 Google Apps 中注册了域,他们不仅可以添加 Gmail 和 Google Apps 等 Google Apps,还可以添加 Google Apps。文档到子域 (
mail.def.com
和docs.def.com
) 以及任何 GAE 应用程序 (fooapp.def.com
) 。共享
虽然架构(定义)是共享的,但不共享的是实际数据存储。即您的应用程序的每个实例都将具有单独的数据。
您可以使用 CGI/HTTP 环境变量之一找出您的应用程序在哪个域下提供服务。我不记得到底是哪个变量,但一旦我查看了我的一些旧代码,我就会更新答案。一旦找到当前域是什么,您就可以选择如何处理该信息,包括将其保存到实体或简单地拒绝访问。
另一个很酷的功能是,假设公司
def.com
使用托管 GMail 并为其员工提供 Google 身份验证。现在,如果您的应用程序使用 GAE 提供的身份验证挂钩,那么您可以自动仅对他们的员工进行身份验证,而无需更改任何代码!至少,这是理论,因为我自己还没有尝试过;-)This is possible but to the best of my knowledge,
def.com
&xyz.com
will have to sign up for Google Apps.Once the domain is registered with Google Apps by your prospective customers, they can add not only Google Apps like Gmail & Docs to subdomains (
mail.def.com
&docs.def.com
) but also any GAE apps (fooapp.def.com
).Shared
While the schemas (definitions) are shared, what isn't shared is the actual datastore. i.e. each instance of your app will have separate data.
You can figure out which domain your app is being served under using one of the CGI/HTTP environment variables. I don't remember which variable exactly but I'll update the answer once I look at some old code of mine. Once you find out what is the current domain, you can choose what to do with that info, including saving it to an Entity or simply denying access.
Another cool feature about this is that let's say company
def.com
is using hosted GMail and have Google Authentication for their employees. Now if your app is using the GAE provided authentication hooks, then you can automatically authenticate just their employees without any code change on your part! At least, that's the theory since I haven't tried it out myself ;-)