ruby-on-rails – 使用capistrano部署时隐藏mysql2密码的好方法
所以,这是我的capistrano文件
load 'deploy/assets' require "bundler/capistrano" set :application,"XXXXXX" set :repository,"XXXXXX" set :scm,:git # You can set :scm explicitly or Capistrano will make an intelligent guess based on known version control directory names # Or: `accurev`,`bzr`,`cvs`,`darcs`,`git`,`mercurial`,`perforce`,`subversion` or `none` set :repository,"XXXXXX" role :web,"XXXXXX" # Your HTTP server,Apache/etc role :app,"XXXXXX" # This may be the same as your `Web` server role :db,"XXXXXX",:primary => true # This is where Rails migrations will run #role :db,"your slave db-server here" set :user,'root' set :use_sudo,false set :deploy_to,"/var/www/#{application}" set :deploy_via,:remote_cache set :normalize_asset_timestamps,false # if you want to clean up old releases on each deploy uncomment this: # after "deploy:restart","deploy:cleanup" # if you're still using the script/reaper helper you will need # these http://github.com/rails/irs_process_scripts # If you are using Passenger mod_rails uncomment this: namespace :deploy do task :start do ; end task :stop do ; end task :restart,:roles => :app,:except => { :no_release => true } do run "touch #{File.join(current_path,'tmp','restart.txt')}" end end 现在,当我运行cap deploy时,我得到一个错误 Access denied for user 'root'@'localhost' (using password: NO) 我假设那是因为我的database.yml文件是 development: adapter: sqlite3 database: db/development.sqlite3 pool: 5 timeout: 5000 # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: adapter: sqlite3 database: db/test.sqlite3 pool: 5 timeout: 5000 production: adapter: mysql2 encoding: utf8 database: XXXXX username: root password: socket: /tmp/mysql.sock 现在,因为我有一个公共github帐户.我不想传递我的密码并将其发布到github.如果我没有传递密码,我无法部署应用程序. 处理这个问题的好方法是什么? 谢谢 解决方法
我会推荐以下内容:
>将config / database.yml移动到repo中的config / database.yml.sample namespace(:customs) do task :symlink_db,:roles => :app do run <<-CMD ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml CMD end end after "deploy:update_code","customs:symlink_db" (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- CocoStuido 2.x中发布的资源怎样在cocos2dx 3.x中使用
- cocos2dx 物理引擎
- oracle 分页查询语句
- 在发出ajax请求时禁止AJAX 403
- C语言typedef与复杂函数声明问题的深入解析
- ajaxFileUpload 报这错jQuery.handleError is not a functi
- react-native – ReactNative onResponderRelease在Android
- Swift在for循环中报错'++' is not a binary operat
- oracle分析函数
- c# – 如何在ASP.NET MVC Razor中有条件地显示一个字段?