是否可以在使用应用程序时将Android应用程序数据保存在Google Cloud中并与应用程序同步?例如,我希望Google Cloud Storage就像我的应用程序的服务器一样.
我想在Google云端存储中创建一个文件夹,并在那里存储所有与应用相关的数据.我已阅读云存储文档并创建了API密钥.请告知是否可以这样做.
android google-api google-cloud-storage google-cloud-platform
我在Google云端平台上已经配置了现有的虚拟机.它是在没有启动脚本的情况下创建的,但我现在想添加一个.
如何从console.developers.google.com Web界面添加它?
我有一个100GB的永久磁盘连接到VM实例.但我不需要所有这些空间,因此不想为此付费.它也有一些数据.我拍了一张磁盘的快照,并尝试创建另一个.
在尝试创建一个新的时,它的价值不会低于100GB并且说,因为快照也是100GB,新磁盘的最小尺寸应该是100GB.
如何从快照创建较小的永久磁盘?或者减少现有的尺寸?
我在GKE上有一个应用程序,我希望仅通过HTTPS提供,因此我获得了一个签名证书以使用TLS保护应用程序.
我已经查看了很多有关如何执行此操作的教程,但它们都是指使用Ingress并使用LetsEncrypt和KubeLego自动请求证书.但我希望继续使用外部负载平衡器(谷歌为我提供的计算引擎实例),但我只想通过https访问我的应用程序.
如何应用我的server.crt和server.key文件来启用https.Do我将它应用于负载均衡器或kubernetes集群.
Google Cloud SQL PostgreSQL数据库的连接数相对较少.根据计划,这大概在25到500之间,而Google Cloud SQL中的MySQL限制在250到4000之间,非常快地达到4000.
我们目前为在Kubernetes上运行的不同客户提供了许多试用实例,并由相同的Google Cloud SQL Postgres服务器提供支持.每个实例使用一组单独的数据库,角色和连接(每个服务一个).我们已经达到了我们计划的连接限制(50),我们甚至没有达到内存或CPU限制.连接池似乎不是一个选项,因为连接与不同的用户.我现在想知道为什么限制如此之低以及是否有办法增加限制而不必升级到更昂贵的计划.
TLDR;我在为服务帐号分配 IAM 权限时遇到问题。
我正在构建一个测试,涉及使用 firebase Auth 生成自定义令牌。当我打:
const token = await admin.auth().createCustomToken('test', {
isAdmin: true,
})
Run Code Online (Sandbox Code Playgroud)
抛出以下错误
Permission iam.serviceAccounts.signBlob is required to perform
this operation on service account
projects/-/serviceAccounts/dashboard@appspot.gserviceaccount.com.;
Please refer to
https://firebase.google.com/docs/auth/admin/create-custom-tokens
for more details on how to use and troubleshoot this feature
Run Code Online (Sandbox Code Playgroud)
在引用的文档中,它说将服务帐户令牌创建者角色添加到服务帐户。我已经添加了该角色(以及尝试服务帐户管理员无济于事。

我可以验证我的权限似乎设置正确,当我运行时,
gcloud projects get-iam-policy project我可以看到我的服务帐户附加到所需的角色
- members:
- serviceAccount:dashboard@appspot.gserviceaccount.com
role: roles/iam.serviceAccountTokenCreator
Run Code Online (Sandbox Code Playgroud)
但是,如果我查看该特定服务帐户,它似乎显示为空,这与我的错误一致:
gcloud iam service-accounts get-iam-policy dashboard@appspot.gserviceaccount.com
etag: ACAB
Run Code Online (Sandbox Code Playgroud)
我认为导致我的服务帐户权限显示为空白的原因是罪魁祸首,但我不确定在哪里进一步调试。在我看来,唯一的区别是一个命令被调用,其中包含一个项目,但我使用项目 ID 初始化了我的 firebase 应用程序,并已对其进行了验证,(firebase-admin).apps[0].options因此这似乎是一个死胡同。
google-cloud-platform firebase-authentication google-iam google-cloud-iam
网上有很多例子展示了如何在部署在 GCP/GCE 上的虚拟机上使用 Terraform 运行启动脚本,但它们都使用内联启动脚本,所有启动脚本代码都包含在 terraform compute.tf 文件中。这可以通过启动脚本的单行或多行的 <<SCRIPT[script code]SCRIPT 来完成。我还没有找到一个示例来展示如何将启动脚本参数分配给本地磁盘上的另一个文件,可能与 compute.tf 位于同一目录中。用数百行启动脚本将compute.tf 弄得一团糟。没有更好的方法来做到这一点吗?
我意识到我可以编写一个包装脚本,将一个 compute.tf 和一个单独的启动文件组合到一个 compute.tf 中,然后运行 terraform,但我正在寻找一条更直接的路线,假设存在。
谢谢你。
我一直在使用以下 Java 方法在 GCS 中设置存储桶通知。
private void setBucketNotification(String bucketName, String topicId) {
List<String> eventType = new ArrayList<>();
eventType.add("OBJECT_FINALIZE");
try {
Notification notification = new Notification();
notification.setTopic(topicId);
notification.setEventTypes(eventType);
notification.setPayloadFormat("JSON_API_V1");
final GoogleCredential googleCredential = GoogleCredential
.fromStream(Objects.requireNonNull(classloader.getResourceAsStream("Key.json")))
.createScoped(Collections.singletonList(StorageScopes.DEVSTORAGE_FULL_CONTROL));
final com.google.api.services.storage.Storage myStorage = new com.google.api.services.storage.Storage.Builder(
new NetHttpTransport(), new JacksonFactory(), googleCredential).build();
Notification v = myStorage.notifications().insert(bucketName, notification).execute();
} catch (IOException e) {
log.error("Caught an IOException {}",e);
}
}
Run Code Online (Sandbox Code Playgroud)
到目前为止,它一直运行良好,但最近,我收到了关于GoogleCredential课程弃用的投诉,并尝试进行一些研究,希望找到可能的替代品,但找不到任何东西。谁能帮我指出正确的方向?
我正在使用 typescript、express 和Sequelize.
这是我的database连接类。
export class Database {
private _sequelize: Sequelize;
private config: DBConfigGroup = dbConfig;
private env = process.env.NODE_ENV as string;
constructor() {
this._sequelize = new Sequelize({
dialect: 'postgres',
database: this.config[this.env].database,
username: this.config[this.env].username,
password: this.config[this.env].password,
host: this.config[this.env].host,
});
}
async connect(): Promise<void> {
try {
console.log('start connect');
await this._sequelize.authenticate();
console.log('Connection has been established successfully.'.green.bold);
} catch (error) {
console.error('Unable to connect to the database:'.red.bold, error);
}
}
async close(): Promise<void> {
try {
await this._sequelize.close(); …Run Code Online (Sandbox Code Playgroud) node.js sequelize.js google-cloud-sql google-cloud-platform docker-compose
遇到构建部署功能的问题。尝试以编程方式部署该函数时,我在构建器日志(错误)中得到以下输出。
2020-10-20T02:22:12.155866856Z starting build "1fc13f51-28b6-4052-9a79-d5d0bef9ed5c"
I
2020-10-20T02:22:12.156015831Z FETCHSOURCE I
2020-10-20T02:22:12.156031384Z Fetching storage object: gs://gcf-sources-629360234120-us-central1/${FUNCTIONNAME}-63f501f1-a8d2-4837-b992-1173ced83036/version-1/function-source.zip#1603160527600655 I
2020-10-20T02:22:16.698838385Z Copying gs://gcf-sources-629360234120-us-central1/${FUNCTIONNAME}-63f501f1-a8d2-4837-b992-1173ced83036/version-1/function-source.zip#1603160527600655... I
2020-10-20T02:22:16.848908949Z / [0 files][ 0.0 B/ 7.6 KiB]
/ [1 files][ 7.6 KiB/ 7.6 KiB]
I
2020-10-20T02:22:16.848965618Z Operation completed over 1 objects/7.6 KiB. I
2020-10-20T02:22:17.848654342Z replace /workspace/pb/__init__.py? [y]es, [n]o, [A]ll, [N]one, [r]ename: NULL I
2020-10-20T02:22:17.848694354Z (EOF or read error, treating as "[N]one" ...) I
2020-10-20T02:22:17.848697209Z Archive: /tmp/source-archive.zip I
2020-10-20T02:22:17.848698273Z inflating: /workspace/main.py I
2020-10-20T02:22:17.848699274Z creating: /workspace/pb/ I
2020-10-20T02:22:17.848700378Z inflating: /workspace/pb/__init__.py I
2020-10-20T02:22:17.848701376Z …Run Code Online (Sandbox Code Playgroud) deployment google-cloud-platform google-cloud-functions google-cloud-iam google-cloud-build
android ×1
deployment ×1
devops ×1
google-api ×1
google-iam ×1
java ×1
kubernetes ×1
node.js ×1
postgresql ×1
sequelize.js ×1
startup ×1
terraform ×1