mina-deploy / mina

Blazing fast deployer and server automation tool
https://rubygems.org/gems/mina
Other
4.35k stars 490 forks source link

Managing environment variables file application.yml #497

Closed wonderer007 closed 7 years ago

wonderer007 commented 7 years ago

Is there a better to way to manage your environment variable while continuous deployment using mina? Currently as suggested I have my application.yml in /shared/config whenever I update my env file in location I have to manually paste those changes in production because I have ignore application.yml in .gitignore. I am looking for a solution something sending the application.yml file to the server over same ssh connection mina has established or using scp along side ssh.

Thanks in advance.

lnikell commented 7 years ago

@wonderer007 if you are using rvm I guess .versions.conf file fit for your purposes. you can create .versions.conf file with all necessary env variables and have different versions of that file on local and remote machine.

ahbou commented 7 years ago

Since v1.0 broke the scp plugin, here's my workaround if anyone else is struggling with this. say you have: set :shared_files, ['config/database.yml', 'config/application.yml']

and right before deploy do run

run(:local){ 
    desc 'upload shared files' 
    fetch(:shared_files, []).each do |linked_dir|
      command "scp #{linked_dir} #{fetch(:user)}@#{fetch(:domain)}:#{fetch(:shared_path)}/#{linked_dir}"
    end
  }
d4be4st commented 7 years ago

as @ahbou wrote, use run(:local) to send your config/application.yml to a shared path

will update docs with this situation