Giter Site home page Giter Site logo

capistrano-env's Introduction

Build Status Dependency Status Coverage Status

Capistrano::Env

Capistrano with Env via file

Installation

Add this line to your application's Gemfile:

gem 'capistrano-env'

And then execute:

$ bundle

Or install it yourself as:

$ gem install capistrano-env

Usage

1. set env names in deploy.rb

in Capfile

require 'capistrano/env'

in deploy.rb

# New
set :capenv, ->(env) {
  env.add /^MYAPP_/
  env.add /^MYAPP_/ do |key|
     key.gsub /^MYAPP_/, '' # replace keyname like MYAPP_DATABASE_URL => DATABASE_URL
  end
  env.add 'UNICORN_PROCESSES'
  env.add 'HOGE', 'hage'
  env.filemode = 0644 #=> default is 0640.
}

2. deploy

bundle exec cap production deploy
  • automaticaly create #{current_path}/.env
  • automaticaly load #{current_path}/.env if you use dotenv-rails
    • you should load manualy in other framework
  • you can use ENV['ENV_NAME'] in application

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

capistrano-env's People

Contributors

masarakki avatar stepozer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

mizor cyakimov

capistrano-env's Issues

First deployment and linking the .env

I am using Capistrano 3 and I am linking the .env file between releases

set :linked_files, fetch(:linked_files, []).push('.env',...)

Then in my deploy files I am using the gem

Capistrano::Env.use do |env|
  env.add ...
  env.formatter = :dotenv
end

This still causes an error on the first deployment, complaining that .env is missing.

ERROR linked file /var/www/myWebsite-test/shared/.env does not exist on

(I want to allow a user to modify the .env file manually, but still synchronize new variables that would be added later during dev)

Cap3 error with deployment

Hey , Im hoping you can help.

I am showing in my cap log

INFO [30efeaf1] Finished in 0.070 seconds with exit status 0 (successful).
DEBUG Uploading /var/www/RAILS_PROJECT/releases/20151202184405/.env 0.0%
INFO Uploading /var/www/RAILS_PROJECT/releases/20151202184405/.env 100.0%

that my .env file is being loaded.... yet, when I ssh into the server, I cant find it.

thoughts?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.