gpt4 book ai didi

用于查看数据存储的 Appscale 管理面板

转载 作者:行者123 更新时间:2023-12-04 05:56:50 24 4
gpt4 key购买 nike

我已经在 appscale VM 上部署了我的 GAE 应用程序。应用程序运行正常,但我无法看到查看数据存储区数据的界面。与在 google app engine 中一样,我们可以通过在 :8000 端口访问应用程序来查看数据存储。对此有什么想法吗?

最佳答案

这是在 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. 从 ~/运行 enable-datastore-viewer.sh
  2. 编辑/etc/nginx/sites-enabled/appscale-.conf 文件
  3. 查找以以下内容开头的行:allow
  4. 更改IP,保存文件
  5. 重新加载 nginx:service nginx reload

关于用于查看数据存储的 Appscale 管理面板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22174264/

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