PageRenderTime 231ms CodeModel.GetById 24ms RepoModel.GetById 2ms app.codeStats 14ms

/config/deploy.rb

https://bitbucket.org/elena_palutova/medgorod_rails
Ruby | 105 lines | 48 code | 14 blank | 43 comment | 1 complexity | 95dd8ff23cc33f704d9648764768dbe8 MD5 | raw file
  1. require 'mina/bundler'
  2. require 'mina/rails'
  3. require 'mina/git'
  4. # require 'mina/whenever'
  5. # require 'mina/rbenv' # for rbenv support. (https://rbenv.org)
  6. # require 'mina/rvm' # for rvm support. (https://rvm.io)
  7. # Basic settings:
  8. # domain - The hostname to SSH to.
  9. # deploy_to - Path to deploy into.
  10. # repository - Git repo to clone from. (needed by mina/git)
  11. # branch - Branch name to deploy. (needed by mina/git)
  12. set :application_name, 'medgorodror'
  13. # set :domain, 'medgorod-ror.proektmarketing.ru' # mayak.dymio.net
  14. set :domain, 's2e24debb.server'
  15. set :user, 'medgorodror'
  16. set :deploy_to, '/home/medgorodror/www/medgorod_ror'
  17. set :repository, 'git@bitbucket.org:elena_palutova/medgorod_rails.git'
  18. set :branch, 'master'
  19. set :rails_env, 'production'
  20. # set :whenever_name, 'medgorodror' # default: "#{domain}_#{rails_env}"
  21. # Optional settings:
  22. # set :user, 'foobar' # Username in the server to SSH to.
  23. # set :port, '30000' # SSH port number.
  24. # set :rails_env, 'staging' # Rails environment
  25. set :forward_agent, true # SSH forward_agent.
  26. # probably you will need to add RSA key of repository server manually once before deploy
  27. # just enter your server with `ssh user@server -A` and clone your repo to any folder
  28. # shared dirs and files will be symlinked into the app-folder by the 'deploy:link_shared_paths' step.
  29. set :shared_dirs, fetch(:shared_dirs, []).push('public/uploads',
  30. 'public/content')
  31. set :shared_files, fetch(:shared_files, []).push('config/database.yml',
  32. 'config/application.yml')
  33. # Production environment deploy: 'mina production deploy'
  34. # task :production do
  35. # set :domain, 'demo.mayak.io'
  36. # set :deploy_to, '/var/www/mayak_demo'
  37. # end
  38. # This task is the environment that is loaded for all remote run commands, such as
  39. # `mina deploy` or `mina rake`.
  40. task :environment do
  41. # If you're using rbenv, use this to load the rbenv environment.
  42. # Be sure to commit your .ruby-version or .rbenv-version to your repository.
  43. # invoke :'rbenv:load'
  44. # For those using RVM, use this to load an RVM version@gemset.
  45. # invoke :'rvm:use', 'ruby-2.2.3@default'
  46. end
  47. # Put any custom commands you need to run at setup
  48. # All paths in `shared_dirs` and `shared_paths` will be created on their own.
  49. task :setup do
  50. # command %{rbenv install 2.3.0}
  51. comment "Don't forget to create shared/config/database.yml file"
  52. comment "Don't forget to create shared/config/application.yml file"
  53. end
  54. desc "Deploys the current version to the server."
  55. task :deploy do
  56. # uncomment this line to make sure you pushed your local branch to the remote origin
  57. # invoke :'git:ensure_pushed'
  58. deploy do
  59. # Put things that will set up an empty directory into a fully set-up
  60. # instance of your project.
  61. invoke :'git:clone'
  62. invoke :'deploy:link_shared_paths'
  63. invoke :'bundle:install'
  64. invoke :'rails:db_migrate'
  65. invoke :'rails:assets_precompile'
  66. invoke :'deploy:cleanup'
  67. on :launch do
  68. in_path(fetch(:current_path)) do
  69. command %{mkdir -p tmp/}
  70. command %{touch tmp/restart.txt}
  71. end
  72. # invoke :'whenever:update'
  73. # invoke :rake, 'sitemap:refresh:no_ping'
  74. end
  75. end
  76. # you can use `run :local` to run tasks on local machine before of after the deploy scripts
  77. # run(:local){ say 'done' }
  78. end
  79. namespace :rails do
  80. desc "Seed database"
  81. task :db_seed do
  82. comment "Seed database for #{fetch(:domain)}_#{fetch(:rails_env)}"
  83. in_path(fetch(:current_path)) do
  84. command %{#{fetch(:rake)} db:seed}
  85. end
  86. comment 'Seeding is done.'
  87. end
  88. end
  89. # For help in making your deploy script, see the Mina documentation:
  90. #
  91. # - https://github.com/mina-deploy/mina/tree/master/docs