By Nooruddin Abbas Ali, Solutions Architect
Typical enterprises these days are using centralized storage sub-systems and technologies such as NFS, SMB and File Servers to share files across employees and partner eco-system. While these systems have existed and evolved over a decade they still suffer from some common issues:
The following article details the design and deployment of an open-source application known as OwnCloud. OwnCloud is an application that allows users to backup / sync their files across different devices and share these files with other users or the public. This application is very similar to the likes of Dropbox or OneDrive.
Please note that this document assumes that 2 Elastic Compute Service (ECS) instances (using Ubuntu 14.04) and 1 ApsaraDB for RDS instance (using MySQL 5.6) have already been provisioned on Alibaba Cloud. If you don't know how to do so, visit Alibaba Cloud Getting Started to learn more.
As stated above for the purpose of this exercise I decided to deploy the open-source application known as OwnCloud. OwnCloud provides very similar functionality to the likes of services like Dropbox or OneDrive, which allow users to backup their files and sync them across multiple devices. With OwnCloud, we will setup our own Dropbox like service and also be able to provide some functionality in addition to what we get from the typical public services.
OwnCloud is not a very complex application, but has all the components of a typical 3 -tier application namely Web Front End, Application Layer, and Database. In order to deploy the application I utilized 2 ECS instances and 1 RDS instance. The following diagram depicts the application deployment architecture:
Reference Architecture for Production
Test Application Layout
The following table describes the application layout details:
Set up the following security Group rules:
The test application deployment is a simple process. Use the following steps in order to deploy OwnCloud on Alibaba Cloud.
In order deploy OwnCloud the first step is to setup MySQL database. I have followed the following steps to configure the OwnCloud database on the ApsaraDB for RDS instance.
Log in in to the Alibaba Cloud Console
Go to Products and Services - ApsaraDB for RDS.
Select Singapore for the region in RDS Management
Next to the RDS instance name click on Manage.
Click on Database Management.
Click on Create database and enter the following details and click OK:
Click on Account Management.
Click on Create Account and enter the following details and click OK:
This completes the database setup.
The second step in setting up OwnCloud is installing the application itself. I followed the following steps to deploy the OwnCloud on ECS instance 1:
Login in to the command line for Ubuntu on Instance 1:
$ ssh root@xx.xx.xx.xx
Once logged in download the Release Key for OwnCloud software and add it to the apt-key repository:
$ cd /tmp
$ wget http://download.opensuse.org/repositories/isv:ownCloud:community/xUbuntu_14.04/Release.key
$ sudo apt-key add - < Release.key
Add the OwnCloud repository source to Ubuntu:
$ sudo sh -c "echo 'deb http://download.opensuse.org/repositories/isv:/ownCloud:/community/xUbuntu_14.04/ /' >> /etc/apt/sources.list.d/owncloud.list"
Update the software repository:
sudo apt-get update
Install the OwnCloud application
sudo apt-get install owncloud
Make sure that the application installs successfully.
Once the application is installed, we can proceed to the initial setup. Before the initial configuration make sure that you have connectivity to the owncloud database from the ECS-Instance 1.
On the ECS-Instance 1 run the following command:
$ mysql -h <Database-URL> -P 3306 -u owncloud -p
When prompted enter the password set up in the RDS portal.
On the mysql> prompt run the following commands to ensure connectivity to the database:
mysql> use owncloud;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> exit
Bye
Now go to the browser and open the following URL: http:///owncloud/
Click on the Storage and Database section and select the MySQL-MariaDB this opens up the configuration for the database.
Use the following values to perform the initial configuration after which I click Finish Setup.
Once completed, you are presented with the OwnCloud dashboard:
This is a simple view of the files available on my cloud storage for the oadmin account.
In order to start using the application I decided to create another user. Note that oadmin is an administrative user.
In order to create a new user use the following steps:
Click on oadmin (username on the top right) and select Users.
Enter username: appadmin password: nand click Create.
Since we want to create a normal user with no administrative rights leave the Gourps and Group Admin settings to no group.
Now in order to see the application in action install an OwnCloud client on your desktop.
Follow the following procedure to deploy the agent on a Linux desktop.
Run the following command to add the owncloud client repository:
$ sudo dnf config-manager --add-repo http://download.opensuse.org/repositories/isv:ownCloud:desktop/Fedora_25/isv:ownCloud:desktop.repo
The following command was used to install the client:
$ sudo dnf install owncloud-client
Once the installation is complete launch the OwnCloud desktop client in Fedora. This then takes you through the connection and account setup. Use the following values for configuring the OwnCloud Desktop Client:
At this point it provides you with an option of opening the OwnCloud in Browser or the local folder. If you chose the local folder something similar to the below opens up and in a few seconds the default files/folders from the server are synced to the desktop:
In its current configuration the OwnCloud is putting all the user files in /var/www/owncloud/data folder on the ECS-Instance 1.
In order to make things more interesting lets attach an external storage to the application. For this purpose let's run a ftp service on ECS instance 2 and then make this FTP visible to the users with various options. I followed the following steps to set this up:
On the ECS-Instance 2:
Added a user to the server for owncloud:
$ sudo adduser owncloud
Enter the password details and leave the rest as default
Create storage folders for shared storage and private user storage
$ sudo su - owncloud
$ mkdir /home/owncloud/owncloudstorage
$ mkdir /home/owncloud/oadmin
$ mkdir /home/owncloud/appuser
$ mkdir /home/owncloud/owncloudstorage
Since secure shell (ssh) is already installed on the ubuntu servers in ECS the sftp service is available by default. The remaining configuration is to be done in the Administrative web interface. Use the following steps:
Go to http:///owncloud/ and log in using oadmin credentials.
Click on oadmin (username) on the top right corner and click Admin.
On the Top left corner click on Admin and click the + App sign.
In the menu click on Not Enabled.
Find External Storage Support and press the Enable button.
Click on oadmin (username) on the top right corner and click Admin.
Click on External Storage.
Click the Add Storage dropdown and select sftp.
Enter the following details:
Click the Add Storage dropdown and select sftp
Enter the following details:
Click the Add Storage dropdown and select sftp
Enter the following details:
The following should be the result. Make sure all the storage attachments are green as shown below:
If you now login in to the OwnCloud dashboard for oadmin it will see the following:
The dashboard for appuser will show a similar structure. However do note that the MyFTP folder for each user is a private folder only visible to that user. The SharefFTP folder is a shared folder and is visible to all users. If users upload any files on these folders these are now stored on the ECS - Instance 2.
There are a few things that need to be kept in to consideration when deploying the app on the cloud:
The following items can be improved if performing the deployment for a production setup:
How to Deploy React Apps Using Webhooks and Integrating Slack on Ubuntu
Deploying Static Websites Using OSS and CDN on Alibaba Cloud
2,599 posts | 764 followers
FollowAlibaba Clouder - February 11, 2019
digoal - October 18, 2022
Alibaba Clouder - April 21, 2020
Alibaba Clouder - August 16, 2019
digoal - May 19, 2021
Alibaba Clouder - August 16, 2019
2,599 posts | 764 followers
FollowElastic and secure virtual cloud servers to cater all your cloud hosting needs.
Learn MoreAn encrypted and secure cloud storage service which stores, processes and accesses massive amounts of data from anywhere in the world
Learn MoreLearn More
More Posts by Alibaba Clouder
260854141147955053 November 2, 2018 at 9:42 am
OwnCloud can even leveraging OSSFS to use OSS as the data storage, which is much cheaper and more elastic