JSON不得超过1000000字节 [英] JSON must be no more than 1000000 bytes

查看:400
本文介绍了JSON不得超过1000000字节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个Jenkins-Chef设置程序,其中包含一个针对客户的网站的质量检查构建项目.该版本从Bitbucket获取代码,并且脚本将食谱从Chef Client上载到Chef Server.

We have a Jenkins-Chef setup with a QA build project to a website for a client. The build gets the code from Bitbucket, and a script uploads the cookbooks from the Chef Client to the Chef Server.

这些构建运行了很长时间.两天前,自动构建和手动构建开始失败,并出现以下错误(取自Jenkins控制台输出):

These builds ran fine for a long time. Two days ago the automated and manual builds started failing with the following error (taken from the Jenkins console output):

更新后的环境质量检查

Updated Environment qa

上传示例部署[0.1.314]

Uploading example-deployment [0.1.314]

错误:请求实体太大

响应:JSON不得超过1000000字节.

Response: JSON must be no more than 1000000 bytes.

据我了解,JSON文件应该与nodejs相关,这是开发人员在此Web服务器上使用的.

From what I understand, JSON files are supposed to be related to nodejs which is what the developers use on this webserver.

我们遍历了Jenkins,Chef-Server和QA服务器的所有配置文件.我们找不到改变导致此错误的1MB限制的方法.

We looked all over the config files for Jenkins, the Chef-Server and the QA server. We couldn't find a way to change this 1MB limit that is causing this error.

我们尝试更改client_max_body_size,此操作无效. 我们检查了JSON文件的大小,但没有一个文件达到此限制. 知道在哪里可以找到解决方案吗?可以更改此限制吗?我们能做些什么(在基础架构方面),还是应该在开发人员方面解决?

We tried changing client_max_body_size, didn't work. We checked the JSON files size, non of them reach this limit. Any idea where we can find a solution? Can this limit be changed? Is there anything we can do (Infrastructure wise) or should this be fixed from the developer side?

推荐答案

因此,首先,1M值或多或少是经过硬编码的,Chef-server并不是要存储大对象的.

So first of all, the 1M value is more or less hardcoded, the chef-server is not intended to store large objects.

发生的事情是在上传食谱之前,创建了一个包含其信息的json文件,因为此文件将存储在数据库中并对其进行索引,其大小不应超过太大,以免出现性能问题.

What happens is before uploading a cookbook, a json file with it's information is created, as this file will be stored in DB and indexed it should not exceed a too large size to avoid performances problems.

想法是仅将绝对必要的内容上传到厨师服务器,剥离CVS目录,任何IDE构建/项目文件等.

The idea is to upload to the chef-server only what is absolutely necessary, strip CVS directory, any IDE build/project file, etc.

实现此目标的最佳解决方案是使用 chefignore文件.必须在cookbook_path下创建它.

Best solution to achieve it simply is using the chefignore file. It has to be created just under the cookbook_path.

其中的内容是通配符匹配项,在上载食谱时要忽略,因此一个示例可能是:

The content of this is wildcard matches to ignore while uploading the cookbook so an example one could be:

*/.svn/* # To strip subversion directories
*/.git/* # To strip git directories
*~ # to ignore vim backup files

这篇关于JSON不得超过1000000字节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆