This repository was archived by the owner on Jul 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finalize Capistrano setup for ITS deployment
Resolves #1074 - finalize deploy script setup - finalize custom tasks for deployment - move custom tasks to lib/capistrano/tasks directory - update dotenv to 2.0.2; remove dotenv-deployment (deprecated) - other tweaks / fixes
- Loading branch information
Showing
7 changed files
with
92 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
require 'capistrano' | ||
|
||
# configuration tasks | ||
namespace :config do | ||
desc 'Create .env' | ||
task :env do | ||
on roles(:app) do | ||
# copy Jenkins/parameter file to .env if it exists | ||
if test "[ -e #{fetch(:param_file)} ]" | ||
execute "cp -rf #{fetch(:param_file)} #{release_path}/.env" | ||
else | ||
fail Capistrano::Error, 'You must specify a valid parameter file.' | ||
end | ||
end | ||
end | ||
|
||
desc 'Create database.yml' | ||
task :db do | ||
on roles(:app) do | ||
execute "cp #{release_path}/config/database.yml.example.production "\ | ||
"#{release_path}/config/database.yml" | ||
end | ||
end | ||
|
||
desc 'Copy secrets.yml' | ||
task :secrets do | ||
on roles(:app) do | ||
execute "cp #{release_path}/config/secrets.yml.example "\ | ||
"#{release_path}/config/secrets.yml" | ||
end | ||
end | ||
|
||
desc 'Create party_foul initializer' | ||
task :party_foul do | ||
on roles(:app) do | ||
# check for Party Foul parameter in .env file | ||
env_lines = File.foreach("#{release_path}/.env") | ||
if env_lines.grep(/PARTY_FOUL_TOKEN/).length > 0 | ||
# copy initializer | ||
execute "cp -rf #{release_path}/config/initializers/party_foul.rb"\ | ||
".example #{release_path}/config/initializers/party_foul.rb" | ||
end | ||
end | ||
end | ||
end |