Appscale管理面板查看数据存储区

时间:2014-03-04 14:11:15

标签: appscale

我已在appscale VM上部署了我的GAE应用程序。应用程序正常运行但我无法看到用于查看数据存储数据的界面。与谷歌应用引擎一样,我们可以通过访问以下应用程序来查看数据存储:8000端口。有什么想法吗?

2 个答案:

答案 0 :(得分:4)

以下是在AppScale上启用GAE数据存储区查看器的脚本:

#!/bin/bash
#
# author: g@appscale.com
#
# Enable the datastore viewer and reload nginx.

ALLOW=""
APPS_ID=""
IP="all"
VIEWER_PORT="8099"

usage() {
        echo
        echo "Usage: $0 [app-id ...]"
        echo
        echo "Enable the dataviewer for app-id. If no app-id is specified, enable the viewer for all apps."
        echo "WARNING: the datastore viewer is not protected! Anyone can browse your data."
        echo "WARNING: restricting by IP should be used judiciously."
        echo
        echo "Options:"
        echo "     -h        this message"
        echo "     -i <IP>   allow connections only from this IP (default is open)"
        echo
}

while [ $# -gt 0 ]; do
        if [ "$1" = "-h" -o "$1" = "-help" -o "$1" = "--help" ]; then
                usage
                exit 1
        fi
    if [ -n "$1" -a "$1" = "-i" ]; then
        if [ -n "$2" ]; then
            IP="$2"
            ALLOW="allow $IP; 
      deny all;"
            shift;shift
            continue
        else
            usage
            exit 1
        fi
    fi
        if [ -n "$1" ]; then
                APPS_ID="$APPS_ID $1"
                shift
                continue
        fi
done

# Sanity checks.
if [ ! -e /etc/nginx/sites-enabled ]; then
        echo "ERROR: Cannot find nginx configurations. Is this an AppScale deployment?"
        exit 1
fi

# Get the list of running applications, and corresponding ports.
ps ax | grep appserver | grep -Ev '(grep|appscaledashboard)' | grep -- '--admin_port' | sed 's;.*--admin_port \([0-9]*\).*/var/apps/\(.*\)/app .*;\1 \2;g' | sort -ru | while read port app_id; do
        # Enable only for specified apps.
        if [ -n "$APPS_ID" ]; then
                found="no"
                for x in $APPS_ID ; do
                        if [ "$x" = "$app_id" ]; then
                                found="yes"
                                break
                        fi
                done
                if [ "$found" = "no" ]; then
                        continue
                fi
        fi

    let $((VIEWER_PORT += 1))

    # Do not apply if it's already there.
    if grep "datastore_viewer" /etc/nginx/sites-enabled/* > /dev/null ; then
        echo "Datastore viewer already enabled for $app_id."
        continue
    fi

    # Prepare the nginx config snippet.
    pippo="
upstream datastore_viewer_$VIEWER_PORT {
  server localhost:$port;
}
map \$scheme \$ssl {
    default off;
    https on;
}
server {
    listen $VIEWER_PORT;
    server_name datastore_viewer_server;
    location / {
      $ALLOW
      proxy_pass http://datastore_viewer_$VIEWER_PORT;
    }
}
"
    if [ -e /etc/nginx/sites-enabled/${app_id}.conf ]; then
        cp /etc/nginx/sites-enabled/${app_id}.conf /tmp
        echo "$pippo" >> /etc/nginx/sites-enabled/${app_id}.conf
        echo "Datastore viewer enabled for $app_id at http://$(cat /etc/appscale/my_public_ip):$VIEWER_PORT. Allowed IP: $IP."
        service nginx reload
    else
        echo "Cannot find configuration for ${app_id}."
    fi
done

https://github.com/AppScale/appscale/blob/master/scripts/enable-datastore-viewer.sh

实施步骤:

  1. 从〜/
  2. 运行enable-datastore-viewer.sh
  3. 编辑/etc/nginx/sites-enabled/appscale-.conf文件
  4. 查找以:allow
  5. 开头的行
  6. 更改该IP,保存文件
  7. 使用:service nginx reload
  8. 重新加载nginx

答案 1 :(得分:3)

官方答复如下: https://groups.google.com/forum/#!topic/appscale_community/SCr1B8eZANA 并基于remote_api。

如果您真的想要数据存储区查看器,它可以在防火墙后面使用。 要公开它(警告:此路径没有身份验证),您必须编辑nginx配置并重新加载它。

您还需要应用以下拉取请求: https://github.com/AppScale/appscale/pull/1475

将其添加到/usr/local/nginx/conf/sites-enabled/.conf

upstream datastore_viewer {
  server localhost:30000;
}
map $scheme $ssl {
    default off;
    https on;
}

server {
    listen 8090;
    server_name datastore_viewer_server;
    location / {
      proxy_pass http://datastore_viewer;
    }
}

然后重新加载nginx: / usr / local / nginx / sbin / nginx -s reload

现在您应该可以在端口8090上进行部署并查看GAE控制台。如果您没有看到任何实体,请确保运行统计信息生成器(每天运行)。要生成它们,请转到AppScale仪表板上的App Console页面。