Guided Installation

Screenshot from 2020-12-08 18-03-21.png
 

1. Install Node.js

Users will first need to install Node.js, this is used to run myDrive, as well as install all of its dependencies. I recommend using the latest version instead of the LTS. If you run into issues when uploading large files use v12 instead.

Node.js Download

Screenshot from 2020-12-08 18-03-21.png
 

2. Install MongoDB

Users will also need to install MongoDB unless you're using some type of service like Atlas or DocumentDB, MongoDB is used to store all the user, and file metadata information.

MongoDB Download

MongoDB Installation/Setup Guide

gitdownload.png
 

3. Download myDrive

Next, Download myDrive from the main Github page, the easiest way to do this is to select 'Download Zip' from the 'Clone and Download' section. But you can also clone myDrive with the following command.

git clone https://github.com/subnub/myDrive.git

Cloning allows users to easily get updates when new versions of myDrive are released using the git pull command.

git pull

unzip.png
 

4. Setup myDrive

Next unzip the file, you should now have the following files, after this open up a terminal in the myDrive directory.

npm.png
 

4a. Install modules

Now run the following command in order to install all the myDrive dependencies.

npm install

If everything is installed correctly, you should get an output similar to this screenshot.

npm.png
 

5. Environment variables

Before running myDrive users must create the environment variables file, myDrive comes with a built-in tool to make this much easier, run the following commands to start creating the environment variables.

First build the project.

npm run build

After building run the setup script

npm run setup

If done correctly the ouput in the terminal should say “Please navigate to http://localhost:3000 to enter setup details”.

You can also access this through the hosts IP address and port if you choose, for example “http://192.168.0.28:3000”.

If you would rather create environment variables manually please go to the environment variables section.

npm.png
 

5a. Entering environment variables

Now use a browser and navigate to the URL listed.

If everything works you should see a screen similar to the screenshot.

Environment Variables

Use Docker: Select “No” for this option, if you would like to use docker please navigate to the docker section instead.

Enter mongoDB URL: If you are hosting mongoDB on the same machine you can select “use local URL” and it will automatically put the needed URL in, if you are hosting it on a different machine, or Atlas, enter the URL here.

Use webUI for encryption key: It is recommended that you leave this on “Yes”, this will make it so before myDrive starts it will host a server with a web page where you can enter the encryption key. If you would rather myDrive start up without the webUI first, you can select “No” you will then have to enter the encryption key directly before it.

WARNING: Either way you choose to enter the encryption key you must keep this key safe, and DO NOT lose it. This is the key that encrypts all of the files and more. If you lose this key there is no way to recover it, and all your files will be lost.

Use default port: I would just leave this as “Yes”, unless for some specific reason you want to change the port numbers you can.

Enter client URL: This is the URL that you will type into the browser to access myDrive. For example you could choose http://localhost:3000 this option would only allow you to access myDrive on the hosted machine keep in mind. If you want to be able to access myDrive from other devices on your network you must use the host machines IP address, for example http://192.168.0.28:3000 . If you want to be able to access myDrive anywhere regardless if you are on the same network, you must look into port forwarding is you are hosting myDrive on your own machine.

Pick a database: The default option is recommended in most cases, this will store myDrive files right on your local machine in a folder that you specify right below it in the “Enter the filesystem path”. For example you could use a path that looks like this “/home/subnub/Documents/mydrive-3-data/”. This will then store the myDrive data in the folder called “mydrive-3-data”. Keep in mind if you are using windows this path will look a little different. You also have the option to store myDrive files in Amazon S3, or just inside mongoDB itself.

Enter Access Token Secret: This is the password for signing access tokens, if this key is lost users will just be required to log back into their account, so you can change it at anytime. Just make its a secure and long password.

Enter Refresh Token Secret: This is the password for signing refresh tokens, if this key is lost users will just be required to log back into their account, so you can change it at anytime. Just make its a secure and long password.

Enter Cookie Secret: This is the password for signing refresh tokens, if this key is lost users will just be required to log back into their account, so you can change it at anytime. Just make its a secure and long password.

Use Secure Cookies: This will only work if you are using a HTTPS/SSL connection. If you are select “Yes”, if not select “No”.

Use SendGrid To Send Emails: You can have email verification and password resets for user accounts if they forgot their password if you select “Yes” on this option. If you select yes you will need to create a sendgrid account and enter the API key. If you select no email verification will not be required and users will not be able to reset their passwords if they forgot it, they will still be able to change their passwords in settings if they know their old password.

Use SSL: This is if you have a SSL certificate and want HTTPS. If you are using a service like Heroku that provides its own SSL encryption you can select no here. It is highly recommended to use HTTPS/SSL when accessing the myDrive website otherwise you are vulnerable to man in the middle attacks.

npm.png
 

6. Build myDrive again

You must build myDrive again after entering the environment variables, such run the command once more.

npm run build

After building has finished it is also recommended that you create the indexes for mongoDB, this is optional but increased performance.

npm run create-indexes-database

Screenshot from 2020-12-08 18-52-00.png
 

7. Running myDrive

To start myDrive use the following command.

npm run start

If you do not have the webUI for encryption key selected myDrive will start right up. If you do have the webUI for encryption key selected please go to step 8.

If everything is working correctly, you should be able to access myDrive through the URL you provided in the setup section. You should see a login screen like so.

Congratulation! You have successfully setup myDrive. You should now to able to create an account and login.

Screenshot from 2020-12-08 18-52-00.png
Screenshot from 2020-12-08 18-52-00.png
 

8. Entering webUI for encryption key

Before you can use myDrive you must enter the encryption key. The terminal should tell you to navigate to localhost to enter this key.

You can access this server from http://localhost:3000 or from the hosts IP address as stated before.

I recommend using localhost since it is safer. If you're using a service like SSH or a Droplet, you can forward the localhost connection safely like so:

ssh -L localhost:3000:localhost:3000 username@ip_address

Note: You can also disable using the webUI for the encryption key by providing a key in the server environment variables (e.g. KEY=password), but this is not recommended because it greatly reduces security

After the webUI key is entered, or if you chose not to enter a webUI key the myDrive server will start up. You can now access myDrive from your browser using the IP address or URL you entered in the setup.

After you enter the encryption key, you should be able to access myDrive from the URL you provided in the setup. If all is well you will see the login page.

Congratulation! You have successfully setup myDrive. You should now to able to create an account and login.