Tag: ruby在轨道

铁轨泊坞窗应用程序捆绑耙中止

我正在尝试使用docker创buildRails应用程序,并在初始docker build过程中出现错误。 我一直在关注各种教程,试图让这个工作,但没有任何运气。 我的错误: Step 10/12 : RUN bundle exec rake RAILS_ENV=production DATABASE_URL=postgresql://user:pass@127.0.0.1/neo SECRET_TOKEN=foobar assets:precompile —> Running in d3d282e3eb8b /usr/local/bundle/gems/activesupport-5.0.1/lib/active_support/xml_mini.rb:51: warning: constant ::Fixnum is deprecated /usr/local/bundle/gems/activesupport-5.0.1/lib/active_support/xml_mini.rb:52: warning: constant ::Bignum is deprecated rake aborted! NoMethodError: undefined method `split' for nil:NilClass /app/config/application.rb:57:in `<class:Application>' /app/config/application.rb:10:in `<module:NeoDocker>' /app/config/application.rb:9:in `<top (required)>' /app/Rakefile:5:in `require_relative' /app/Rakefile:5:in `<top (required)>' /usr/local/bundle/gems/rake-12.0.0/exe/rake:27:in `<top (required)>' /usr/local/bin/bundle:23:in […]

Rspectesting对Docker容器失败

免责声明:我是新来ruby,RSpec等我试图find我的docker集装箱的testing框架 我有一个dockers容器,运行aws cli。 我已经testing了这个手动和它的工作,作为我的testing的一部分,我想获得AWS版本并检查它。 我已经创build了这个testing it "aws is the correct version" do expect(aws_version).to include("aws") end def aws_version command("aws –version").stdout end 当我运行它时,我得到的显示,作为空白,它看起来像没有运行,并返回任何东西 1) Dockerfile aws is the coorect version Failure/Error: expect(aws_version).to include("aws") expected "" to include "aws" # ./tests_spec.rb:37:in `block (2 levels) in <top (required)>' 我所有的其他testing正确地对容器运行。 我在下面包含了我的dockerfile和test_spec Dockerfile: FROM ubuntu:16.04 ENV LAST_UPDATE=09-04-2017 ##################################################################################### # Current version […]

在docker for rails应用程序rest-client中启用CORS

我有两个应用程序运行在不同的泊坞窗图像。 首先暴露在端口3000:3000和第二4000:4000。 第一个应用程序有一些资源,我想通过第二个应用程序使用rest-client获取。 docker集装箱可能是个问题。 这里有错误: Errno :: ECONNREFUSED在FilmsController#index中 无法打开TCP连接到本地主机:3000(连接被拒绝 – 连接(2)为“本地主机”端口3000) //第一个应用程序: 公开http:// localhost:3000 / movies上的资源 对其他networking开放 允许交叉来源请求 第一个应用程序的application.rb文件 module Movies class Application < Rails::Application config.web_console.whiny_requests = false config.middleware.insert_before 0, Rack::Cors do allow do origins '*' resource '*', :headers => :any, :methods => [:get, :post, :options] end end end end //第二个应用程序: 在端口上运行:4000 有一个模型电影 一个控制器 电影模型: […]

Sidekiq使用redis的不正确的URL

我build立了我的Docker环境,并试图让sidekiq与我的其他服务一起使用docker docker-compose up ,但是sidekiq在尝试连接到错误的 redis URL时抛出一个错误: redis_1 | 1:M 19 Jun 02:04:35.137 * The server is now ready to accept connections on port 6379 sidekiq_1 | Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED) 我相当有信心,在我的Rails应用程序中没有引用将有Sidekiq连接到本地主机,而不是docker-compose.yml中创build的redis服务: version: '3' services: db: image: postgres web: build: . command: bundle exec rails s -p 3000 -b '0.0.0.0' volumes: – .:/app […]

如何运行与水豚&poltergeistdocker集装箱内的function规格

我有一个ruby轨道5应用程序,我写了一些function规格,利用capybara和poltergeist 。 他们自己运行的很好 – 但是,当我在docker集装箱内运行它们时,它们爆炸得非常壮观。 在Docker方面我相当绿色,而且在弄清楚如何自己debugging的时候,我有些迷失了方向。 我发现了一些利用selenium但不与capybara结合的资源。 这里有一些configuration文件: Dockerfile FROM ruby:2.4.1 ENV DIR=/app \ BUNDLE_JOBS=4 \ PHANTOMJS=phantomjs-2.1.1-linux-x86_64 RUN apt-get update -qq && apt-get upgrade -y && apt-get install -y build-essential libpq-dev nodejs ADD https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOMJS.tar.bz2 / RUN mv ./$PHANTOMJS/bin/phantomjs /usr/local/bin RUN rm -rf ./$PHANTOMJS RUN phantomjs –version RUN mkdir $DIR WORKDIR $DIR ADD Gemfile $DIR/Gemfile ADD […]

Docker-compose – Ruby – 指南针 – inotify

我试图让一个Docker容器能够看我的项目并编译应该编译的内容。 有了Sass,我有一些与inotify相关的问题。 当我尝试启动时: compass watch –sass-dir /var/www/project/styles/sass/ –css-dir /var/www/project/styles/ -c /var/www/project/styles/config.rb 我有这个错误: root@88843683f769:/# compass watch –sass-dir /var/www/lbo_legacy/styles/sass –css-dir /var/www/lbo_legacy/styles/ -c /var/www/lbo_legacy/styles/config.rb –trace >>> Compass is watching for changes. Press Ctrl-C to Stop. Errno::EMFILE on line ["58"] of /var/lib/gems/2.3.0/gems/rb-inotify-0.9.10/lib/rb-inotify/notifier.rb: Too many open files – Failed to initialize inotify: the user limit on the total number of […]

如何pipe理dockerized应用程序中的GPG钥匙串?

我正在开发一个dockerized的Ruby on Rails应用程序,它有一个工作负责解密一系列文件,然后将它们加载到我们的数据库中。 由于gpg钥匙串不保证在部署之间包含私钥,工作人员必须下载私钥并每次导入。 require 'gpgme' def setup_gpg private_key = Tempfile.new(PRIVATE_KEY).binmode s3_client.get_object(bucket: config[:bucket], key: PRIVATE_KEY, response_target: private_key) GPGME::Key.import(private_key) end def decrypt_file(enc_file) decrypted_filename = enc_file.path.sub('.gpg', '.csv') File.open(enc_file) do |encrypted_file| File.open(decrypted_filename, 'w+') do |decrypted_file| crypto = GPGME::Crypto.new crypto.decrypt(encrypted_file, output: decrypted_file, password: config[:passphrase]) return decrypted_file end end end 我使用GPGME gem与ruby中的gpg二进制文件进行交互。 这种方法的问题是: 私钥存在于S3存储桶中 每次作业运行时都必须下载并导入私钥 我们可以通过检查密钥是否已经在keychain中来干这个过程,但是我想要完全消除这个步骤。 是否有一个最佳做法,如何维护dockerized应用程序的gpg钥匙串? 我有什么select来消除在S3中存储密钥而不提交密钥到源代码控制的需要?

如何将已安装的gem复制到另一个泊坞窗图像?

我尝试了Docker多阶段构build,为rails生产运行时创build一个干净的映像。 我做了如下所示的Dockerfile # Build image FROM scardon/ruby-node-alpine:2.4.2 AS build-env COPY Gemfile* ./ RUN apk update && \ apk add –no-cache –virtual build-dependencies PACKAGES && \ gem install bundler && \ bundle install && \ bundle exec assets:precompile && \ bundle exec assets:sync # Runtime image FROM ruby:2.4.2-alpine3.6 COPY . . # $BUNLE_PATH is set to […]

从Docker容器内部访问主机上的redis?

我有一个主机服务器,我正在部署一个dockerized Rails应用程序。 主机服务器上的redis没有被docker化。 我试图找出如何从dockerized Rails应用程序中访问主机服务器上的redis pub / sub。 主机服务器上的redis被configuration为只能从本地主机访问。 有没有我转发的酒吧/子邮件到docker集装箱? 如果它变得更容易,我不需要发布消息,只需要阅读它们。

捆绑商安装gem不坚持无花果/docker

我正在尝试使用fig和docker为现有的rails应用程序build立一个本地开发环境。 在构build过程中,我清楚地看到bundler安装应用程序的gem,但是当我尝试用fig up命令启动容器,甚至使用/ bin / bash命令重新打开容器时,gem是不可见的。 这是Dockerfile: FROM ubuntu:14.04 # REPOS RUN apt-get -qq update RUN apt-get install -y software-properties-common RUN add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe" RUN add-apt-repository -y ppa:chris-lea/node.js RUN apt-get -y update #INSTALL RUN apt-get install -y -q build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev […]