Building file sync and share service using RGW

File sync and share services, such as Dropbox, Box, Google Drive, and many more, have become extremely popular in the last few years. With Ceph, you can deploy on-premise file sync and share services using any S3- or Swift-based frontend applications. In this recipe, we will demonstrate how to build up a file sync and share services based on Ceph and ownCloud.

To build this service, we would require a running Ceph cluster, a RGW instance that can access Ceph storage via S3, and an ownCloud frontend environment, as shown next:

Building file sync and share service using RGW

Getting ready…

In the last recipe, we configured the radosgw instance, us-east-1; we will use the same gateway instance in this section to build the file sync and share service. We will also use our DNS service, which is configured on rgw-node1 to support S3 subdomain calls for the us-east-1 RGW instance; however, you can also use any DNS server until it resolves subdomains for us-east-1.

How to do it…

  1. Log in to rgw-node1, which is also our DNS server, and create a file, /var/named/us-east-1.cephcookbook.com, with the following contents:
    @ 86400 IN SOA cephcookbook.com. root.cephcookbook.com. (
            20091028 ; serial yyyy-mm-dd
            10800 ; refresh every 15 min
            3600 ; retry every hour
            3600000 ; expire after 1 month +
            86400 ); min ttl of 1 day
    @ 86400 IN NS cephbookbook.com.
    @ 86400 IN A 192.168.1.107
    * 86400 IN CNAME @
    
    How to do it…
  2. Configure the us-east-1 node to use the DNS server. Update /etc/resolve.conf with the rgw-node1 address and ping any subdomain; it should resolve to the us-east-1 address.
    How to do it…
  3. Make sure that the us-east-1 node can connect to the Ceph storage cluster over S3. We created a user in the last recipe with the name us-east, and we will use its access and secret keys with s3cmd:
    1. Install s3cmd:
      # yum install -y s3cmd
      
    2. Configure s3cmd and provide access_key as XNK0ST8WXTMWZGN29NF9 and secret_key as 7VJm8uAp71xKQZkjoPZmHu4sACA1SY8jTjay9dP5:
      # s3cmd --configure
      
    3. Edit /root/.s3cmd for host details:
      host_base = us-east-1.cephcookbook.com:7480
      host_bucket = %(bucket)s.us-east-1.cephcookbook.com:7480
      
    4. Test the s3cmd connection:
      # s3cmd ls
      
    5. Create an S3 bucket for ownCloud, which will be used to store ownCloud objects:
      # s3cmd mb s3://owncloud
      
  4. Next, we will install ownCloud, which will provide us with the frontend/user interface to the file sync and share service:
    1. Bring up the ownCloud virtual machine using Vagrant and log in to the VM:
      # vagrant up owncloud
      # vagrant ssh owncloud
      
    2. Install the ownCloud repositories as follows:
      # cd /etc/yum.repos.d/
      # wget http://download.opensuse.org/repositories/isv:ownCloud:community/CentOS_CentOS-7/isv:ownCloud:community.repo
      
    3. Install ownCloud as follows:
      # yum install owncloud -y
      
    4. Since this is a test setup, disable the firewall:
      # systemctl disable firewalld
      # systemctl stop firewalld
      
    5. Try accessing the ownCloud web interface by accessing http://192.168.1.120/owncloud/ in your host web browser. Create an admin account called owncloud with the password as owncloud:
      How to do it…
    6. The first login screen will look like the following one; you can use ownCloud as a desktop or mobile app any time:
    How to do it…
  5. Configure ownCloud to use Ceph as an S3 external storage:
    1. Enable external storage from the ownCloud admin account by navigating to Files | Apps | Not enabled | External Storage and clicking on Enable it.
    2. Next, set up the external storage to use Ceph. To do this, navigate to the top-right-hand side of the window and select the ownCloud user, then select admin, and then navigate to the left-hand side panel and select External Storage.
    3. Configure Amazon S3 and the compliant storage with ownCloud by checking Enable User External Storage and then navigating to Amazon S3 and compliant | Add Storage | Amazon S3 and Compliant.
  6. Provide the Ceph radosgw user detail with the access key, secret key, and hostname:
    • Folder name: Enter the folder name that you want to show on your ownCloud files page.
    • Access key: Enter your S3 Access Key, XNK0ST8WXTMWZGN29NF9
    • Secret key: Enter your S3 Secret key, 7VJm8uAp71xKQZkjoPZmHu4sACA1SY8jTjay9dP5"
    • Bucket: Enter the name of your S3 bucket that we created in step 3
    • Hostname: Enter us-east-1.cephcookbook.com
    • Port: Enter 7480
    • Region (optional): Enter US (optional)
    • Available for: Enter owncloud (optional)
    How to do it…
  7. As soon as you enter the preceding details, ownCloud should connect to the Ceph cluster over S3, and you should see a green circle just before the folder name, as shown in the preceding image.
  8. Next, upload your files via the ownCloud web user interface. To do this, navigate to Files | External Storage and click on the ceph-s3 upload files or directory.
  9. Verify that the files have been added to the Ceph storage cluster by switching to us-east-1 node and performing the s3cmd ls s3://owncloud command; you should get the file you uploaded from the ownCloud web user interface.
    How to do it…
  10. Congratulations! You have learned how to build your own private file sync and share service using Ceph S3 object storage and ownCloud.

See also…

For more information on ownCloud, visit https://owncloud.org/.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.75.70