Skip to content

Commit

Permalink
Upgraded to Plexdrive 5.0.0 without mongodb
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown committed Aug 1, 2017
1 parent fcdd431 commit 455f98e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 41 deletions.
28 changes: 12 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
These scripts are created to have your media synced between your cloud- and local store. All media is always encrypted before being uploaded.
This also means if you loose your encryption keys you can't read your media.

**Plexdrive version 4.0.0 and Rclone version 1.36 is used.**
**Plexdrive version 5.0.0 and Rclone version 1.36 is used.**

There is a setup file, `setup.sh`, to install the necessary stuff automatically. This has only been tested on Ubuntu 16.04+.

Expand Down Expand Up @@ -36,19 +36,17 @@ _Good idea to backup your Rclone configuration and Plexdrive configuration and c

### Manually
To install the necessary stuff manually do the following:
1. Install unionfs-fuse.
2. Install bc.
3. Install GNU screen.
4. Install [Rclone 1.36](https://downloads.rclone.org/rclone-current-linux-amd64.zip).
5. Install [Plexdrive 4.0.0](https://github.com/dweidenfeld/plexdrive/releases/download/4.0.0/plexdrive-linux-amd64).
6. Create the folders pointing, in the config file, to `local_decrypt_dir` and `plexdrive_temp_dir`.
7. Run rclone bin, installed in step 4, with the parameter `--config=RCLONE_CFG config` where `RCLONE_CFG` is the variable set in the config file.
8. Set up Google Drive remote, Crypt for Google Drive remove (rclone_cloud_endpoint) and crypt for local directory (rclone_local_endpoint).
9. Run plexdrive bin, installed in step 5, with the parameters `--config=PLEXDRIVE_DIR --mongo-database=MONGO_DATABASE --mongo-host=MONGO_HOST --mongo-user=MONGO_USER --mongo-password=MONGO_PASSWORD`. Remember to match the parameters with the variables in the config file.
10. Enter authorization to your Google Drive.
11. Cancel Plexdrive by pressing CTRL+C.
Run PlexDrive with GNU screen: `screen -dmS plexdrive PLEXDRIVE_BIN --config=PLEXDRIVE_DIR --mongo-database=MONGO_DATABASE --mongo-host=MONGO_HOST --mongo-user=MONGO_USER --mongo-password=MONGO_PASSWORD PLEXDRIVE_OPTIONS CLOUD_ENCRYPT_DIR`.
12. Exit screen session by pressing CTRL+A then D.
1. Install unionfs-fuse, bc, GNU screen.
2. Install [Rclone 1.36](https://github.com/ncw/rclone/releases/download/v1.36/rclone-v1.36-linux-amd64.zip).
3. Install [Plexdrive 5.0.0](https://github.com/dweidenfeld/plexdrive/releases/download/5.0.0/plexdrive-linux-amd64).
4. Create the folders pointing, in the config file, to `local_decrypt_dir` and `plexdrive_temp_dir`.
5. Run rclone bin, installed in step 4, with the parameter `--config=RCLONE_CFG config` where `RCLONE_CFG` is the variable set in the config file.
6. Set up Google Drive remote, Crypt for Google Drive remove (rclone_cloud_endpoint) and crypt for local directory (rclone_local_endpoint).
7. Run plexdrive bin, installed in step 5, with the parameters `mount --config=PLEXDRIVE_DIR --cache-file=${plexdrive_cache_file}`. Remember to match the parameters with the variables in the config file.
8. Enter authorization to your Google Drive.
9. Cancel Plexdrive by pressing CTRL+C.
Run PlexDrive with GNU screen: `screen -dmS plexdrive PLEXDRIVE_BIN mount --config=PLEXDRIVE_DIR --cache-file=${plexdrive_cache_file} CLOUD_ENCRYPT_DIR`.
10. Exit screen session by pressing CTRL+A then D.

## Cron
My suggestions for cronjobs is in the file `cron`.
Expand Down Expand Up @@ -88,8 +86,6 @@ Keep in mind that if it is written and read from `local_decrypt_dir` it will soo
## Plexdrive
Plexdrive is used to mount Google Drive to a local folder (`cloud_encrypt_dir`).

Plexdrive version 4.0.0 requires a running MongoDB server. This is not included in the scripts but can either be installed from .deb packages or in a Docker container.

Plexdrive create two files: `config.json` and `token.json`. This is used to get access to Google Drive. These can either be set up via Plexdrive or by using the templates located in the [plexdrive directory](plexdrive/) (copy the files, name them `config.json` and `token.json` and insert your Google API details).

## Rclone
Expand Down
9 changes: 2 additions & 7 deletions config
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,8 @@ ufs_options="-o cow,allow_other,direct_io,nonempty,auto_cache,sync_read"
plexdrive_dir="${media_dir}/plexdrive"
plexdrive_bin="${plexdrive_dir}/plexdrive-linux-amd64"

mongo_database="plexdrive"
mongo_host="localhost"
mongo_user=""
mongo_password=""

plexdrive_temp_dir="${media_dir}/.local-decrypt/plexdrive"
plexdrive_options="--temp=${plexdrive_temp_dir} -o allow_other --clear-chunk-max-size=1000G --clear-chunk-age=24h --chunk-size=10M"
plexdrive_cache_file="${media_dir}/.local-decrypt/plexdrive/cache.bolt"
plexdrive_options="--cache-file=${plexdrive_cache_file} -o allow_other --clear-chunk-max-size=1000G --clear-chunk-age=24h --chunk-size=10M"


###############################################################################
Expand Down
13 changes: 5 additions & 8 deletions scripts/mount.remote
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,17 @@ mount_gdrive () {
mkdir -p "${cloud_encrypt_dir}"
fi

# Make sure Plexdrive temp folder exists.
if [ ! -d "${plexdrive_temp_dir}" ]; then
mkdir -p "${plexdrive_temp_dir}"
fi

mongo="--mongo-database=${mongo_database} --mongo-host=${mongo_host}"
if [ ! -z "${mongo_user}" -a "${mongo_user}" != " " ]; then
mongo="${mongo} --mongo-user=${mongo_user} --mongo-password=${mongo_password}"
# Make sure Plexdrive cache folder exists.
plexdrive_cache_dir=$(dirname plexdrive_cache_file)
if [ ! -d "${plexdrive_cache_dir}" ]; then
mkdir -p "${dirname plexdrive_cache_dir}"
fi

# Mount GD if not already mounted.
if ! mountpoint -q "$cloud_encrypt_dir" ; then
echo "[ $(date ${date_format}) ] Mounting Google Drive mountpoint: ${cloud_encrypt_dir}"
screen -dmS plexdrive "$plexdrive_bin" --config="${plexdrive_dir}" $mongo $plexdrive_options "${cloud_encrypt_dir}"
screen -dmS plexdrive "$plexdrive_bin" mount --config="${plexdrive_dir}" $plexdrive_options "${cloud_encrypt_dir}"
else
echo "[ $(date ${date_format}) ] Google Drive mountpoint: ${cloud_encrypt_dir} already mounted."
fi
Expand Down
16 changes: 6 additions & 10 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _rclone_zip="rclone-v1.36-linux-amd64.zip"
_rclone_dir="rclone-v1.36-linux-amd64"

# Plexdrive
_plexdrive_url="https://github.com/dweidenfeld/plexdrive/releases/download/4.0.0/plexdrive-linux-amd64"
_plexdrive_url="https://github.com/dweidenfeld/plexdrive/releases/download/5.0.0/plexdrive-linux-amd64"
_plexdrive_bin="plexdrive-linux-amd64"
###################################

Expand Down Expand Up @@ -42,8 +42,9 @@ if [ ! -d "${local_decrypt_dir}" ]; then
mkdir -p "${local_decrypt_dir}"
fi

if [ ! -d "${plexdrive_temp_dir}" ]; then
mkdir -p "${plexdrive_temp_dir}"
plexdrive_cache_dir=$(dirname plexdrive_cache_file)
if [ ! -d "${plexdrive_cache_dir}" ]; then
mkdir -p "${dirname plexdrive_cache_dir}"
fi


Expand All @@ -59,15 +60,10 @@ echo "\t- Crypt for your local directory ('${cloud_encrypt_dir}') named '${rclon

echo "\n\n-------- SETUP PLEXDRIVE --------\n"

mongo="--mongo-database=${mongo_database} --mongo-host=${mongo_host}"
if [ ! -z "${mongo_user}" -a "${mongo_user}" != " " ]; then
mongo="${mongo} --mongo-user=${mongo_user} --mongo-password=${mongo_password}"
fi

echo "1. Now run plexdrive with the command:"
echo "\t${plexdrive_bin} --config=${plexdrive_dir} ${mongo} ${cloud_encrypt_dir}"
echo "\t${plexdrive_bin} mount --config=${plexdrive_dir} ${plexdrive_options} ${cloud_encrypt_dir}"
echo "2. Enter authorization"
echo "3. Cancel plexdrive by pressing CTRL+C"
echo "4. Run plexdrive with screen by running the following command:"
echo "\tscreen -dmS plexdrive ${plexdrive_bin} --config=${plexdrive_dir} ${mongo} ${plexdrive_options} ${cloud_encrypt_dir}"
echo "\tscreen -dmS plexdrive ${plexdrive_bin} mount --config=${plexdrive_dir} ${plexdrive_options} ${cloud_encrypt_dir}"
echo "Exit screen session by pressing CTRL+A then D"

0 comments on commit 455f98e

Please sign in to comment.