D
D
dexdev2013-12-27 22:27:58
Ruby on Rails
dexdev, 2013-12-27 22:27:58

How to configure the mina gem correctly?

Hello smart person!
The third day I can’t raise the site on VPS, I’m pretty fed up with using ROR, and a good impression from ROR has already disappeared somewhere, but this is everyone’s business ...
And so I couldn’t figure it out with capistrano ... plus there are a lot of deploy.rb letters, who can use mina?

equire 'mina/bundler'
require 'mina/rails'
require 'mina/git'
# require 'mina/rbenv'  # for rbenv support. (http://rbenv.org)
 require 'mina/rvm'    # for rvm support. (http://rvm.io)

# Basic settings:
#   domain       - The hostname to SSH to.
#   deploy_to    - Path to deploy into.
#   repository   - Git repo to clone from. (needed by mina/git)
#   branch       - Branch name to deploy. (needed by mina/git)

set :domain, 'www.#######.kz'
set :deploy_to, '/var/www/######.kz'
set :repository, 'git://...' #вот объясните мне откуда взять путь чтобы вставить и на деплой уходило из гита а не с гитхаба?
set :branch, 'master'

# Manually create these paths in shared/ (eg: shared/config/database.yml) in your server.
# They will be linked in the 'deploy:link_shared_paths' step.
set :shared_paths, ['config/database.yml', 'log']

# Optional settings:
#   set :user, 'foobar'    # Username in the server to SSH to.
#   set :port, '30000'     # SSH port number.

# This task is the environment that is loaded for most commands, such as
# `mina deploy` or `mina rake`.
task :environment do
  # If you're using rbenv, use this to load the rbenv environment.
  # Be sure to commit your .rbenv-version to your repository.
  # invoke :'rbenv:load'

  # For those using RVM, use this to load an RVM version@gemset.
   invoke :'rvm:use'
end

# Put any custom mkdir's in here for when `mina setup` is ran.
# For Rails apps, we'll make some of the shared paths that are shared between
# all releases.
task :setup => :environment do
  queue! %[mkdir -p "#{deploy_to}/shared/log"]
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/log"]

  queue! %[mkdir -p "#{deploy_to}/shared/config"]
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/config"]

  queue! %[touch "#{deploy_to}/shared/config/database.yml"]
  queue  %[echo "-----> Be sure to edit 'shared/config/database.yml'."]
end

desc "Deploys the current version to the server."
task :deploy => :environment do
  deploy do
    # Put things that will set up an empty directory into a fully set-up
    # instance of your project.
    invoke :'git:clone'
    invoke :'deploy:link_shared_paths'
    invoke :'bundle:install'
    invoke :'rails:db_migrate'
    invoke :'rails:assets_precompile'

    to :launch do
      queue "touch #{deploy_to}/tmp/restart.txt"
    end
  end
end

And why is unicorn needed and how to set it up?
I ask for advice for help, there is already a desire to quit nafig everything and go to get drunk in a pig !!!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alexesDev, 2013-12-27
@alexesDev

Grab a ready-made solution for nginx unicorn (god optional). The code is easy to copy into the project.
https://github.com/alfuken/mina-rails-unicorn-nginx-god
Only lib/mina/servers/production.rb needs to be configured here. It creates nginx, god configs, sets up the folder structure... in general, a cool thing. On the server, you only need to install the base, nginx, rvm, git in advance.
> why unicorn is needed
This is a high performance server, webrick is used by default in rails... it's not good for production.
> now explain to me where to get the path to insert and deploy from the git and not from the github?
You need a private git repository, you can, for example, use bitbacket (free).
The code is pushed first, then mina on the server pulls the changes and updates the application.
> lost a good impression of ROR
ROR has nothing to do with it. There are a lot of server configurations, there are a lot of settings, so you can’t immediately give a ready-made solution. Therefore, you need to clearly understand how it all works. After all, it's a one-time setup and saves a lot of time.
You can also host on heroku.com in order not to worry about setting up a VPS ... there is practically nothing to configure there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question