bosh deploy get uninitialized constant Fog::AWS::CredentialFetcher (NameError) - initialization

I am try deploy stcemcells by use bosh micro.
I have a stemcell bosh-stemcell-2719.2-openstack-kvm-centos-go_agent.tgz and a deploy file micro_bosh.yml
they are in same folder "my-micro-deployment"
my deploy file micro_bosh.yml's content is in follow
---
name: microbosh-openstack
logging:
level: DEBUG
network:
type: dynamic
vip: 172.24.10.131
cloud_properties:
net_id: 9e5a6fd5-fa2e-48da-94ce-f85337bc2451
resources:
persistent_disk: 20000
cloud_properties:
instance_type: m1.small
cloud:
plugin: openstack
properties:
openstack:
auth_url: http://172.24.10.128:5000/v2.0
username: demo
api_key: openstack
tenant: demo
default_security_groups: [bosh]
default_key_name: demokey
private_key: /home/roger/my-micro-deployment/demokey.pem
apply_spec:
properties:
director:
max_threads: 2
hm:
resurrector_enabled: true
ntp:
- time.asia.apple.com
then I execute command
bosh micro deployment micorbosh.yml
then I execute command
bosh micro deploy bosh-stemcell-2719.2-openstack-kvm-centos-go_agent.tgz
after the above commands be executed I get the error
`/home/roger/.gem/ruby/gems/fog-aws-0.1.2/lib/fog/aws/auto_scaling.rb:4:in `<class:AutoScaling>': uninitialized constant Fog::AWS::CredentialFetcher (NameError)
from /home/roger/.gem/ruby/gems/fog-aws-0.1.2/lib/fog/aws/auto_scaling.rb:3:in `<module:AWS>'
from /home/roger/.gem/ruby/gems/fog-aws-0.1.2/lib/fog/aws/auto_scaling.rb:2:in `<module:Fog>'
from /home/roger/.gem/ruby/gems/fog-aws-0.1.2/lib/fog/aws/auto_scaling.rb:1:in `<top (required)>'
from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:73:in `require'
from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:73:in `require'
from /home/roger/.gem/ruby/gems/fog-1.27.0/lib/fog/aws.rb:2:in `<top (required)>'
from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:73:in `require'
from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:73:in `require'
from /home/roger/.gem/ruby/gems/fog-1.27.0/lib/fog.rb:23:in `<top (required)>'
from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:73:in `require'
from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:73:in `require'
from /home/roger/.gem/ruby/gems/bosh-registry-1.2922.0/lib/bosh/registry.rb:10:in `<top (required)>'
from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:73:in `require'
from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:73:in `require'
from /home/roger/.gem/ruby/gems/bosh-registry-1.2922.0/bin/bosh-registry:3:in `<top (required)>'
from /home/roger/bin/bosh-registry:23:in `load'
from /home/roger/bin/bosh-registry:23:in `<main>'
bosh-registry -c /tmp/d20150414-92091-1rc0vqs/bosh_registry_yml20150414- 92091-9n3izm` failed, exit status=1``
can any one give me some advice?
thanks in advance it block me 3 days.

I have come across this issue recently as well on my MacOS machine (everything works fine on my Linux machine). I haven't yet gone deep into it but as a workaround you can place the
require_relative('.')
string at the beginning of the /home/roger/.gem/ruby/gems/fog-aws-0.1.2/lib/fog/aws/auto_scaling.rb.

Related

How to configure two processes in a heroku dyno to communicate with each other

I'm trying to establish communication between 2 processes running in a single heroku dyno, which according to this documentation should be possible:
https://devcenter.heroku.com/articles/dynos#networking
Individual processes within a dyno can bind to any address or port they want and communicate among them using e.g. standard TCP
I'm attempting to use http and the code works fine on my development machine. But when I try to execute the same thing on heroku, the source process can't connect to the target process. One process is running using nodejs and the other process is running using python.
Here's the contents of the Procfile:
web: npm run start
worker: python3 -m scripts.app
Here's part of the axios error message from the originating node process:
020-11-17T18:30:22.385020+00:00 app[web.1]: Inside nltk error block
2020-11-17T18:30:22.387506+00:00 app[web.1]: Error: connect ECONNREFUSED 127.0.0.1:5010
2020-11-17T18:30:22.387507+00:00 app[web.1]: at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) {
2020-11-17T18:30:22.387508+00:00 app[web.1]: errno: 'ECONNREFUSED',
2020-11-17T18:30:22.387508+00:00 app[web.1]: code: 'ECONNREFUSED',
2020-11-17T18:30:22.387509+00:00 app[web.1]: syscall: 'connect',
2020-11-17T18:30:22.387509+00:00 app[web.1]: address: '127.0.0.1',
2020-11-17T18:30:22.387509+00:00 app[web.1]: port: 5010,
The Procfile defines the process types. They will be run in separate containers.
If you want to run multiple processes in one dyno, your Procfile should have only one entry and one processes that will have your services are children.
There are several methods and buildpacks to achieve this.

Need Ansible playbook inorder to calculate number of users currently login into VPN

Writing ansible playbook for "Count number of users currently login to VPN".Using Junos modules as suggested by network team.I have installed below softwares on my RHEL 7 machine with Ansible 2.9 version installed.
Junos Ansible Requirements
===============================
-->Install Dependencies
# pip install ncclient
# pip install junos-eznc
--> Install Juniper.junos Galaxy role
ansible-galaxy install juniper.junos
---> Have NETCONF enabled on Juniper devices over SSH
# set system services netconf ssh
--->(Optional)
#pip install junos-netconify (python lib for juniper console)
Whenever i am writing any playbook, I am getting below error.
Playbook:-
---
- name: Get device uptime
hosts:
- dc1
roles:
- Juniper.junos
connection: local
gather_facts: no
vars_prompt:
- name: username
prompt: Junos Username
private: no
- name: password
prompt: Junos Password
private: yes
tasks:
- name: get uptime using galaxy module
junos_command:
commands: show system uptime
register: uptime
- name: display uptimes
debug: var=uptime
Error:-
PLAY [Get device uptime] **************************************************************************************************************
TASK [get uptime using galaxy module] *************************************************************************************************
fatal: [172.16.130.1]: FAILED! => {"changed": false, "msg": "invalid rpc for running in check_mode"}
PLAY RECAP ****************************************************************************************************************************
172.16.130.1 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
I was just exploring ansible networking commands & got above error.Please suggest what configurations required working with junos.
Please find below playbook to check no. of users currently login to VPN:-
name: Get system users currently logged in
hosts: all
connection: local
gather_facts: no
roles:
Juniper.junos
tasks:
name: Retrieve facts from device running Junos OS
juniper_junos_facts:
name: Print version
debug:
var: junos.fqdn
name: Run RPC Commands
juniper_junos_command:
commands="show security dynamic-vpn users"
format=text
dest={{ junos.fqdn }}.output

When running SeverSpec test, `initialize': getaddrinfo: Name or service not known (SocketError) error is occurred

I am new to Serverspec testing tool.
When running test, I got the following error.
[root#ost-svr004 serverspec]# rake spec
/usr/bin/ruby -I/usr/lib/ruby/gems/2.1.0/gems/rspec-support-3.1.2/lib:/usr/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib /usr/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/exe/rspec --pattern spec/www.example.jp/\*_spec.rb
/usr/lib/ruby/gems/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/transport/session.rb:70:in `initialize': getaddrinfo: Name or service not known (SocketError)
from /usr/lib/ruby/gems/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/transport/session.rb:70:in `open'
from /usr/lib/ruby/gems/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/transport/session.rb:70:in `block in initialize'
from /usr/lib/ruby/2.1.0/timeout.rb:76:in `timeout'
from /usr/lib/ruby/2.1.0/timeout.rb:127:in `timeout'
from /usr/lib/ruby/gems/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/transport/session.rb:67:in `initialize'
from /usr/lib/ruby/gems/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh.rb:202:in `new'
from /usr/lib/ruby/gems/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh.rb:202:in `start'
.....
/usr/bin/ruby -I/usr/lib/ruby/gems/2.1.0/gems/rspec-support-3.1.2/lib:/usr/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib /usr/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/exe/rspec --pattern spec/www.example.jp/\*_spec.rb failed
During the Serverspec installation, I followed the instructions from http://serverspec.org/.
As the prerequisite, I also installed the "Developer Tools", Ruby and RubyGem.
In fact, when running the serverspec test for localhost Exec (local), it is okay and there is no problem occurred. But when running test for remote hosts, it is failed and this problem is occurred.
Finally , I got the solution from this link. http://www.firedaemon.com/blog/passwordless-root-ssh-public-key-authentication-on-centos-6 I created SSH RSA key on the client machine (ie. the one you are SSH'ing from) and copy it to remote host..

Rails 4, Asset Compiling

I have probably wasting 4 hours trying to make this problem go away and not sure what the problem is.
Locally I have been creating my Rails Application and all the assets load properly which can be see here:
<link data-turbolinks-track="true" href="/assets/application.css?body=1" media="all" rel="stylesheet" />
<link data-turbolinks-track="true" href="/assets/auth.css?body=1" media="all" rel="stylesheet" />
<link data-turbolinks-track="true" href="/assets/authenications.css?body=1" media="all" rel="stylesheet" />
<link data-turbolinks-track="true" href="/assets/customelements.css?body=1" media="all" rel="stylesheet" />
<link data-turbolinks-track="true" href="/assets/grid.css?body=1" media="all" rel="stylesheet" />
<link data-turbolinks-track="true" href="/assets/home.css?body=1" media="all" rel="stylesheet" />
<link data-turbolinks-track="true" href="/assets/material.css?body=1" media="all" rel="stylesheet" />
<link data-turbolinks-track="true" href="/assets/materials.css?body=1" media="all" rel="stylesheet" />
<link data-turbolinks-track="true" href="/assets/project_materials.css?body=1" media="all" rel="stylesheet" />
<link data-turbolinks-track="true" href="/assets/projects.css?body=1" media="all" rel="stylesheet" />
<link data-turbolinks-track="true" href="/assets/registrations.css?body=1" media="all" rel="stylesheet" />
<link data-turbolinks-track="true" href="/assets/show.css?body=1" media="all" rel="stylesheet" />
<link data-turbolinks-track="true" href="/assets/static.css?body=1" media="all" rel="stylesheet" />
<link data-turbolinks-track="true" href="/assets/testing.css?body=1" media="all" rel="stylesheet" />
<link data-turbolinks-track="true" href="/assets/grid.css?body=1" media="all" rel="stylesheet" />
<script data-turbolinks-track="true" src="/assets/jquery.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/jquery_ujs.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/auth.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/authenications.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/grid.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/mat.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/material.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/materials.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/polygon.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/project_materials.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/projects.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/registrations.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/static.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/testing.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/application.js?body=1"></script>
So, cool it works in development mode... but then it doesn't work when I push to heroku!
<title>BuyABrick</title>
<link data-turbolinks-track="true" href="/assets/application-5c6e8eba841451fd8e44660093bd224e.css" media="all" rel="stylesheet" />
<link data-turbolinks-track="true" href="/assets/grid-fc208f1a1279c5b79eec166dc18c02f6.css" media="all" rel="stylesheet" />
<script data-turbolinks-track="true" src="/assets/application-6aa3a38ecf886de2bf443a2b4b67ab04.js"></script>
<meta content="authenticity_token" name="csrf-param" />
<meta content="aCmkfVxhDEO4PtC3AdHhLZ9smJ+9shdchBT0mkYqQvM=" name="csrf-token" />
And when I click on the
<link data-turbolinks-track="true" href="/assets/application-5c6e8eba841451fd8e44660093bd224e.css" media="all" rel="stylesheet" />
the server returns to me an internal server error (EDIT Didn't realise that the HTML screws everything up here)
So I have tried all the soultions by researching the internet for everything known to man. Here are the files that I have...
config/environment/production.rb
BuyABrick::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both thread web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable Rails's static asset server (Apache or nginx will already do this).
config.serve_static_assets = true
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = true
# Generate digests for assets URLs.
config.assets.digest = true
# Version of your assets, change this if you want to expire all your assets.
config.assets.version = '1.0'
# Specifies the header that your server uses for sending files.
config.action_dispatch.x_sendfile_header = "nill" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = true
# Set to :debug to see everything in the log.
config.log_level = :info
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
config.assets.precompile += %w( application.css)
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Disable automatic flushing of the log to improve performance.
# config.autoflush_log = false
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
end
Any help will be appreciated.. if you want more code look into my github..
https://github.com/srizzling/BuyABrick
Thanks!
Heroku logs
$ heroku logs
2013-09-16T12:54:31.548606+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:140:in `variation'
2013-09-16T12:54:31.548606+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:133:in `call'
2013-09-16T12:54:31.548606+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:97:in `call'
2013-09-16T12:54:31.548606+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2013-09-16T12:54:31.548606+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2013-09-16T12:54:31.548606+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2013-09-16T12:54:31.548606+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2013-09-16T12:54:31.548787+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2013-09-16T12:54:31.548787+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2013-09-16T12:54:31.574177+00:00 heroku[router]: at=info method=GET path=/assets/application-6aa3a38ecf886de2bf443a2b4b67ab04.js host=buyabrickonline.herokuapp.com fwd="115.188.114.182" dyno=web.1 connect=3ms service=24ms status=500 bytes=334
2013-09-16T12:54:31.571790+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:133:in `call'
2013-09-16T12:54:31.571790+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:511:in `call'
2013-09-16T12:54:31.571790+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2013-09-16T12:54:31.571790+00:00 app[web.1]: [2013-09-16 12:54:31] ERROR ArgumentError: wrong number of arguments (0 for 1)
2013-09-16T12:54:31.571790+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:140:in `variation'
2013-09-16T12:54:31.571790+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/ssl.rb:24:in `call'
2013-09-16T12:54:31.571790+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:97:in `call'
2013-09-16T12:54:31.571790+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2013-09-16T12:54:31.571790+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2013-09-16T12:54:31.571790+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2013-09-16T12:54:31.571970+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2013-09-16T12:54:31.571970+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2013-09-16T12:54:31.553228+00:00 heroku[router]: at=info method=GET path=/assets/application-5c6e8eba841451fd8e44660093bd224e.css host=buyabrickonline.herokuapp.com fwd="115.188.114.182" dyno=web.1 connect=3ms service=9ms status=500 bytes=334
2013-09-16T12:54:31.885143+00:00 app[web.1]: [2013-09-16 12:54:31] ERROR ArgumentError: wrong number of arguments (0 for 1)
2013-09-16T12:54:31.885143+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:140:in `variation'
2013-09-16T12:54:31.885143+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/ssl.rb:24:in `call'
2013-09-16T12:54:31.885143+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:511:in `call'
2013-09-16T12:54:31.885143+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:133:in `call'
2013-09-16T12:54:31.885143+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:97:in `call'
2013-09-16T12:54:31.885143+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2013-09-16T12:54:31.885143+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2013-09-16T12:54:31.885290+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2013-09-16T12:54:31.885290+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2013-09-16T12:54:31.885143+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2013-09-16T12:54:31.885143+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2013-09-16T12:54:31.892947+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=buyabrickonline.herokuapp.com fwd="115.188.114.182" dyno=web.1 connect=2ms service=17ms status=500 bytes=334
2013-09-16T12:54:35.755436+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2013-09-16T12:54:35.755436+00:00 app[web.1]: [2013-09-16 12:54:35] ERROR ArgumentError: wrong number of arguments (0 for 1)
2013-09-16T12:54:35.755436+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:140:in `variation'
2013-09-16T12:54:35.755436+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:133:in `call'
2013-09-16T12:54:35.755436+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/ssl.rb:24:in `call'
2013-09-16T12:54:35.755436+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:511:in `call'
2013-09-16T12:54:35.755436+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:97:in `call'
2013-09-16T12:54:35.755436+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2013-09-16T12:54:35.755436+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2013-09-16T12:54:35.755436+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2013-09-16T12:54:35.755629+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2013-09-16T12:54:35.755629+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2013-09-16T12:54:35.757107+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=buyabrickonline.herokuapp.com fwd="115.188.114.182" dyno=web.1 connect=2ms service=10ms status=500 bytes=334
2013-09-16T12:54:43.891290+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2013-09-16T12:54:43.891290+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2013-09-16T12:54:43.891290+00:00 app[web.1]: [2013-09-16 12:54:43] ERROR ArgumentError: wrong number of arguments (0 for 1)
2013-09-16T12:54:43.891290+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:140:in `variation'
2013-09-16T12:54:43.891290+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:133:in `call'
2013-09-16T12:54:43.891290+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/ssl.rb:24:in `call'
2013-09-16T12:54:43.891290+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:511:in `call'
2013-09-16T12:54:43.891290+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:97:in `call'
2013-09-16T12:54:43.891290+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2013-09-16T12:54:43.891290+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2013-09-16T12:54:43.891475+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2013-09-16T12:54:43.891475+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2013-09-16T12:54:43.895919+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=buyabrickonline.herokuapp.com fwd="115.188.114.182" dyno=web.1 connect=29ms service=8ms status=500 bytes=334
2013-09-16T12:56:14.421956+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/ssl.rb:24:in `call'
2013-09-16T12:56:14.421956+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:140:in `variation'
2013-09-16T12:56:14.421956+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:133:in `call'
2013-09-16T12:56:14.421956+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:97:in `call'
2013-09-16T12:56:14.421956+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2013-09-16T12:56:14.421956+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:511:in `call'
2013-09-16T12:56:14.421956+00:00 app[web.1]: [2013-09-16 12:56:14] ERROR ArgumentError: wrong number of arguments (0 for 1)
2013-09-16T12:56:14.421956+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2013-09-16T12:56:14.421956+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2013-09-16T12:56:14.421956+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2013-09-16T12:56:14.422129+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2013-09-16T12:56:14.422129+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2013-09-16T12:56:14.423497+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=buyabrickonline.herokuapp.com fwd="115.188.114.182" dyno=web.1 connect=1ms service=5ms status=500 bytes=334
2013-09-16T13:00:55.666613+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:511:in `call'
2013-09-16T13:00:55.666613+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:97:in `call'
2013-09-16T13:00:55.666613+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2013-09-16T13:00:55.666613+00:00 app[web.1]: [2013-09-16 13:00:55] ERROR ArgumentError: wrong number of arguments (0 for 1)
2013-09-16T13:00:55.666613+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:140:in `variation'
2013-09-16T13:00:55.666613+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:133:in `call'
2013-09-16T13:00:55.666613+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/ssl.rb:24:in `call'
2013-09-16T13:00:55.666613+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2013-09-16T13:00:55.666613+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2013-09-16T13:00:55.666613+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2013-09-16T13:00:55.666801+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2013-09-16T13:00:55.666801+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2013-09-16T13:00:56.096391+00:00 app[web.1]: [2013-09-16 13:00:56] ERROR ArgumentError: wrong number of arguments (0 for 1)
2013-09-16T13:00:56.096391+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:140:in `variation'
2013-09-16T13:00:56.096391+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:133:in `call'
2013-09-16T13:00:56.096391+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/ssl.rb:24:in `call'
2013-09-16T13:00:56.096391+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:511:in `call'
2013-09-16T13:00:56.096391+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:97:in `call'
2013-09-16T13:00:56.096391+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2013-09-16T13:00:56.096391+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2013-09-16T13:00:56.096391+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2013-09-16T13:00:56.096391+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2013-09-16T13:00:56.096581+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2013-09-16T13:00:56.096581+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2013-09-16T13:00:56.100801+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=buyabrickonline.herokuapp.com fwd="115.188.114.182" dyno=web.1 connect=59ms service=7ms status=500 bytes=334
2013-09-16T13:00:55.669488+00:00 heroku[router]: at=info method=GET path=/assets/application-5c6e8eba841451fd8e44660093bd224e.css host=buyabrickonline.herokuapp.com fwd="115.188.114.182" dyno=web.1 connect=2ms service=5ms status=500 bytes=334
Webrick chucking errors at me
Ok.. this issue above is do with my SSL config... fixed that now the issue is...
So I cloned your repo and had a play around locally, here are the steps I took to make it work.
production.rb
Commented out this line as it doesn't seem necessary on other
# Disable Rails's static asset server (Apache or nginx will already do this).
#config.serve_static_assets = false
Commented out this line too
# Do not fallback to assets pipeline if a precompiled asset is missed.
#config.assets.compile = true
And this one
# Specifies the header that your server uses for sending files.
#config.action_dispatch.x_sendfile_header = "nill" # for apache
RAILS_ENV=production rails s now seems to be working just fine.
I also removed the precompiled assets by running rake assets:clobber, I find that it's easier to let Heroku do the precompile during heavy development as I find it's too easy to forget to precompile and add to git before pushing to Heroku...
Hope this helps.
You need to precompile your assets by running:
heroku run bundle exec rake assets:precompile

Rails production - all pictures are broken after new deploy

I followed the Ryan's screencast and deployed to VPS. So i use Unicorn + nginx + github + Ubuntu 12.04 LTS + capistrano. Also i use i18n to translate application.
I also would like to notice that i use Carriarewave for picture uploading. Carriarewave keeps pictures on VPS locally. When i upload images it works great and uploaded pictures appear.
But each time when i deploy new changes to the server then ALL my pictures become broken. It's really awfull. I tried manually to restart nginx:
sudo service nginx restart
And i tried to restart Unicorn:
/etc/init.d/unicorn_Chirch_app restart
It doesn't help too.
When i try to open my broken page manually it says:
The page you were looking for doesn't exist.
You may have mistyped the address or the page may have moved.
When i try to find pictures in console:
> Photo.all
> => [#<Photo id: 3, description: nil, created_at: "2013-01-21 11:14:01", updated_at: "2013-01-21 11:14:01", image: "1320700703588.jpg">, #<Photo id: 4, description: nil, created_at: "2013-01-21 11:14:01", updated_at: "2013-01-21 11:14:01", image: "Seasonscape_by_alexiuss.jpg">, #<Photo id: 5, description: nil, created_at: "2013-01-21 11:30:30", updated_at: "2013-01-21 11:30:30", image: "Seasonscape_by_alexiuss.jpg">]
As i understand they should exist.
Error from logs:
Started GET "/ru/uploads%2Fphoto%2Fimage%2F4%2FSeasonscape_by_alexiuss" for 89.178.205.47 at 2013-01-21 11:31:17 +0000
ActionController::RoutingError (No route matches [GET] "/ru/uploads%2Fphoto%2Fimage%2F4%2FSeasonscape_by_alexiuss"):
actionpack (3.2.8) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.8) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.8) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.4) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.4) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.8) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.4) lib/rack/lock.rb:15:in `call'
rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
railties (3.2.8) lib/rails/engine.rb:479:in `call'
railties (3.2.8) lib/rails/application.rb:223:in `call'
railties (3.2.8) lib/rails/railtie/configurable.rb:30:in `method_missing'
unicorn (4.5.0) lib/unicorn/http_server.rb:552:in `process_client'
unicorn (4.5.0) lib/unicorn/http_server.rb:628:in `worker_loop'
unicorn (4.5.0) lib/unicorn/http_server.rb:500:in `spawn_missing_workers'
unicorn (4.5.0) lib/unicorn/http_server.rb:511:in `maintain_worker_count'
unicorn (4.5.0) lib/unicorn/http_server.rb:277:in `join'
unicorn (4.5.0) bin/unicorn:121:in `<top (required)>'
/home/deployer/apps/My_app/shared/bundle/ruby/1.9.1/bin/unicorn:23:in `load'
/home/deployer/apps/My_app/shared/bundle/ruby/1.9.1/bin/unicorn:23:in `<main>'
My config/deploy.rb
require "bundler/capistrano"
server "my_ip_here", :web, :app, :db, primary: true
set :application, "My_app"
set :user, "deployer"
set :deploy_to, "/home/#{user}/apps/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false
set :scm, "git"
set :repository, "git#github.com:MyName/#{application}.git"
set :branch, "master"
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
after "deploy", "deploy:cleanup" # keep only the last 5 releases
namespace :deploy do
%w[start stop restart].each do |command|
desc "#{command} unicorn server"
task command, roles: :app, except: {no_release: true} do
run "/etc/init.d/unicorn_#{application} #{command}"
end
end
task :setup_config, roles: :app do
sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}"
sudo "ln -nfs #{current_path}/config/unicorn_init.sh /etc/init.d/unicorn_#{application}"
run "mkdir -p #{shared_path}/config"
put File.read("config/database.example.yml"), "#{shared_path}/config/database.yml"
puts "Now edit the config files in #{shared_path}."
end
after "deploy:setup", "deploy:setup_config"
task :symlink_config, roles: :app do
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
end
after "deploy:finalize_update", "deploy:symlink_config"
desc "Make sure local git is in sync with remote."
task :check_revision, roles: :web do
unless `git rev-parse HEAD` == `git rev-parse origin/master`
puts "WARNING: HEAD is not the same as origin/master"
puts "Run `git push` to sync changes."
exit
end
end
before "deploy", "deploy:check_revision"
end
Ok, I found the solution. The problem appeared because I didn't change the default folder to keep images. You can find your default folder in public/uploads. That means that each cap deploy will create a new empty folder which doesn't contain your older files.
To fix this you should create another folder which doesn't live in your application. I choose the easiest way. I created symlinlk.
My steps:
1) On your server go to your app's shared folder (it generated automatically via capistrano). And then create your folder to keep new images:
$ mkdir uploads
2) Give necessary rights for a created folder:
$ sudo chmod 775 uploads
3) On your local machine in config/deploy.rb add:
task :symlink_config, roles: :app do
...
run "ln -nfs #{shared_path}/uploads #{release_path}/public/uploads"
end
4) Then push git and deploy:
$ git push
$ cap deploy:symlink
$ cap deploy
Now everything works fine.
Good one! I've extended your capistrano recipe.
# config/recipes/carrierwave.rb
namespace :carrierwave do
task :uploads_folder do
run "mkdir -p #{shared_path}/uploads"
run "#{sudo} chmod 775 #{shared_path}/uploads"
end
after 'deploy:setup', 'carrierwave:uploads_folder'
task :symlink do
run "ln -nfs #{shared_path}/uploads #{release_path}/public/uploads"
end
after 'deploy', 'carrierwave:symlink'
end
#ExiRe & #Charlie answer works on Capistrano 2.x. In Capistrano 3.x, command run replaced with command execute.
So, I solved this with the following steps:
Create a rake file in the directory lib/capistrano/tasks/carrierwave.rake with the content:
namespace :carrierwave do
task :uploads_folder do
on roles(:app) do
execute "mkdir -p #{shared_path}/uploads"
execute "#{sudo} chmod 775 #{shared_path}/uploads"
end
end
task :symlink do
on roles(:app) do
execute "ln -nfs #{shared_path}/uploads #{release_path}/public/uploads"
end
end
end
Add the following line at the end of your Capfile if it's doesn't have it.
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
Add these tasks in config/deploy.rb with other tasks.
after 'deploy:publishing', 'carrierwave:uploads_folder'
after 'deploy:publishing', 'carrierwave:symlink'
namespace :deploy do
..
after 'deploy:publishing', 'carrierwave:uploads_folder'
after 'deploy:publishing', 'carrierwave:symlink'
..
end
Push git and deploy
Now your uploaded image will remain saved in shared/uploads folder after even new deploy.

Resources