Giter Site home page Giter Site logo

backup-cookbook's People

Contributors

brauliobo avatar guilhem avatar ianneub avatar joraff avatar kliuchnikau avatar skanev avatar smith avatar tucksaun avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

backup-cookbook's Issues

Template errors in providers/model.rb

I got errors from the template resource in model.rb. The first was that it complained that there was no model_path method. I fixed this by changing

path model_path

to
path ::File.join(node['backup']['model_path'], "#{new_resource.name}.rb")

This is basically copying the body of that private method into the template block.

Next I got the error that model was not a method of template. This was due to source being unquoted. I changed:
source model.erb
to:
source 'model.erb'

I have changed these in my fork (agworld user) - if this is not just user error on my behalf in some way, I am happy to make a pull request.

data path not setable

Right now, there's no way to set the data path for the backbook cookbook, so it ends up using a folder it creates in the user's home dir as the data folder... which is not always desirable when using the Cycler options.

I think the optimum way to do this is to make it an extra param in the backup_model. You could also just set it globally by tweaking the config.rb file.

It's not yet important for me, but I can make a PR for it if you want.

Set default PATH for cron or full path to backup executable?

Currently, the default command ran by the cron is root backup perform --trigger my_backup --config-file /etc/backup/config.rb --log-path=/var/log > /dev/nu$

Thing is, this fail miserably because the PATH in a cron is not the same as the PATH in our shell, and the backup command is not found.

I see two solutions here:

  • Use the full backup path, i.e /usr/local/bin/backup
  • Add a default PATH in the crond resource, i.e :path => '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin'

My current solution is to set the path in the cron_options parameters, i.e

  cron_options({
    :path => '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin',
    :mailto => '[email protected]'
  })

But this is not really straightforward, since without this, the backup-cookbook cron simply does not work :)

Thoughts?

Cron job not working with RVM

The default cron job generated by the cookbook does not work with RVM.

If I change the command to be run inside a bash process then everything is ok (rvm will be loaded).

So I had the following in my cron:

0 * * * * backup perform --trigger my_db --config-file /etc/backup/config.rb --log-path=/var/log

and changed it to:

0 * * * * /bin/bash -l -c 'backup perform --trigger my_db --config-file /etc/backup/config.rb --log-path=/var/log'

How to get cron jobs to run?

Hey there,

I apologize for writing here but I can't seem to figure out how to get the cron jobs for the backup recipe to run. I can see the model actually writing the file into /etc/cron.d/... but for some reason it does not actually run the cron job at the designated time. I'm using Ubuntu LTS 14.04.

My recipe looks like this:

# Backup
include_recipe 'backup'

backup_model :cgchannel do
  description "Back up CG Channel"

  definition <<-DEF
    split_into_chunks_of 4000

    # Removed actual backup lines for posting issue on GitHub... 
    ######

  DEF

  # Daily schedule
  schedule({
    :minute => 0,
    :hour   => 0
  })
end

The resulting file in /etc/cron.d/

-rw-r--r--  1 root root     321 Jun 20  2013 updatedb.conf
# Crontab for cgchannel_backup managed by Chef. Changes will be overwritten.

0 0 * * * root backup perform --trigger cgchannel --config-file /root/Backup/config.rb --log-path=/var/log > /dev/null

So it appears that the cookbook does actually work. But for some reason the system is not actually executing this. Is there anything else I need to do to get Ubuntu to recognize the cron job?

Thanks,

Leo

Bump the backup gem version?

Default version in the attributes is 3.0.25, backup has come a long way since this version, maybe we could bump to the latest?

Readme example error

In the example in the README I needed to change:

definition=<<-DEF

to

definition <<-DEF

The '=' character was causing a "no definition supplied" error.

Cannot set temporary path

The cookbook doesn’t let me set the --tmp-path parameter and every backup gets stored in ~/Backup/ before it gets uploaded. This is an issue if you have a huge backup, but not enough space left on the device where /root/Backup/ resides.

Please add the --tmp-path parameter as an attribute to the cookbook.

No schedule set in the CRON

Hi,

My cron is set, but with no recurring options at the beginning, here is the content of it:

# Crontab for alpha_backup managed by Chef. Changes will be overwritten.
[email protected]
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

 root backup perform --trigger alpha --config-file /etc/backup/config.rb --log-path=/var/log > /dev/null

I have one space at the beginning, no '0 0 * * *' or anything... Here's the content of my model, pretty close to the one in the README:

backup_model node['backup']['app']['model'].to_sym do
  description 'Backup Meteor database (MongoDB)'

  definition <<-DEF
    split_into_chunks_of 4000

    database MongoDB do |db|
      db.name = '#{node['backup']['app']['db']['name']}'
    end

    compress_with Gzip

    store_with S3 do |s3|
      s3.access_key_id = '#{credentials['aws_access_key_id']}'
      s3.secret_access_key = '#{credentials['aws_secret_access_key']}'
      s3.bucket = 'app'
      s3.path = '/backups'
    end
  DEF

  schedule({
    :minute => 0,
    :hour   => 0
  })

  cron_options({
    :path => '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin',
    :mailto => '[email protected]'
  })
end

Any idea what's wrong @smith ? I also tried to set the minute and hour with string, i.e '0', but it didn't work...

Thanks

model_path doesn't update when config_path is modified in wrapper cookbok

The model_path is currently being computed based on the config_path value as seen below:

default['backup']['model_path'] = "#{node['backup']['config_path']}/models"

If you change the config_path attribute to point to something other than the /etc/backup default then the deploy will fail. Reason being, derived attributes aren't updated when the attributes they make use of get updated. In order for the value to be set correctly you either have to manually set the derived attribute in addtion to config_path, or use a role or environment. Since I'm using chef-solo I also have the option of setting config_path directly in the node file, but I'd like to avoid the duplication.

As mentioned in this blog post on derived attributes, an easy fix is to simply change model_path to be a variable that gets computed in the default recipe.

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.