在Travis CI上运行Redis [英] Running Redis on Travis CI

查看:67
本文介绍了在Travis CI上运行Redis的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在自己的Express应用程序中添加了Redis商店,并使其正常工作.

I just included a Redis Store in my Express application and got it to work.

我想将此Tradis商店包含在Travis CI中,以使我的代码继续在那里工作.我在Travis文档中读到,可以使用出厂设置启动Redis.

I wanted to include this Redis Store in Travis CI for my code to keep working there. I read in the Travis Documentation that it is possible to start Redis, with the factory settings.

在我的项目中,我不使用出厂设置,而是编写了自己的redis.conf文件,该文件指定了端口和密码.

In my project, I don't use the factory settings, I wrote my own redis.conf file which specifies the port and the password.

所以我在.travis.yml文件中添加了以下行:

So I added the following line to my .travis.yml file:

services:
  - redis-server --port 6380 --requirepass 'secret'

但这会在Travis CI上返回以下内容:

But this returns the following on Travis CI:

$ sudo service redis-server\ --port\ 6380\ --requirepass\ \'secret\' start
  redis-server --port 6380 --requirepass 'secret': unrecognized service

有什么办法可以解决这个问题?

Is there any way to fix this?

推荐答案

如果要自定义Travis CI上Redis的选项,建议不要使用services部分,而是这样做:

If you want to customize the option for Redis on Travis CI, I'd suggest not using the services section, but rather do this:

before_script: sudo redis-server /etc/redis/redis.conf --port 6380 --requirepass 'secret'

before_script: sudo redis-server /etc/redis/redis.conf --port 6380 --requirepass 'secret'

服务"部分使用其init/upstart脚本运行服务,这些脚本可能不支持您在其中添加的选项.出于安全原因,该命令也被转义,因此文档仅暗示您可以在该部分中列出常规服务名称.

The services section runs services using their init/upstart scripts, which may not support the options you've added in there. The command is also escaped for security reasons, hence the documentation only hinting that you can list normal service names in that section.

这篇关于在Travis CI上运行Redis的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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