Artem Kiryanov

Joined

240 Experience
0 Lessons Completed
0 Questions Solved

Activity

Posted in Deploy and delete text!

Help! When i deploy my app from local machine to vps, my local image, text and another information have been deleted! How can i fix it?

Posted in Authorization With CanCanCan Discussion

I have error: When i open Rails C and write this: ActiveRecord::UnknownAttributeError: unknown attribute: role

Posted in Deploy Rails

Chris! I fixed my problem! How?

First! Open /etc/nginx/sites-enabled/default and comment location directory
It is my settings

server {
        listen 80;
        server_name www.artkiryanov.ru artkiryanov.ru
        rails_env production;
        passenger_use_global_queue on;
        root /home/deploy/lifeblog/current/public;
        passenger_enabled on;

#       # Make site accessible from http://localhost
#       error_page 500 502 503 504 /50x.html;
#       location = / {
#           passenger_enabled on;
#
#       }
}

And Restart nginx! Nice! Work!

Posted in Deploy Rails

Okey, Chris! But, I can't fix this problem. When i open my site, i see 403 error . Why?
My nginx.log

2014/12/02 02:18:30 [error] 6712#0: *24 directory index of "/home/deploy/lifeblog/current/public/" is forbidden, client: 66.249.69.153, server: www.artkiryanov.ru, request: "GET / HTTP/1.1", host: "artkiryanov.ru"
2014/12/02 02:50:39 [error] 6712#0: *25 directory index of "/home/deploy/lifeblog/current/public/" is forbidden, client: 93.125.59.125, server: www.artkiryanov.ru, request: "GET / HTTP/1.1", host: "artkiryanov.ru"

And My /etc/nginx/sites-enabled/default

server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        server_name www.artkiryanov.ru  artkiryanov.ru
        passenger_enabled on;
        rails_env production;
        root /home/deploy/lifeblog/current/public;


        # Make site accessible from http://localhost
#       error_page 500 502 503 504 /50x.html;
#       location = /50x.html {
#               root html;
#       }
}

How can I solve the problem ?

Posted in Deploy Rails

Okey. I fixed this problem. How can i fixed ?
First ! Open ssh server and put command: which ruby and copy this.

  1. Open rails_app on my local machine and open deploy.rb , and paste line from terminal
set :default_env, {
    :PATH => '/home/deployer/.rvm/gems/ruby-2.0.0-p353/bin:/home/deployer/.rvm/gems/ruby-2.0.0-p353@global/bin:/home/deployer/.rvm/rubies/ruby-2.0.0-p353/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/deployer/.rvm/bin'
}

And git add and commit , then cap production deploy

Posted in Deploy Rails

Okey , Thank you! I fixed that lost error, i reinstall capistrano and droplet, but when i cap production deploy, i have error:

cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host 104.236.45.52: bundle exit status: 16
bundle stdout: Nothing written
bundle stderr: Nothing written
/home/rails/.rvm/gems/ruby-2.1.3/gems/sshkit-1.5.1/lib/sshkit/command.rb:97:in `exit_status='
/home/rails/.rvm/gems/ruby-2.1.3/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:148:in `block (5 levels) in _execute'
/home/rails/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `call'
/home/rails/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `do_request'
/home/rails/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:561:in `channel_request'
/home/rails/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/home/rails/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:221:in `preprocess'
/home/rails/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process'
/home/rails/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop'
/home/rails/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/home/rails/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/home/rails/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:269:in `wait'
/home/rails/.rvm/gems/ruby-2.1.3/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:170:in `block (3 levels) in _execute'
/home/rails/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:514:in `call'
/home/rails/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation'
/home/rails/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation'
/home/rails/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/home/rails/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:221:in `preprocess'
/home/rails/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process'
/home/rails/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop'
/home/rails/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/home/rails/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/home/rails/.rvm/gems/ruby-2.1.3/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:172:in `block (2 levels) in _execute'
/home/rails/.rvm/gems/ruby-2.1.3/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:186:in `with_ssh'
/home/rails/.rvm/gems/ruby-2.1.3/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:131:in `block in _execute'
/home/rails/.rvm/gems/ruby-2.1.3/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `tap'
/home/rails/.rvm/gems/ruby-2.1.3/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `_execute'
/home/rails/.rvm/gems/ruby-2.1.3/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:66:in `execute'
/home/rails/.rvm/gems/ruby-2.1.3/gems/capistrano-bundler-1.1.3/lib/capistrano/tasks/bundler.cap:35:in `block (5 levels) in '
/home/rails/.rvm/gems/ruby-2.1.3/gems/sshkit-1.5.1/lib/sshkit/backends/abstract.rb:85:in `with'
/home/rails/.rvm/gems/ruby-2.1.3/gems/capistrano-bundler-1.1.3/lib/capistrano/tasks/bundler.cap:26:in `block (4 levels) in '
/home/rails/.rvm/gems/ruby-2.1.3/gems/sshkit-1.5.1/lib/sshkit/backends/abstract.rb:77:in `within'
/home/rails/.rvm/gems/ruby-2.1.3/gems/capistrano-bundler-1.1.3/lib/capistrano/tasks/bundler.cap:25:in `block (3 levels) in '
/home/rails/.rvm/gems/ruby-2.1.3/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/home/rails/.rvm/gems/ruby-2.1.3/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `run'
/home/rails/.rvm/gems/ruby-2.1.3/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
SSHKit::Command::Failed: bundle exit status: 16
bundle stdout: Nothing written
bundle stderr: Nothing written

Posted in Deploy Rails

Okey, i fixed this problem, but i have new error:

The deploy has failed with an error: Exception while executing on host 104.236.45.52: rake exit status: 1
rake stdout: Nothing written
rake stderr: syck has been removed, psych is used instead
PG::ConnectionBad: could not connect to server: Connection refused
    Is the server running on host "104.236.45.52" and accepting
    TCP/IP connections on port 5432?

Posted in Deploy Rails

My Gemfile:

group :production do
  gem 'pg'
   gem 'capistrano', '~> 3.3.0'
   gem 'capistrano-bundler', '~> 1.1.2'
   gem 'capistrano-rails', '~> 1.1'
   gem 'capistrano-rvm'
   gem 'sshkit'
end
My Capfile:
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/bundler'
require 'capistrano/rails'


  require 'capistrano/rvm'
  set :rvm_type, :user
  set :rvm_ruby_version, '2.1.3-p242'


# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

My config/deploy.rb

set :default_env, {
 :PATH => '/home/deploy/.rvm/gems/ruby-2.1.3-p242/bin:/home/deploy/.rvm/gems/ruby-2.1.3-p242@global/bin:/home/deploy/.rvm/rubies/ruby-2.1.3-p242/bin:/home/deploy/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games'
} 
set :application, 'lifeblog'
set :repo_url, 'git@github.com:hacker342/lifeblog.git'
  set :deploy_to, '/home/deploy/lifeblog'
 set :linked_files, %w{config/database.yml}
 set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}

namespace :deploy do

  desc 'Restart application'
  task :restart do
    on roles(:app), in: :sequence, wait: 5 do
      # Your restart mechanism here, for example:
       execute :touch, release_path.join('tmp/restart.txt')
    end
  end

  after :publishing,'deploy:restart'
  after :finishing, 'deploy:cleanup'

end

My config/deploy/production.rb

role :app, %w{deploy@104.236.45.52}
role :web, %w{deploy@104.236.45.52}
role :db,  %w{deploy@104.236.45.52}


# Extended Server Syntax
# ======================
# This can be used to drop a more detailed server definition into the
# server list. The second argument is a, or duck-types, Hash and is
# used to set extended properties on the server.

set :stage, :production

server '104.236.45.52', user: 'deploy', roles: %w{web app} 

I fixed my 1 and 2 problem, but, when i put cap production deploy, i have error:

(Backtrace restricted to imported tasks)
cap aborted!
Don't know how to build task 'deploy:setup'

Posted in Deploy Rails

Hi . Can you help me ? When i start : cap deploy production, i have errors:

  1. rake stdout: Nothing written
  2. rake stderr: syck has been removed, psych is used instead

How can i resolve them?

Posted in Texteditor

Hello! Can yoy help me? I have Ruby 2.1.3 and Rails 4.1.7. I use gem ( https://github.com/spohlenz/tinymce-rails ) and I do everything as it says, but i when paste this code:

<%= tinymce %>
in my _form, i have error:

Psych::SyntaxError in Posts#new
(): mapping values are not allowed in this context at line 8 column 20.

How can I fix this problem?

Posted in Deploy Ubuntu 14.04 Trusty Tahr Discussion

When i start cap production deploy, i have errors:

cap aborted!

SSHKit::Runner::ExecuteError: Exception while executing on host 104.131.87.26: ln exit status: 1

ln stdout: Nothing written

ln stderr: Nothing written

Posted in Forum Series Part 1: Architecture Discussion

Great!!!!