aktos-io / dcs-tools

Tools for making remote Linux node management easy
42 stars 6 forks source link

please specify current directory for execution of commands #13

Closed motioncircus closed 6 years ago

motioncircus commented 6 years ago

Hi,

Another thing I think I may be doing wrong is executing commands from the wrong directory. If it's important that I'm in a certain place, please add that information to the guide

Some more simple examples would be really helpful IE. cd to your backup destination folder then run the command make sync-root

ceremcem commented 6 years ago

Does the "example usage" (https://github.com/aktos-io/dcs-tools#example-usage) help or we need some more clarification? What problems do you encounter when you follow the example-usage section?

motioncircus commented 6 years ago

Hi Cerem,

INSTALL I'm starting to think that I installed the software on the wrong machine! I put it on the Raspberry Pi -- should it be on my local box (ie. for me, my workstation / for you, your laptop) ?

If I'm right, and the tools should be on the local box, instead of the 'target machine' that I want to back up, then it would help if the install instructions included this detail (for complete Dummies like myself).

EXAMPLE USAGE Perhaps clarify that Dummies on windows need to be sure that they have the 'make' command available, which is sometimes missing in linux emulator installs like Git Bash.

#make proxy-connection - It might be good (again for Dummies) to explain the purpose of a proxy connection. I think I'm right in thinking that it routes the connection through a 3rd party server, for added security of some kind but I am not sure.

DAILY USAGE

cd your-project - please make clear whether I'm cding to a local folder, the intended destination for the backup, or whether I'm connected over ssh to the remote machine and cding into a project folder on it.

Make mount-root - I'm really not sure what the purpose of this is, or what a NODE_ROOT is Make umount-root - see above make ssh - I guess this initiates an ssh session with the 'target' machine make sync-root - I'm guessing this makes the back up, or rather synchonises the backup incrementally, after the initial backup has been completed. This is what I really like about your method. I've been using the dd command and making a 32G duplicate of an SD card that's only got about 4G of data on it !

ADVANCED TIPS

If you want to run a remote command, simply pass via ARGS= parameter

make ssh ARGS='uname -a'

I typed 'ssh --help into my Git Bash shell and couldn't see a -a option. Was it just a guessed example, or is it a real option? Also, please could you add a sample usage scenario.

When I study the directory layout structure, from my emerging new perspective. It would seem that for each 'target' machine, which you refer to as 'your project', in the Daily Usage section, I have to install the dcs-tools in a subdirectory.

Up til now I've been thinking of dcs-tools as as a system level install, that only needed installing once for the whole machine.

I have restored my raspberry pi to a previous, clean version, before I installed dcs-tools.

Please advise if I'm right about installing on the local machine and I'll have another go. I'm hesitant to try it before I understand it better. One of the downsides of being a novice is the feeling that you've done something to the config of your machine that you don't know how to undo.

Cheers

Nigel

Nigel Haslam | Director

Motion Circus Pty Ltd. Byron Bay t: + 61 2 8007 7338 |m: + 61 403 020 126 w: www.motioncircus.com http://www.motioncircus.com/ link to website http://motioncircus.com

On Wed, Oct 25, 2017 at 5:55 PM, Cerem Cem ASLAN notifications@github.com wrote:

Does the "example usage" (https://github.com/aktos-io/ dcs-tools#example-usage) help or we need some more clarification? What problems do you encounter when you follow the example-usage section?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/aktos-io/dcs-tools/issues/13#issuecomment-339232945, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQ3E1Wi0Dc-I6D5Yjbu8y8zo5eHPev7ks5svttzgaJpZM4QFfJ2 .

ceremcem commented 6 years ago

Okay, let's make it clear here and then apply to README:

INSTALL I'm starting to think that I installed the software on the wrong machine! I put it on the Raspberry Pi -- should it be on my local box (ie. for me, my workstation / for you, your laptop) ?

Yes, you should install this tool to your laptop (or equivalent).

Perhaps clarify that Dummies on windows need to be sure that they have the 'make' command available, which is sometimes missing in linux emulator installs like Git Bash.

Windows machines are not in our radar right now.

#make proxy-connection - It might be good (again for Dummies) to explain the purpose of a proxy connection. I think I'm right in thinking that it routes the connection through a 3rd party server, for added security of some kind but I am not sure.

Proxy connection is a connection type that hides some details from you between you and your target (Raspberry, in this case).

Normally you have to know target device's IP address in order to be able to connect to it. If your target is another location, you have to make some port forwardings in the target network's modem/firewall. You also have to assign static IP address to your target.

If you setup https://github.com/aktos-io/link-with-server/ on the target, you don't have to assign a static IP, you don't have to make port forwardings and you don't have to know the public IP address of the target network. Instead, it will connect to your server, drop its SSHD port on the server so you may connect to server:target_port and voila! You are on your target's shell.

make proxy-connection is used in this scenario.

cd your-project - please make clear whether I'm cding to a local folder, the intended destination for the backup, or whether I'm connected over ssh to the remote machine and cding into a project folder on it.

Would it be clear if we add a line:

# on your host machine
mkdir your-project
cd your-project
git clone https://github.com/aktos-io/dcs-tools
cd dcs-tools 
git submodule update --init --recursive 
./setup 

Make mount-root - I'm really not sure what the purpose of this is, or what a NODE_ROOT is Make umount-root - see above

make mount-root and make umount-root commands are used for mounting (and properly unmounting) target machine's root folder (/) right onto the NODE_ROOT the project. Since you are on Windows, you are not familiar withmountandumountcommands but it's likenet use` command.

image

So you can browse and edit your target Raspberry's root folder (and drag&drop some files, delete another) just like you powered off the Raspberry and inserted it's SD card into your computer.

make ssh - I guess this initiates an ssh session with the 'target' machine

Yes, it is. So you don't have to remember whether it's static IP or not (if you are on the same LAN) or you are on the same LAN or not and login credentials. Just type make ssh, it will handle the rest and you will be logged in into the target.

make sync-root - I'm guessing this makes the back up, or rather synchonises the backup incrementally, after the initial backup has been completed. This is what I really like about your method. I've been using the dd command and making a 32G duplicate of an SD card that's only got about 4G of data on it !

This command synchronizes your target's root folder into the your-project/sync-root folder. It's not that magical, this tool just uses rsync under the hood.

Making this synchronized folder an incremental backup is another story. See ./dcs-tools/make-backup:

ceremcem@cca-erik:therm-596be0be$ ./dcs-tools/make-backup 
[sudo] password for ceremcem: 
ERROR: 
ERROR: method is required.
ERROR: 

    Usage:

        make-backup ...options...

    Options:

    --source         : source directory for backup
    --backups        : backup container directory
    --method         : method for backup. One of:

                        * hardlinks
                        * btrfs

make ssh ARGS='uname -a'

The command uname -a will be executed on the target. For example:

image

Up til now I've been thinking of dcs-tools as as a system level install, that only needed installing once for the whole machine.

dcs-tools is intended to be set up per directory basis. This is the only way to make it portable. That's one of the reason I call the example directory name as your-project.

motioncircus commented 6 years ago

Hey Cerem

I really appreciate your help.

I will have to reply tomorrow.. its bathtime tonight for my ten year old. 8pm here.

Ciao N

On 25 Oct. 2017 5:55 pm, "Cerem Cem ASLAN" notifications@github.com wrote:

Does the "example usage" (https://github.com/aktos-io/ dcs-tools#example-usage) help or we need some more clarification? What problems do you encounter when you follow the example-usage section?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/aktos-io/dcs-tools/issues/13#issuecomment-339232945, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQ3E1Wi0Dc-I6D5Yjbu8y8zo5eHPev7ks5svttzgaJpZM4QFfJ2 .

ceremcem commented 6 years ago

Can we close the issue or anything left?

ceremcem commented 6 years ago

I'm going to close this issue. If anything lefts, please rise another issue.