Tag: ruby在轨道

如何debugging与撬码在docker的应用程序?

我有一个rails应用程序在开发环境中的Docker容器中运行。 当我尝试在代码中的某处放置binding.pry进行debugging并附加到容器时,我可以在输出中看到pry提示符,但它不会暂停,并且不能像docker那样与其交互容器。 那么如何debugging一个容器化的应用程序呢?

如何把sidekiq放入一个rails应用程序中的Docker?

我正在使用rails,sidekiq和docker。 我的docker-compose.yml文件 sidekiq: build: . command: bundle exec sidekiq -C config/sidekiq.yml links: – db – redis config / sidekiq.yml文件 :pidfile: ./tmp/pids/sidekiq.pid :logfile: ./log/sidekiq.log :queues: – default 运行docker docker-compose up ,sidekiq服务无法正确启动。 sidekiq_1 | No such file or directory @ rb_sysopen – /testapp/tmp/pids/sidekiq.pid sidekiq_1 | /usr/local/bundle/gems/sidekiq-3.5.3/lib/sidekiq/cli.rb:365:in `initialize' sidekiq_1 | /usr/local/bundle/gems/sidekiq-3.5.3/lib/sidekiq/cli.rb:365:in `open' sidekiq_1 | /usr/local/bundle/gems/sidekiq-3.5.3/lib/sidekiq/cli.rb:365:in `write_pid' sidekiq_1 | […]

如何在Travis CI上获得Docker主机IP?

我有一个关于Travis的Rails回购。 它有一个docker-compose.yml文件: postgres: image: postgres ports: – "5433:5432" environment: – POSTGRES_USER=calories – POSTGRES_PASSWORD=secretpassword (我不得不使用5433作为主机端口,因为5432给了我一个错误: Error starting userland proxy: listen tcp 0.0.0.0:5432: bind: address already in use ) 和一个travis.yml: sudo: required services: – docker language: ruby cache: bundler before_install: # Install docker-compose – curl -L https://github.com/docker/compose/releases/download/1.4.0/docker-compose-`uname -s`-`uname -m` > docker-compose – chmod +x docker-compose – sudo […]

在docker下应该设置actioncable的URL是什么?

在Docker下使用带有Actioncable的Rails时,应该将动作电缆URL设置为什么? 通常情况下是这样的 config.action_cable.url = "ws://localhost:3000/cable" 但是这不起作用。 我尝试了一些排列,但我得到的是 Started GET "/cable" for 172.18.0.6 at 2016-11-22 17:49:37 +0000 Started GET "/cable/"[non-WebSocket] for 172.18.0.6 at 2016-11-22 17:49:37 +0000 Failed to upgrade to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: close, HTTP_UPGRADE: ) Finished "/cable/"[non-WebSocket] for 172.18.0.6 at 2016-11-22 17:49:37 +0000 我的docker-compose.yml文件在这里 。 我已经试过使用一个单独的有线电视图像(注释掉)没有任何运气。 我不是那么遥远,应用程序图像和有线电视图像似乎是冲突的,一个或两个美洲狮实例不断重新启动。 解决这将是一个奖金。

Docker for Mac – mkmf.rb找不到ruby的头文件

我更新了我的Mac上的XCode,从那时起,当使用docker-sync-stack start Docker docker-sync-stack start我得到这个错误信息: mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h 我试着安装ruby: brew install rbenv ruby-build但这不会改变任何东西。 有谁知道如何解决它? 谢谢!

Docker多应用程序服务器关于数据库的体系结构

我有一个运行5或6个小Rails应用程序的服务器。 他们所有的附加文件都在S3上,他们都使用MySQL作为数据库。 每个应用程序都有自己的用户,并运行一些thins。 有一个nginx服务器负责平衡和域路由。 我打算用一个Docker安装来replace这个服务器:一个服务器每个应用都有一个容器,前面有一个nginx。 我的问题是:你会把数据库的一部分? 我主要看到4种可能性: 1)每个应用程序容器中的一个Mysql服务器。 我认为这不是Docker的哲学。 这将要求每个容器的数据单独备份。 2)适用于所有应用程序的独特的MySQL容器。 3)主机Docker服务器上的标准MySQL安装。 4)一个单独的MySQL服务器的所有应用程序。 你会怎么做 ? PS:我知道Docker还没有准备好,我打算现在用它来升级,如果我对它满意的话,也可以切换。

Docker,无法使用docker flag -p 3000:3000从localhost:3000进行“rails server”开发

我试图使用docker与铁路,build立一个容器内的整个堆栈。 我的目标是有一个nginx / memcached /独angular兽/ rails / postgres堆栈作为进程pipe理器的runit。 到目前为止,我已经安装了我的app,ruby和postgres。 在这一点上,我试图在移动到nginx / memcached / unicorn之前testing一切是否正常工作。 这是我的dockerfile: FROM ubuntu:trusty ADD . /app # Update repos RUN apt-get update # General RUN apt-get install -y git curl software-properties-common python-software-properties ssh # Install ruby (taken from https://gist.github.com/konklone/6662393) RUN \curl -Lk https://get.rvm.io | bash -s stable RUN /bin/bash -l -c […]

在Docker中使用rbenv

我正在尝试使用Dockerfile设置rbenv,但这只是rbenv install失败。 我有ruby在那里,它似乎并没有工作。 Dockerfile的相关部分(很大程度上取自https://gist.github.com/deepak/5925003 ): #安装rbenv 运行git克隆https://github.com/sstephenson/rbenv.git / usr / local / rbenv 运行echo'#rbenv setup'> /etc/profile.d/rbenv.sh RUN echo'export RBENV_ROOT = / usr / local / rbenv'>> /etc/profile.d/rbenv.sh RUN echo'export PATH =“$ RBENV_ROOT / bin:$ PATH”'>> /etc/profile.d/rbenv.sh 运行echo'eval“$(rbenv init – )”>> >> /etc/profile.d/rbenv.sh 运行chmod + x /etc/profile.d/rbenv.sh #安装ruby-build 运行mkdir / usr / local / rbenv / […]

预编译的资产在泊坞窗图像中不存在

我正在尝试使用docker运行简单的Rails应用程序。 源自数据容器“app”的源代码。 'app'数据容器也被nginx用于服务器预编译的资产和静态文件。 但是在运行“bundle exec rake assets:precompile”之后没有find预编译的资源。 我在使用VirtualBox的Mac OS X上使用docker(Docker version 1.10.1,build 9e83765)。 泊坞窗,compose.yml version: '2' services: web: build: . command: bundle exec puma env_file: .env environment: – RACK_ENV=production – RAILS_ENV=production volumes_from: – app ports: – "3000:3000" links: – db nginx: image: nginx ports: – "80:80" volumes_from: – app volumes: – /app/public:/usr/share/nginx/html:ro – /app/config/deploy/nginx.conf:/etc/nginx/conf.d/default.conf db: […]

Sidekiq在本地主机上查找redis,而不是在远程

我有这个在我的sidekiq初始值设定项中: Sidekiq.configure_server do |config| config.redis = { url: "redis://#{ENV['REDIS_PORT_6379_TCP_ADDR']}:#{ENV['REDIS_PORT_6379_TCP_PORT']}/0", namespace: 'Tyresearch' } end 当我启动sidekiq它正确的主机和端口开始罚款: INFO: Booting Sidekiq 3.2.4 with redis options {:url=>"redis://172.17.0.6:6379/0", :namespace=>"Tyresearch"} 但是,当我尝试启动一个工人或访问sidekiqpipe理面板时,我得到这个错误: Redis::CannotConnectError at /sidekiq Error connecting to Redis on 127.0.0.1:6379 (ECONNREFUSED) 所以,由于某种原因它现在试图连接127.0.0.1而不是172.17.0.6 这里是我的env(应用程序由stream浪者pipe理的链接的docker容器组成) {"ADMIN_EMAIL"=>"user@example.com", "ADMIN_NAME"=>"First User", "ADMIN_PASSWORD"=>"changeme", "BUNDLE_BIN_PATH"=> "/opt/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.7.4/bin/bundle", "BUNDLE_GEMFILE"=>"/var/www/Gemfile", "COLUMNS"=>"135", "GEM_HOME"=>"/var/bundle/ruby/2.1.0", "GEM_PATH"=>"", "GMAIL_PASSWORD"=>"Your_Password", "GMAIL_USERNAME"=>"Your_Username", "HOME"=>"/home/web", "HOSTNAME"=>"223b7ef7396f", "LESSCLOSE"=>"/usr/bin/lesspipe %s %s", "LESSOPEN"=>"| /usr/bin/lesspipe […]