gpt4 book ai didi

google-app-engine - 如何在 Google AppEngine 平台上访问 Fauxton?

转载 作者:太空宇宙 更新时间:2023-11-03 15:34:57 25 4
gpt4 key购买 nike

我正在 Google App Engine 上创建一个离线优先的应用程序,将 PouchDB 作为我的本地数据库,将 CouchDB 作为我的远程数据库。我在 Google AppEngine 上启用了 CouchDB,并尝试访问以下 URL:

https://[my-app-id].appspot.com:5984/_utils/

当我这样做时,我得到以下信息:

This site can’t be reached
The connection was reset.
Try:
Checking the connection
Checking the proxy and the firewall
Running Windows Network Diagnostics
ERR_CONNECTION_RESET

所以我尝试在防火墙设置中启用 https 访问。

**Firewalls**
[ ] Allow HTTP traffic
[Y] Allow HTTPS traffic

还是出现上面的错误。

我搜索了文档,但找不到任何有关如何在 Google AppEngine 上访问 Fauxton(或 Futon)的有用信息。 (说明只告诉你 how to access Fauxton on your local machine 。)

我有generated a private and public key and logged in to the server via command line .

我也关注了instructions about configuring the firewall to allow remote access ,并且只把它交给了我的电脑。

这些都没有使我能够访问 https://[my-app-id].appspot.com:5984/_utils/

如何在 Google AppEngine 平台上访问 Fauxton?


更新:根据我浏览器中的开发工具,我的 PouchDB 应用程序已成功创建要同步的数据库,但它不在服务器上:

screenshot of IndexedDB in Application tab

app.yaml 文件

application: [app-name]
version: 4
runtime: python27
api_version: 1
threadsafe: false

handlers:

- url: /
script: main.py

- url: /(favicon)\.ico$
static_files: \1.ico
upload: /(favicon)\.ico
application_readable: true

- url: /(package)\.json$
static_files: \1.json
upload: /(package)\.json
application_readable: true

# Serve images as static resources #
- url: /(.+\.(gif|png|jpg|json|ico))$
static_files: \1
upload: .+\.(gif|png|jpg|json|ico)$
application_readable: true


- url: /index.html
static_files: index.html
upload: index.html

- url: /licence.html
static_files: licence.html
upload: licence.html

- url: /privacy.html
static_files: privacy.html
upload: privacy.html

- url: /pouchnotes.manifest
static_files: pouchnotes.manifest
upload: pouchnotes.manifest

- url: /manifest.json
static_files: manifest.json
upload: manifest.json

# static directories #

- url: /img
static_dir: img

- url: /js
static_dir: js

- url: /css
static_dir: css


libraries:
- name: webapp2
version: "2.5.2"

编辑:I posted this question in the Bitnami community forum (他们在 Google App Engine 上提供 CouchDB)

最佳答案

FWIW,您的帖子中提到了 Google Compute Engine (GCE),它是一种 IaaS,而不是像 Google App Engine (GAE) 这样的 PaaS,您可能正在查看错误的产品。

app.yaml 文件表示您使用的是标准环境,它不提供配置监听端口的方法。而且它也不允许监听套接字。来自 Limitations and restrictions :

Although App Engine supports sockets, there are certain limitations and behaviors you need to be aware of when using sockets :

  • You cannot create a listen socket; you can only create outbound sockets.

GAE 灵活环境可能是一个替代方案,因为它取消了许多标准环境限制,但它是一个 significantly different解决方案(我还没有使用)。答案的其余部分假设灵活的环境,并且仅基于文档。

不是 100% 确定,但您可能需要教您的应用改为监听端口 8080。来自 Listen to port 8080 :

The App Engine front end will route incoming requests to the appropriate module on port 8080. You must be sure that your application code is listening on 8080.

除非你可以使用 forwarded ports 网络配置(同样,不是 100% 确定,我没有使用 flex env)。来自 Port forwarding :

Port forwarding allows for direct connections to the Docker container on your instances. This traffic can travel over any protocol. Port forwarding is intended to help with situations where you might need to attach a debugger or profiler.

By default, incoming traffic from outside your network is not allowed through the Google Cloud Platform firewalls. After you have specified port forwarding in your app.yaml file, you must add a firewall rule that allows traffic from the ports you want opened.

You can specify a firewall rule in the Networking Firewall Rules page in the Google Cloud Platform Console or using gcloud commands.

For example, if you want to forward TCP traffic from port 2222:

  1. Modify the app.yaml to include:

    entrypoint: gunicorn -b :$PORT -b :2222 main:app
  2. In the network settings of your app.yaml, include:

    network:
    forwarded_ports:
    - 2222/tcp
  3. Specify a firewall rule in the Cloud Platform Console or using gcloud compute firewall-rules create to allow traffic from any source (0.0.0.0/0) and from tcp:2222.

关于google-app-engine - 如何在 Google AppEngine 平台上访问 Fauxton?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47349446/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com