Tag: ruby在轨道

Rails 5,Kubernetes和Google Container Engine

我正在testing我公司的一个新的基础设施,而且我被困住了。 我有一个使用Rails 5.1的dockerized spike项目,我试图通过Google Container Engine进行部署。 我读了所有可能的东西,但是我无法从我的IP地址中获得任何东西。 我的Rails应用程序的泊坞窗图像正确存储在谷歌云registry。 当我启动kubectl get services我得到的kubectl get services NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE spikedocker-web 10.3.244.145 xx.xxx.xx.xxx 80:32021/TCP 17m 当我kubectl get deployments NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE spikedocker-web 2 2 2 2 1h 当我kubectl get pods我得到 NAME READY STATUS RESTARTS AGE spikedocker-web-506778213-djwb5 1/1 Running 0 1h spikedocker-web-506778213-xxbtm 1/1 Running 0 […]

Codeship:从Docker镜像部署到EC2容器服务

我有一个使用Codeship Pro的项目,并且我已经成功推送到Docker Hub,之后我想用我的项目推到AWS EC2 Container Service。 我遵循这个文档: https://documentation.codeship.com/pro/continuous-deployment/aws/ – service: awsdeployment command: aws ecs register-task-definition –cli-input-json file:///deploy/tasks/backend.json – service: awsdeployment command: aws ecs update-service –service my-backend-service –task-definition backend 问题是在文档中,它不解释什么部署/任务/ backend.json包含,我试图删除codeship-steps.yml – service: awsdeployment command: aws ecs update-service –service my-backend-service –task-definition backend 但结果是:调用UpdateService操作时发生错误(ClientException):未findTaskDefinition。 目前,我使用 ecs-cli compose up 它使用我的docker-compose.yml将我的项目推送到我的EC2容器服务 我花了漫长的一天来弄明白,但是我仍然不知道要成功推送到我的AWS ECS,在推送shipcode时我不能使用ecs-cli命令。 我该怎么办 ?

使用DockerconfigurationTiller

我正在尝试使用DockerconfigurationTiller,因为我想在Docker运行时使用此工具传递参数。 我按照教程和文档 ,我有接下来的文件说教程: 1- Dockerfile FROM httpd RUN apt-get update && apt-get install -y ruby && gem install tiller ADD data/tiller /etc/tiller CMD ["/usr/local/bin/tiller" , "-v"] httpd是一个包含一个Apache HTTP服务器的图像,我用下面的命令获取它: docker pull httpd 其他步骤包含Ruby an Tiller安装,以及需要传递参数(模板和公共文件)的文件的副本。 2- common.yaml exec: [ "/usr/local/apache2/bin/httpd"] data_sources: [ "defaults", "file", "environment" ] template_sources: [ "file" ] environments: production: index.erb: target: /usr/local/apache2/htdocs/index.html 在这个文件中,我configuration了一个叫做生产环境,我想从它的模板创build一个html文件。 […]

Passenger中错误地设置了$ GEM_HOME和$ GEM_PATH

我正在尝试在Docker容器中使用Passenger(v5.1.4)+ Nginx设置一个rails(v4.2.6)应用程序。 我使用官方ruby2.3.1作为基础的形象。 以下是我的网站nginx文件 server { server_name example.local; listen 4000; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; root /www/app/public; passenger_ruby /usr/local/bin/ruby; try_files $uri @passenger; location @passenger { passenger_enabled on; rails_env development; } … } passenger_pre_start http://0.0.0.0:4000/status; 更多上下文: Ruby二进制文件存在于/usr/local/bin/ruby gem安装在/usr/local/bundle 但是当我启动nginx服务时,出现以下错误 It looks like Bundler could not find a gem. Maybe you didn't install all the gems that this […]

如何处理在Docker容器中使用`git ls-files`的gemspecs?

这是问题: 我有几个gem回购叉分支进行更改,并作为子模块添加到vendor 。 通常我会在Gemfile指定这些依赖关系, Gemfile所示: gem 'whatever', path: './vendor/whatever' 这在我的本地机器上工作正常,但.git目录不复制到Docker容器,因为这会增加荒谬的膨胀,包括应用程序和每个供应商的部署的完整修订历史logging 。 看来容器应该只包含他们运行的应用程序版本的代码。 他们已经够胖了。 但是,当我尝试在Docker容器bundle install构build应用程序时, bundle install失败,因为.git目录不存在,导致git ls-files呕吐: fatal: Not a git repository (or any of the parent directories): .git 我怎样才能解决这个问题, 而无需将.git目录添加到容器 。 当我在Gemfile使用源代码的path ,我甚至需要文件列表是否正确? 现在我只是检查如果./.git存在,并设置spec.files = []如果不存在。 这似乎工作到目前为止,但不知道如果/当它会咬我。 我考虑过的其他方法: Glob for .gitignore文件,parsing模式并针对目录中的文件进行过滤。 我已经找遍了图书馆来做这件事,但是还没有find任何东西,而且很难花时间编写和debugging我现在的日程安排。 另外,我认为在Git跟踪的文件匹配忽略模式(强制添加或在忽略模式之前添加)的情况下,这会产生不正确的结果。 在docker docker build之前在主机上生成一个文件清单,如果缺less./.git,gemspec会查找该文件。 虽然增加了复杂性,但似乎远低于(1)和模式。 其他人怎么解决这个问题呢? 任何额外的想法? 提前致谢。

如何在Docker中运行黄瓜/seleniumtesting?

我正在努力从Docker镜像运行我的黄瓜testing。 这是我的设置: 我使用XQuartz的OSX来运行X11会话 我使用Ubuntu 14 Vagrant映像进行开发,并将其转发给我的X11会话 我正在尝试使用Firefox来运行Docker镜像,该镜像将使用我的XQuartz会话进行显示 到目前为止,我设法使用以下设置启动Firefox: # Dockerfile FROM ubuntu:14.04 RUN apt-get update && apt-get install -y firefox # Replace 1000 with something appropriate 😉 RUN export uid=1000 gid=1000 && \ mkdir -p /home/developer && \ echo "developer:x:${uid}:${gid}:Developer,,,:/home/dev:/bin/bash" >> /etc/passwd && \ echo "developer:x:${uid}:" >> /etc/group && \ echo "developer ALL=(ALL) NOPASSWD: ALL" […]

我该如何解决“crontab:你的UID不在passwd文件中。 救助“。

您好我使用的是Docker , 每当写入cron调度规则,但是当我运行whenever –update-crontab在我的docker集装箱这个错误显示给我。 crontab: your UID isn't in the passwd file. bailing out. [fail] Couldn't write crontab; try running `whenever' with no options to ensure your schedule file is valid. Dockerfile FROM ruby:2.4.1-slim RUN apt-get update && apt-get -y install cron ENV RAILS_ENV production ENV INSTALL_PATH /app RUN mkdir -p $INSTALL_PATH WORKDIR $INSTALL_PATH COPY […]

如何将localhost RoR应用程序绑定到语言docker容器?

我有一个在轨道应用程序,这是在0.0.0.0:3000 ruby​​和rubydocker容器在端口0.0.0.0:80。 我想绑定localhost RoR应用程序与docker集装箱,因为postgreSQL在docker集装箱内运行,并希望连接RoR应用程序与docker集装箱内的PostgreSQL。 如何使RoR应用程序和docker容器postgrePSQL之间build立数据库连接。 这是我的RoR控制器。 class CronController < ApplicationController # slack channel hook $slackHook = "https://hooks.slack.com/services/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" $discourseHost = 'community.cloudways.com/'; $messageText = "New Notification"; # import http module require 'net/http' =begin A method which build connection with postgreSQL and fetch last 24hr records =end def slackNotification logger.debug "*******Cron Started********" begin $query = "SELECT users.username AS […]

从CircleCi 2.0迁移后失败的规范

我已经通过Ruby on Rails项目进行迁移,以在CircleCi 2.0上运行testing。 这样做后,一些与file upload相关的规格失败。 我有以下型号: SlideAudio: class SlideAudio < ApplicationRecord # == Extensions ============================================================ Paperclip.interpolates :locale do |attachment, style| attachment.instance.locale end # Tell paperclip that :slide_id means SlideAudio#slide_id # This is used in the custom path and url below when we define the attachment Paperclip.interpolates :slide_id do |attachment, style| attachment.instance.slide_id end has_attached_file :audio, […]

Ruby在侦听接口时会丢失XPathexpression式

对于APItesting,我正在侦听每秒发送消息的接口。 在我的lokal机器上testing运行良好。 我有一个16核Ram的八核处理器。 在我的机器上的Dockercontainer中运行testing时,一切都还好。 (我跑了testing3000次 – 一切都很好)一旦我把docker集装箱放在一个不同的主机上(2个6Gb的内核 – testing只用了2GB),有些testing有时会失败。 这经常发生 – 每15次迭代左右。 现在我想知道可能是什么原因。 这是代码片段。 对不起 – 不是固体…我还在学习:-) def wait_for(xpath_exp, timeout=$timeout) puts 'Waiting for xpath-expression' begin Timeout::timeout(timeout) do $logger.info "#{@name} waiting #{timeout} seconds for message satisfying '#{xpath_exp}'" loop do puts 'waiting for message' msg = @connection.gets(0x4.chr).chomp(0x4.chr) doc = Nokogiri::XML(msg) if not doc.xpath(xpath_exp).empty? $logger.info "#{@name} encountered message […]