Skip to content

Conversation

@bshand
Copy link
Contributor

@bshand bshand commented Dec 28, 2024

This PR moves most of the app:update_secrets task currently in era/config/deploy.rb to ndr_dev_support:deploy_secrets, so all projects using ndr_dev_support get the same functionality.

It deploys secrets files added using the add_secrets_repo and add_secrets methods to the shared deployment directory.

For usage, run $ cap -e ndr_dev_support:deploy_secrets:

------------------------------------------------------------
cap ndr_dev_support:deploy_secrets
------------------------------------------------------------
Deploy updated application secrets to shared folders on application servers

To use this in a project, add something like the code below to your
Capistrano file config/deploy.rb, then run:
$ cap target app:update_secrets

namespace :app do
  desc 'Update application secrets'
  task :update_secrets do
    add_secrets_repo(name: 'userlists',
                     url: 'https://github.com/example/users.git',
                     branch: 'main',
                     scm: 'git')
    add_secrets_repo(name: 'encrypted_credentials_store',
                     url: 'https://svn-server.example.org/svn/creds', scm: 'svn')

    add_secret(repo: 'encrypted_credentials_store',
               repo_path: 'path/to/credentials.yml.enc',
               shared_dest: 'config/credentials.yml.enc')
    add_secret(repo: 'userlists',
               repo_path: 'config/userlist.yml',
               shared_dest: 'config/userlist.yml')
  end
end
after 'app:update_secrets', 'ndr_dev_support:deploy_secrets'

Copy link
Contributor

@kenny-lee-1 kenny-lee-1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks neat to me

@bshand bshand merged commit f15b2f9 into main Jan 2, 2025
20 checks passed
@bshand bshand deleted the update_secrets branch January 2, 2025 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants