Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

zauberware-devops

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zauberware-devops

  • 0.0.8
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

zauberware-devops

Library of useful scripts for DevOps using capistrano with rails.

Only supports Capistrano 3 and above.

Requirements

'capistrano', '~> 3.0'
'whenever'

Installation

Add the gem to your Gemfile after setting up Capistrano group:

group :development do
  gem 'capistrano', require: false
end

gem 'zauberware-devops'

Then bundle and add it to your Capfile

# Capfile

require 'zauberware/devops/capistrano'

and initializers

# initializers/zauberware_devops.rb
require 'zauberware/devops'

Script overview

ScriptDescription
cap <environment> backup:createcreates backup of postgres database on the server
cap <environment> backup:pulldownload latest postgres backup from server
cap <environment> figaro_yml:comparecompare local application.yml with server application.yml
cap <environment> figaro_yml:getshows env vars from server application.yml configured thru figaro
cap <environment> logs:railsdisplay server log live
cap <environment> whenever:show_crontabdisplay server app crontab generated with whenever
cap <environment> invoke:rake TASK=<your:task>invoke rake task on server
rake pg:dumpcreates postgres database backup
rake pg:remove_old_dumpsremove old postgres backups

Usage

for all backup task you have to setup your database.yml properly:

production:

  database: database_name
  username: database_username
  password: database_password
  host: database_host
  port: database_port

Optional Settings for backup task

envdescription
NUMBER_OF_BACKUPSnumber of backups to keep
BACKUPS_ENABLEDenable/disable backup task
DEFAULT_URLfor slack integration message title
SLACK_SECRETfor slack integration
SLACK_CHANNELfor slack integration

use with whenever/capistrano

install whenever gem and add this to your schedule.rb

# config/schedule.rb
# Use this file to easily define all of your cron jobs.
env :PATH, ENV['PATH']
set :output, -> { '2>&1 | logger -t whenever_cron' }

every :day, at: '2:00 am' do
  rake 'pg:dump'
end

every :day, at: '3:00 am' do
  rake 'pg:remove_old_dumps'
end

add this to your capfile

# Capfile
require 'whenever/capistrano'

Configuration

You can optionally specify the capistrano roles for the rake task (Defaults to :app):

# Defaults to [:app]
set :rake_roles, %i[db app]

Contributing

  1. Fork it ( https://github.com/zauberware/zauberware-devops/fork )
  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 a new Pull Request

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 16 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc