mirror of
https://github.com/cimryan/teslausb.git
synced 2026-02-28 20:20:32 +00:00
Consolidate and standardize documentation.
This commit is contained in:
@@ -1,85 +1,93 @@
|
||||
# Introduction
|
||||
|
||||
This guide will show you how to install and configure [rclone4pi](https://github.com/pageauc/rclone4pi/wiki) (based off [rclone](https://rclone.org/)) to archive your saved TeslaCam footage on a number of different remote storage services including (Google Drive, S3 and Dropbox).
|
||||
This guide will show you how to install and configure [rclone4pi](https://github.com/pageauc/rclone4pi/wiki) (based off [rclone](https://rclone.org/)) to archive your saved TeslaCam footage on one of a number of different remote storage services including Google Drive, S3 and Dropbox.
|
||||
|
||||
This guide assumes you have **NOT** run the `setup-teslacam` script yet
|
||||
You must perform these steps **after** getting a shell on the Pi and **before** running the `setup-teslacam` script on the Pi.
|
||||
|
||||
# Step 1: Install rclone4pi
|
||||
**Make sure to run all commands in these instructions in a single command shell as root. When you return to the [Main Instructions](/README.md) continue running the commands there in this same shell.** This is necessary because:
|
||||
* The `archiveloop` script runs as root and the rclone config is bound to the user running the config.
|
||||
* These commands define environment variables that the main setup scripts need.
|
||||
|
||||
The first step is to get the [rclone4pi](https://github.com/pageauc/rclone4pi/wiki) binary installed on the raspberry pi. You can do this by executing the following command:
|
||||
# Quick guide
|
||||
These instructions will speed you through the process with good defaults. If you encounter an error, or you want to use a different config name than `gdrive` or a different folder name than `TeslaCam`, follow the detailed instuctions, below.
|
||||
|
||||
1. Run these commands. Specify the config name `gdrive` when prompted for the config name.
|
||||
```
|
||||
sudo -i
|
||||
curl -L https://raw.github.com/pageauc/rclone4pi/master/rclone-install.sh | bash
|
||||
rclone config
|
||||
```
|
||||
1. Run these commands:
|
||||
```
|
||||
export RCLONE_ENABLE=true
|
||||
export RCLONE_DRIVE=gdrive
|
||||
export RCLONE_PATH=TeslaCam
|
||||
|
||||
rclone mkdir "$RCLONE_DRIVE:$RCLONE_PATH"
|
||||
rclone lsd "$RCLONE_DRIVE":
|
||||
```
|
||||
1. If you didn't encounter any error messages and you see the `TeslaCam` directory listed return to the [Main Instructions](../README.md).
|
||||
|
||||
```
|
||||
curl -L https://raw.github.com/pageauc/rclone4pi/master/rclone-install.sh | bash
|
||||
```
|
||||
# Detailed instructions
|
||||
## Step 1: Install rclone4pi
|
||||
1. Run this command to enter a command shell for the root user.
|
||||
```
|
||||
sudo -i
|
||||
```
|
||||
2. Run the following command to install rclone4pi:
|
||||
```
|
||||
curl -L https://raw.github.com/pageauc/rclone4pi/master/rclone-install.sh | bash
|
||||
```
|
||||
Alternatively, you can install rclone4pi manually by following these [instructions] (https://github.com/pageauc/rclone4pi/wiki#manual-install).
|
||||
|
||||
You can also install the script manually by following these [instructions](https://github.com/pageauc/rclone4pi/wiki#manual-install).
|
||||
|
||||
|
||||
Once installed, the script will install rclone-install.sh, rclone-sync.sh and create a subfolder rpi-sync in users home eg. /root
|
||||
|
||||
# Step 2: Configure rclone storage system
|
||||
|
||||
Next, run this command as root to configure a storage system.
|
||||
|
||||
```
|
||||
rclone config
|
||||
```
|
||||
|
||||
**Important:** Make sure to run this as root since archiveloop runs as root and the rclone config is bound to the user running the config. The config file is also moved with the assumption that the root user ran config.
|
||||
|
||||
This will launch an interactive setup with a series of questions. I highly recommend you look at the documents for your storage system by going to [rclone](https://rclone.org/) and selecting your storage system from the pull down menu at the stop.
|
||||
|
||||
I've only personally tested this with Google Drive using these [instructions](https://rclone.org/drive/). One thing to note is the importance of setting the correct [scope](https://rclone.org/drive/#scopes) you are providing access to. Carefully read the documentation on [scopes on rclone](https://rclone.org/drive/#scopes) as well as [Google Drive](https://developers.google.com/drive/api/v3/about-auth). I recommend going with drive.file scope.
|
||||
|
||||
**Important:** Take note of the name you used for this config. You will need it later. The rest of the document will use `gdrive` as the name since that's what I used.
|
||||
# Step 2: Configure the archive
|
||||
1. Run this command to configure an archive:
|
||||
```
|
||||
rclone config
|
||||
```
|
||||
This will launch an interactive setup with a series of questions. It is recommended that you look at the documentation for your storage system by going to [rclone](https://rclone.org/) and selecting your storage system from the pull down menu at the stop.
|
||||
|
||||
It has been confirmed that this process works with Google Drive using these [instructions](https://rclone.org/drive/). If you are using another storage system, please feel encouraged to create an "Issue" describing your challenges and/or your success.
|
||||
|
||||
If you are using Google Drive it is important to set the correct [scope](https://rclone.org/drive/#scopes). Carefully read the documentation on [scopes on rclone](https://rclone.org/drive/#scopes) as well as [Google Drive](https://developers.google.com/drive/api/v3/about-auth). The `drive.file` scope is recommended.
|
||||
|
||||
**Important:** During the `rclone config` process you will sepcify a name for the configuration. The rest of the document will assume the use of the name `gdrive`; replace this with your chosen configuration name.
|
||||
|
||||
1. Run this command:
|
||||
```
|
||||
export RCLONE_DRIVE="gdrive"
|
||||
```
|
||||
# Step 3: Verify and create storage directory
|
||||
|
||||
Run the following command (again, as root) to see the name of the remote drive you just created.
|
||||
|
||||
```
|
||||
rclone listremotes
|
||||
```
|
||||
|
||||
If you don't see the name there, something went wrong and you'll likely have to go back through the config process. If all went well, use
|
||||
|
||||
|
||||
```
|
||||
rclone lsd gdrive:
|
||||
```
|
||||
|
||||
At this point, you should not see anything if you set your scope correctly. Now we need to create a folder to put all our archives in. You can do this by running this command. I used TeslaCam but you can name it whatever you want as long as you set it in the next step below.
|
||||
|
||||
```
|
||||
rclone mkdir gdrive:TeslaCam
|
||||
```
|
||||
|
||||
Run this one last command again
|
||||
|
||||
```
|
||||
rclone lsd gdrive:
|
||||
```
|
||||
|
||||
Once you confirm that the directoy you just created is there, we're all set to move on!
|
||||
1. Run the following command to see the name of the remote drive you just created.
|
||||
```
|
||||
rclone listremotes
|
||||
```
|
||||
If you don't see the name there, something went wrong. Go back through the `rclone config` process.
|
||||
1. Run this command:
|
||||
```
|
||||
rclone lsd "$RCLONE_DRIVE":
|
||||
```
|
||||
You should not see any files listed. If you do then you did not set your scope correctly during the `rclone config` process.
|
||||
1. Choose the name of a folder to hold the archived clips. These instructions will assume you chose the name `TeslaCam`. Substitute the name you chose for this name. Run this command:
|
||||
```
|
||||
export RCLONE_PATH="TeslaCam"
|
||||
```
|
||||
1. Run the following command to create a folder which will hold the archived clips.
|
||||
```
|
||||
rclone mkdir "$RCLONE_DRIVE:TeslaCam"
|
||||
```
|
||||
1. Run this command again:
|
||||
```
|
||||
rclone lsd "RCLONE_DRIVE":
|
||||
```
|
||||
Confirm that the directory `TeslaCam` is present. If not, start over.
|
||||
|
||||
# Step 4: Exports
|
||||
|
||||
To be able to configure the teslausb pi to use rclone, you'll need to export a few things. On your teslausb pi, run:
|
||||
|
||||
Run this command to cause the setup processes which you'll resume in the main instructions to use rclone4pi:
|
||||
```
|
||||
export RCLONE_ENABLE=true
|
||||
export RCLONE_DRIVE=<name of drive>
|
||||
export RCLONE_PATH=<path to folder>
|
||||
```
|
||||
|
||||
An example of my config is listed below:
|
||||
|
||||
```
|
||||
export RCLONE_ENABLE=true
|
||||
export RCLONE_DRIVE=gdrive
|
||||
export RCLONE_PATH=TeslaCam
|
||||
```
|
||||
**Note:** `RCLONE_ENABLE=true` is going to disable the default archive server. It also will **not** play nicely with `RSYNC_ENABLE=true` Perhaps future releases will allow both to be defined and function at the same time, for redundancy, but for now just pick one that you'll want the most.
|
||||
|
||||
You should be ready to run the setup script now, so return back to step 8 of the [Main Instructions](/README.md).
|
||||
Now return to the section "Set up the USB storage functionality" in the [main instructions](../README.md).
|
||||
|
||||
@@ -1,21 +1,33 @@
|
||||
# Introduction
|
||||
This guide will show you how to utilize [rsync](https://rsync.samba.org/) to archive your saved TeslaCam footage on a remote storage server. In my case, I use this for a networked pi storage server.
|
||||
This guide will show you how to use [rsync](https://rsync.samba.org/) to archive your saved TeslaCam footage on a remote storage server.
|
||||
|
||||
Since sftp/rsync accesses a computer through SSH the only requirement for hosting an SFTP/rsync server is to have a box running SSH. For example, you could use another Raspberry Pi connected to your local network with a USB storage drive plugged in. The official Raspberry Pi site has a good example on [how to mount an external drive](https://www.raspberrypi.org/documentation/configuration/external-storage.md).
|
||||
|
||||
You will need the username and host/IP of the storage server, as well as the path for the files to go in, and the storage server will need to allow SSH.
|
||||
|
||||
This guide makes the following assumptions:
|
||||
1. You are running your own ftp/rsync server that you have admin rights to, or can at least add a public key to its `~/.ssh/authorized_keys` file
|
||||
1. The ftp/rsync server has rsync installed (raspbian automatically does)
|
||||
2. You have **NOT** run the `setup-teslacam` script yet
|
||||
* You are running your own ftp/rsync server that you have admin rights to, or can at least add a public key to its `~/.ssh/authorized_keys` file.
|
||||
* The ftp/rsync server has rsync installed (raspbian automatically does)
|
||||
|
||||
# Step 1: Authentication
|
||||
Similar to sftp, rsync by default utilizes ssh to connect to a remote server and transfer files. This guide will use a generated ssh keypair, hence the first assumption above.
|
||||
Similar to sftp, rsync by default uses ssh to connect to a remote server and transfer files. This guide will use a generated ssh keypair, hence the first assumption above.
|
||||
|
||||
1. On your teslausb pi, run `ssh-keygen` to generate an ssh key **for the ROOT user!** If you followed the previous steps, you should have already ran `sudo -i` to become the root user on the telsausb pi. If you didn't, run `sudo -i` and re-run `ssh-keygen`. You can be sure that it is generating for root if it asks to store the key in `/root/.ssh/` (versus something like `/home/pi/.ssh`).
|
||||
1. Run these commands to to generate an ssh key for the `root` user:
|
||||
```
|
||||
sudo -i
|
||||
ssh-keygen
|
||||
```
|
||||
|
||||
1. Add the contents of the newly generated `/root/.ssh/id_rsa.pub` file from your teslausb pi to the storage server's `~/.ssh/authorized_keys` file. This will allow a nice and easy connection through rsync, no passwords needed!
|
||||
1. Add the contents of the newly generated `/root/.ssh/id_rsa.pub` file from your teslausb pi to the storage server's `~/.ssh/authorized_keys` file. You can do this by connectin via ssh to the archive server from the computer you're using to set up the Pi, editing the `~/.ssh/authorized_keys` in nano, and pasting in the content of the `/root/.ssh/id_rsa.pub` file from the teslausb Pi.
|
||||
|
||||
1. Lastly, you will need to authorize the connection to the FTP/Rsync server and test that the key works, so try connecting to the server (through ssh), and **if it asks if you wish to continue connecting, make sure to type `yes`!** If you do not do this, rsync will fail to connect and thus fail to archive your clips.
|
||||
1. Lastly, you will need to authorize the connection to the FTP/Rsync server and test that the key works, so try connecting to the server (through ssh), and **when you are asked if you wish to continue connecting type `yes`**
|
||||
```
|
||||
ssh user@archiveserver
|
||||
```
|
||||
If you do not do this then rsync will fail to connect and thus fail to archive your clips.
|
||||
|
||||
# Step 2: Exports
|
||||
To be able to configure the teslausb pi use rsync, you'll need to export a few things. On your teslausb pi, run:
|
||||
Run this command to cause the setup processes which you'll resume in the main instructions to use rsync:
|
||||
|
||||
```
|
||||
export RSYNC_ENABLE=true
|
||||
@@ -23,21 +35,17 @@ export RSYNC_USER=<ftp username>
|
||||
export RSYNC_SERVER=<ftp IP/host>
|
||||
export RSYNC_PATH=<destination path to save in>
|
||||
```
|
||||
|
||||
Explanations for each:
|
||||
* `RSYNC_ENABLE`: `true` for enabling rsync
|
||||
* `RSYNC_USER`: The user on the FTP server
|
||||
* `RSYNC_SERVER`: The IP address/hostname of the destination machine
|
||||
* `RSYNC_PATH`: The path on the destination machine where the files will be saved
|
||||
|
||||
An example (of my) config is listed below:
|
||||
|
||||
An example config is below:
|
||||
```
|
||||
export RSYNC_ENABLE=true
|
||||
export RSYNC_USER=pi
|
||||
export RSYNC_SERVER=192.168.1.254
|
||||
export RSYNC_PATH=/mnt/PIHDD/TeslaCam/
|
||||
```
|
||||
***Note: RSYNC_ENABLE=true is going to disable the default archive server. Perhaps future releases will allow both to be defined and function at the same time, for redundancy, but for now just pick one that you'll want the most.***
|
||||
|
||||
You should be ready to run the setup script now, so return back to step 8 of the [Main Instructions](README.md).
|
||||
Now return to the section "Set up the USB storage functionality" in the [main instructions](../README.md).
|
||||
32
doc/SetupShare.md
Normal file
32
doc/SetupShare.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# Hosting the archive on Windows File Shares, MacOS Sharing, or Samba on Linux
|
||||
Set up a share to host the archive on a computer on your home network. These instructions assume that you created a share named "SailfishCam" on the server "Nautilus".
|
||||
|
||||
It is recommended that you create a new user. Grant the user you'll be using read/write access to the share. These instructions will assume that the user you've created is named "sailfish" and that the password for this user is "pa$$w0rd".
|
||||
|
||||
Now, on the Pi:
|
||||
1. Try to ping your archive server from the Pi. In this example the server is named `nautilus`.
|
||||
```
|
||||
ping -c 3 nautilus
|
||||
```
|
||||
1. If the server can't be reached, ping its IP address (These instructions will assume that the IP address of the archive server is `192.168.0.41`.):
|
||||
```
|
||||
ping 192.168.0.41
|
||||
```
|
||||
To get the IP address of the archive machine:
|
||||
* On Windows: Open a PowerShell session and type `ipconfig`. Get the IP address from the line labeled "IPv4 Address".
|
||||
* On MacOS or Linux open a terminal and type ifconfig.
|
||||
|
||||
If you can't ping the archive server by IP address from the Pi, go do whatever you need to on your network to fix that.
|
||||
|
||||
If you can't reach the archive server by name but you can by IP address then use its IP address, below, for the `archiveserver` variable.
|
||||
|
||||
1. Run these commands, subsituting your values:
|
||||
```
|
||||
sudo -i
|
||||
export archiveserver="Nautilus"
|
||||
export sharename="SailfishCam"
|
||||
export shareuser="sailfish"
|
||||
export sharepassword="pa$$w0rd"
|
||||
```
|
||||
|
||||
Now return to the section "Set up the USB storage functionality" in the [main instructions](/README.md).
|
||||
Reference in New Issue
Block a user