调试 Cloud Foundry 发布应用过程中的”Unknown Error“

在我用cf push发布应用到在AWS中的 Cloud Foundry(CF)时,得到以下错误信息:

Using manifest file /home/user/cf-env/manifest.yml
Updating app cf-env in org codex / space cf-app-testing as admin...
OK
Uploading cf-env...
FAILED
Error processing app files: Error uploading application.
Server error, status code: 500, error code: 10001, message: An unknown error occurred.

我想在日志中获得更多有效信息以帮助调试。很可惜,它除了告诉我 ”未知错误易发生(an unknown error occurred)“,什么别的信息都没有。我花了几分钟抱怨CF的日志系统不给力,速速冷静了下,来思考一下当我们发布应用的时候到底是怎么样一个过程。

错误是发生在应用上传的过程中,本来应该上传到Blobstore。我用的是Amazon的S3 bucket,于是我登陆AWS Console,发现我所需要的S3 buckets连个影儿都没有。我立刻在我部署CF的区域中创建了我需要的S3 buckets,再次运行cf push,几乎就要成功了,可是俺看到日志里有以下警告。

[2016-08-18 16:39:21+0000] [fog][WARNING] fog: the specified s3 bucket name(example.com-cc-packages) contains a '.' so is not accessible over https as a virtual hosted bucket, which will negatively impact performance.  For details see:
http://docs.amazonwebservices.com/AmazonS3/latest/dev/BucketRestrictions.html

在 [Bucket 限制][Bucket限制] 文档中, 有以下详细信息:

When using virtual hosted–style buckets with SSL, the SSL wildcard certificate only matches buckets that do not contain periods. To work around this, use HTTP or write your own certificate verification logic. We recommend that you do not use periods (".") in bucket names.

我索性把bucket名字里的点都换成了小破折号,同时更改了我CF中的blobstore设置,重新部署,终于成功发布了我的应用!

小结一下:保证你的buckets存在,且命名不要使用句点(.)。

To read the English version, please see Debug Unknown Error When You Push Your APP to CF.

Spread the word

twitter icon facebook icon linkedin icon