Skip to content

Guided Installation Setup (Docker)

subnub edited this page Dec 30, 2020 · 12 revisions

Guided Installation

This page will help beginners to install and run myDrive, this guide will run myDrive using Docker, view the other guides to get myDrive running on a local machine or a Droplet.

  1. Installing Docker
  2. Downloading myDrive
  3. Setup myDrive
  4. Build myDrive
  5. Environment Variables
  6. Building myDrive
  7. Running myDrive
  8. Entering webUI key

1. Installing Docker

Users will first need to install the run Docker.

Docker Download

2. Downloading 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

3. Setup myDrive

Next unzip the file myDrive, after unzipping you'll see the myDrive source code.

4. Build myDrive

If you want to use the built in setup tools for environment variables you must first build the project. If you would rather create the environment variables manually you can skip this step.

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 command to start creating the environment variables.

npm run setup

You will be asked to navigate to localhost in order to complete setup, but you can also use your servers IP address or URL if you wish. Navigate to this URL in a web browser.

Use Docker: Select 'yes' for this field. You will then be asked if you would like to include mongoDB with myDrive. If you would like to do this select 'yes'. If not select 'no' and enter the mongoDB URL, use this method if you are using a service such as MongoDB Atlas.

WebUI for encryption key: Select this is you would like myDrive to first open up a web server to enter the encryption key before starting myDrive. This option is recommended to you do not need to store the encryption key in an environment variable which is less safe. This is the key/password used to encrypt all of the files and user information. Do not lose this key there is no way to recover a lost key and all data will be lost.

Client URL: This is the URL/IP address you are using to access myDrive. For example if you access myDrive through myDrive.com you would enter 'http://myDrive.com".

Pick a database: Choose the database you would like to store file chunks in. You have three options here and some of them will reveal more information you need to add.

Access secret: The key/password used to sign access tokens, this can be changed at any time and will just cause users to be logged out if they do not have a valid refresh token.

Refresh secret: The key/password used to sign refresh tokens, this can be changed at any time and will just cause users to be logged out.

Cookie secret: The key/password used to sign cookies, this can be changed at any time and will just cause users to be logged out.

Secure cookies: This will make cookies transfer only if they are on a HTTPS connection, you can only use this if you site uses an HTTPS connection. This is recommended if you can use it.

Sendgrid for emails: Add email verification and password resets through email with sendgrid. You will be required to create a sendgrid account.

Use SSL: Starts myDrive also on an https server, this requires certificates to be stored at the root of the project. If you are hosting on a site that provides SSL/HTTPS select no for this.

After entering all information select save.

Exit out of the correct process by pressing 'ctrl+c'.

6. Building myDrive

Users must first build the Docker image, to do this run the following command.

docker-compose build

or

docker-compose -f docker-compose-no-mongo.yml build

Use the first build command if you're using the Docker image that includes mongoDB, use the second command if you're not using the Docker image that includes mongoDB.

7. Running myDrive

To start myDrive use the following command.

docker-compose up

or

docker-compose up -d

The '-d' will run myDrive in detached mode, if you wish to keep myDrive running in the current terminal, use the first command instead.

8. Entering webUI key

Before myDrive starts up the myDrive server, it will first create a webUI to navigate to in order to enter the encryption key (unless you selected otherwise in the previous steps), use any web browser on the local machine, and navigate to.

http://localhost:3000

You can also access this from your machines URL but this is not recommended since it is not over HTTPS.

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.

This is the WebUI, enter the encryption key here, DO NOT lose this encryption key, there is no way to recover a lost encryption key, and all of your data will be lost.

Once you enter the key myDrive will start up its normal server.

MyDrive is now running! Now just navigate to the client URL you entered earlier (Your local machine's IP address, or the domain name), and create a new account!