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

How do I access Fauxton on the Google AppEngine platform?

我正在 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,并且只把它交给了我的电脑。

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

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


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

app.yaml 文件

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

handlers:

- url: /
  script: main.py

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

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

  # Serve images as static resources #
- url: /(.+\.(gif|png|jpg|json|ico))$
  static_files: 
  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,您 post 中的一个引用指向 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.

我要一些 help with this from the Bitnami Community Forum

到目前为止的答案...

(1) set up the firewall rules - make sure you have a permanent IP address 为此。

(2) 设置SSH keys to access the server via command line

(3) sudo /opt/bitnami/couchdb/scripts/ctl.sh stop couchdb

(4) edit local.ini to point to 0.0.0.0 instead of 127.0.0.1 - 但请注意,您需要输入 cd /opt/bitnami/couchdb/etc/,按回车键,然后输入 sudo vi local.ini(而不是说明中建议的 vi local.ini ).

(5) Log in to the external IP address。 (以 admin 身份登录并使用 sudo 作为命令前缀)

(注意:您不需要 运行 在 GAE 柔性环境中这样做)