How do I access Fauxton on the Google AppEngine platform?

纵然是瞬间 提交于 2019-12-10 18:39:22

问题


I am creating an offline-first app on Google App Engine, with PouchDB as my local DB, and CouchDB as my remote DB. I have enabled CouchDB on Google AppEngine, and tried to go to the following URL:

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

When I do that, I get the following:

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

So I tried enabling https access in the firewall settings.

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

Still getting the error above.

I searched the documentation but cannot find anything helpful about how to access Fauxton (or Futon) on Google AppEngine. (The instructions only tell you how to access Fauxton on your local machine.)

I have generated a private and public key and logged in to the server via command line.

I have also followed the instructions about configuring the firewall to allow remote access, and have given it to my PC only.

None of this has enabled me to access https://[my-app-id].appspot.com:5984/_utils/

How do I access Fauxton on the Google AppEngine platform?


Update: according to the development tools in my browser, my PouchDB application has successfully created a database to sync to, but it isn't on the server:

app.yaml file

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"

EDIT: I posted this question in the Bitnami community forum (they provide CouchDB on Google App Engine)


回答1:


FWIW, one of the references in your post points to Google Compute Engine (GCE), which is an IaaS, not a PaaS like Google App Engine (GAE), you might be looking at the wrong product.

The app.yaml file indicates you are using the standard environment, which doesn't offer ways to configure a listening port. And it also doesn't allow listening sockets. From 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.

The GAE flexible environment might be an alternative as it drops many of the standard environment restrictions, but it's a significantly different solution (which I didn't use yet). The remainder of the answer assumes the flexible environment and it's based solely on the documentation.

Not 100% certain, but you might need to teach your app to listen to port 8080 instead. From 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.

Unless you can use the forwarded ports network config (again, not 100% certain, I didn't use flex env). From 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.




回答2:


I'm getting some help with this from the Bitnami Community Forum.

Answers so far...

(1) set up the firewall rules - make sure you have a permanent IP address for this.

(2) set up 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 - but note that you will need to type cd /opt/bitnami/couchdb/etc/, press enter, and then sudo vi local.ini (rather than vi local.ini as the instructions suggest).

(5) Log in to the external IP address. (Log in as admin and prefix commands with sudo)

(NB: you don't need to run this in the GAE flexible environment)



来源:https://stackoverflow.com/questions/47349446/how-do-i-access-fauxton-on-the-google-appengine-platform

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!