lgromanowski / acme-plugin

:lock_with_ink_pen: ACME protocol plugin for Ruby on Rails applications
https://rubygems.org/gems/acme_plugin
MIT License
187 stars 30 forks source link

Error when running rake letsencrypt_plugin using joined array of outputs #50

Open simonv3 opened 8 years ago

simonv3 commented 8 years ago

When writing the letsencrypt_plugin.yml file it seems to not like the dynamically created array:

1. Expected behavior

Running rake letsencrypt_plugin outputs

I, [2016-09-24T08:49:40.761340 #4162]  INFO -- : Trying to register at Let's Encrypt service...
I, [2016-09-24T08:49:40.761411 #4162]  INFO -- : Loading private key...
I, [2016-09-24T08:49:41.796374 #4162]  INFO -- : Acme::Client::Error::Malformed - Registration key is already in use
I, [2016-09-24T08:49:41.796482 #4162]  INFO -- : Already registered.
(etc)

2. Actual behavior

Running rake letsencrypt_plugin outputs:

Psych::SyntaxError: (/Users/simon/src/openfarm/OpenFarm/config/letsencrypt_plugin.yml): did not find expected key while parsing a block mapping at line 2 column 3
/Users/simon/src/openfarm/OpenFarm/config/environment.rb:17:in `<top (required)>'
Tasks: TOP => letsencrypt_plugin => setup_logger => environment

3. Steps to reproduce issue

  1. Set config file to:
default: &default
  endpoint: 'https://acme-v01.api.letsencrypt.org/'
  email: 'hi@openfarm.cc'
  domain: '<%= ['openfarm.cc', 'www.openfarm.cc', 'blog.openfarm.cc'].join(' ') %>'

  # in Rails.root, path to private key
  private_key: 'key/keyfile.pem'

  # in Rails.root, path where certificates
  # will be stored (on Heroku this variable is ignored)
  output_cert_dir: 'certificates'

  # in Rails.root, path where challenge token
  # will be stored in case when DB will not be used
  challenge_dir_name: 'challenge'

production:
  <<: *default

development:
  <<: *default

test:
  <<: *default
  1. Set up directories as per the instructions.
  2. Run rake letsencrypt_plugin

Changing the domain to be: domain: 'openfarm.cc www.openfarm.cc blog.openfarm.cc'

gets past that first bump, though now I'm getting the error saying that I am getting an invalid response, and that's probably because I'm running the script on my local rather than on Heroku. Maybe that's the reason that the rake job fails?

4. Your configuration (ruby, rails version, your Gemifile and Gemfile.lock files etc.)

source 'https://rubygems.org'

ruby '2.2.5'

gem 'bundler', '>= 1.7.0'

gem 'rails', '~> 4.2.0'

# Foundation
gem 'foundation-rails', '~> 5.4.5'
gem 'sass-rails', '~> 4.0.4'
gem 'compass-rails', '~> 2.0.0'
gem 'font-awesome-sass'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails'
gem 'therubyracer', platforms: :ruby
gem 'jquery-rails'
gem 'bcrypt'
gem 'mongoid-paperclip', require: 'mongoid_paperclip'
gem 'mongoid-slug'
gem 'aws-sdk'
gem 'aws-sdk-rails'
gem 'mutations'
gem 'rack-attack'
gem 'impressionist'
gem 'rack-cors', require: 'rack/cors'
gem 'delayed_job_mongoid'
gem 'delayed_job_shallow_mongoid'
gem 'activejob_backport'
gem 'patron' # For searchKick
gem 'searchkick'
gem 'pundit'
gem 'eventmachine'
gem 'merit'
gem 'gibbon', '~> 1.1.5'
gem 'jsonapi-serializers', '~> 0.2.4'
gem 'mongoid-history'

gem 'utf8-cleaner'

gem 'bson_ext'
gem 'mongoid', '~>4.0.2'
gem 'active_model_serializers'

# LETS ENCRYPT!
gem 'letsencrypt_plugin'

# Asset management using bower
# https://rails-assets.org/
source 'https://rails-assets.org' do
  gem 'rails-assets-jquery', '~> 2.2.1'
  gem 'rails-assets-jquery-ui', '~> 1.11.4'
  gem 'rails-assets-angular', '~> 1.5.0'
  gem 'rails-assets-angular-dragdrop', '~> 1.0.13'
  gem 'rails-assets-angular-foundation', '~> 0.8.0'
  gem 'rails-assets-angular-ui-sortable', '~> 0.13.4'
  gem 'rails-assets-angular-local-storage', '~> 0.2.3'
  gem 'rails-assets-angular-typeahead', '~> 0.3.1'
end

group :development, :test do
  gem 'coveralls', require: false
  gem 'quiet_assets'
  gem 'better_errors'
  gem 'rspec-rails'
  gem 'pry'
  gem 'pry-nav'
  gem 'launchy'
  gem 'factory_girl_rails'
  gem 'faker'
end

group :test do
  gem 'test-unit'
  gem 'smarf_doc'
  gem 'capybara'
  gem 'capybara-angular'
  gem 'poltergeist'
  gem 'phantomjs', '>= 1.8.1', :require => 'phantomjs/poltergeist'
  gem 'simplecov'
  gem 'database_cleaner', '~> 1.3.0'
  gem 'vcr'
  gem 'webmock'
end

group :development do
  gem 'rubocop'
  gem "letter_opener"
end

group :production, :staging do
  gem 'thin'
  gem 'exception_notification'
  gem 'rails_12factor'
  # https://github.com/heroku/rack-timeout
  gem 'rack-timeout'
end

#Used for static pages in /app/views/pages
gem 'high_voltage'
gem 'devise', '~> 4.2.0'
gem 'rails_admin'
gem 'ng-rails-csrf'
hovancik commented 8 years ago
 now I'm getting the error saying that I am getting an invalid response, and that's probably because I'm running the script on my local rather than on Heroku. Maybe that's the reason that the rake job fails?

Yes. It needs to be run on the server where your domains are running (wherever your openfarm.cc is, eg. heroku).