How to Share Files from Google Cloud Object Storage (GCP)

Google Cloud Storage is the object storage service offered by Google Cloud to store large amounts of files. In this document, we will discuss how to install NirvaShare and share files/folders from google object storage with external users using a simple form-based authentication. NirvaShare can be installed in any operating system and has advanced features to integrate with external identity providers, but in this tutorial, we shall consider Linux Ubuntu operating system with a simple form-based authentication while sharing files from object storage that uses HTTP without SSL certificate. Subsequently, you can enable SSL using your custom domain name and certificate. For more information check Google Documentation.

VM instance

You will require a new Virtual Machine instance with at least 2GB RAM, 20GB hard space and Ubuntu 20.04 LTS. Let us create one and configure the same.

  • Login to https://console.cloud.google.com
  • Go to Compute Engine – VM instances
  • Click on CREATE INSTANCE
  • Provide required details including hardware specification.
  • For the Boot disk, you need to select operating system as Ubuntu 20.04 LTS
  • Create the VM instance.
  • For more information you can also refer to Google Documentation
bootConfiguration

Once the VM is created, we need to open couple of ports for NirvaShare, so let us create a new firewall rule.

  • From the main menu, click on VPC Network and select Firewall
  • Click on CREATE FIREWALL RULE
  • Provide name and target tags as nirvashare-firewall
  • For Source IP range, enter 0.0.0.0/0 to let access from all source IP addresses.
  • For Protocols and ports, select Specified protocols and ports
  • Enter ports as 8080, 8081 and create it.
ports

Now, let us open the ports to the newly created VM by changing the firewall policy.

firewallPorts

NirvaShare Installation

SSH to the newly created VM instance using your private ssh key or the simplest way is to use the option to open with browser.

  • From the VM instance SSH , select Open in browser window
sshOpen
  • Once you log in to SSH console, run below commands to start the installation as root user. This will download the script and install NirvaShare.
sudo su root
curl -s https://raw.githubusercontent.com/nirvashare/nirvashare/main/linux/ubuntu/install_nirvashare.sh -o ns_install.sh && bash ns_install.sh && rm ns_install.sh

Above command will prompt you to enter database password, once provided, it will proceed and complete the installation within a minute or two.

console

Verifying Installation

After installation is completed, wait for 3-4 minutes for server to come up as it takes time to create schema, etc.

Access the url as http://(your IP):8080
This should open up login screen as shown below.

loginForm

Storage Configuration

It is essential to configure the object storage with NirvaShare and please refer to below documentation.

Login Profile for Form based Authentication

To password protect a shared File/Folder, a login profile is required to be created which will enable authentication for the shares. In this exercise, we will create a simple Form based login profile (Single User) and refer to below documentation.

Sharing File/Folder

Now we are good to share a file/folder with a user that is based on the Login Profile we created. Multiple Shares can be created for the same login profile. Let us create a Share for a folder that you like to share with the user. Please refer to the below documentation on how to create a new share for a file/folder, associate to a login profile, and share the same with the user. During the configuration, for the authentication, please select the login profile that we created from the above section.

SSL and Domain Names

For testing purposes, File/Folder can still be shared to user without SSL and domain name, but however for production deployment or to integration with external identity providers,  you will require domain name and SSL to be configured. Please refer to below documentation.