jefmathiot / electric_sheep

A simple network backup system
http://electricsheep.io
MIT License
19 stars 5 forks source link

Several Sheepfile #7

Closed tboulogne closed 9 years ago

tboulogne commented 9 years ago

Hello,

Thanks for this great tool. A question. In documentation, i read we could have as many Sheepfile we want. What is then the good notation to have all the Sheepfile working with electric_sheep start command ?

Thanks for help.

Regards

jefmathiot commented 9 years ago

Thanks for kind words :). Actually, it seems like the documentation is misleading (you still have to select a Sheepfile using the -c flag.

This feature is in our todo list, though. What we planned to include in the software is the ability to reference file from a main Sheepfile:

# Sheepfile
include "/path/to/other/sheepfiles/*"

Do you think it could do the job for you?

If you need it, I'd be glad to place the item at the top of our feature list.

tboulogne commented 9 years ago

Hello,

Thanks for your reply. I think it could do trick for now :-). In the mean time, i plan to code a GUI in ROR to generate the Sheepfile. So this feature will be less interesting after. But before i'd like to know if you plan following :

For exemple how could i run a task each 6 hours ?

  • Override directory name of job:

For now the job name become the directory. So if i want to save a db backup and a file backup for an host X in the same directory X, i need to put 2 jobs with the same name. (not good for logs)

Thanks for your answer :-).

Thierry (PS: i'm french :-) )

jefmathiot commented 9 years ago

Yes, we plan on adding some options to control retention. ES.IO API is quite young and, as this feature implies to add some sort of database in the game, we wanted to stabilize the core before adding it. Definitely a must-have, though.

There are two available ways of scheduling jobs. Use an external scheduler, such as Cron, or use the built-in scheduler http://www.electricsheep.io/v0.5.0/docs/schedule-your-backups

The built-in scheduler is less powerful, but simpler than Cron. As the whole purpose of ES.IO is to lower the barrier to entry, I think we'll try to keep it simple. So if you have ideas to get a more powerful scheduler without make it difficult to use, I'd be glad to hear them :)

Yes, be able to control resources/directoris naming is also something we thought about. Would you mind creating another issue ?

Thanks for this great feedback!

tboulogne commented 9 years ago

I open another issue for overriding job name and directory.

Regarding scheduler yes it's powerfull and simple :-). I need a way to schedule each 6 hours.

Looking your code i see in electric_sheep/metadata/schedule.rb

 class Hourly < Base
        option :past

        def update!
          @scheduled_at=Time.now.at_beginning_of_hour.in(1.hour)

If replacing this 1 by an option with a default to 1, we could get a more flexible hourly schedule.

 class Hourly < Base
        option :past, :multiple

        def update!
         if option(:multiple)
            multiple = option(:multiple).to_i
         else
            multiple = 1
         end        

         @scheduled_at=Time.now.at_beginning_of_hour.in(multiple.hour)

What do you think about that ?

jefmathiot commented 9 years ago

@tboulogne thanks for your feedback (and sorry for the late answer). We always try to start with the DSL, as it's the users entry point.

I've had a discussion with other developers, and we've come to two solutions we'll both implement.

First, add the ability to add multiple schedules and mix multiple schedule types for the same job, so that one may:

job "I-love-my-job" do
  schedule "daily", at: "01:00"
  schedule "daily", at: "07:00"
  schedule "weekly", on: "monday", at: "01:30"
end

Second, we'll add support for Cron syntax to help people coming from Cron schedules to make the migration seamlessly:

job "I-love-my-job" do
  schedule "cron", expression:  "0 1,7,13,20 * * *"
end

Do you think it'd cover your needs & stay simple to use ?

jefmathiot commented 9 years ago

Created #10 and #11.

jefmathiot commented 9 years ago

Documentation here http://www.electricsheep.io/v0.5.0/docs/organize-your-sheepfiles

jefmathiot commented 9 years ago

Closing, thanks @bseverac for reviewing