×
Community Blog Friday Blog - Week 24 - Make Your Own Personal Cloud With ownCloud

Friday Blog - Week 24 - Make Your Own Personal Cloud With ownCloud

Learn how to build your own, private cloud storage + calendar solution with ownCloud on Alibaba Cloud.

By Jeremy Pedersen

Welcome back for the 24th installment in our weekly blog series! This week, we'll take a look at how you can build your own "personal cloud", by deploying ownCloud using Alibaba Cloud's ECS and RDS services.

We'll do most of the deployment work using Terraform, so I assume a little bit of Terraform experience, but don't worry: even if you are new to Terraform, I'll be walking you through everything step-by-step. ^_^

What is ownCloud?

ownCloud is a web application that helps you manage calendars, contacts, and documents. Essentially, it lets you recreate a lot of the functionality you get from services like Google Workspace (formerly G Suite) or Microsoft's Office 365.

Why would I want ownCloud? Can't I just use Google or Microsoft's services

If you are looking for the simplest possible solution, it's hard to beat existing managed services.

However, there are plenty of scenarios where running things yourself makes sense. For instance:

  1. For compliance reasons, you need control over where your data is stored (for instance, you might need all of your data to stay within your home country).
  2. You need additional functionality that is not offered by the popular SaaS tools from Google or other providers.
  3. You want to build a private system that is only accessible from within your corporate network or via VPN.
  4. You want control over what features are available, now and in the future (ever heard of the Google Graveyard?)

Setting things up

I have created a handy Terraform script that does 80% of the work for you. To use it, I will assume familiarity with git and terraform.

Many Linux machines will have git installed already, and trying to run git from the Terminal in macOS will prompt you to install, if it isn't already there (just follow the prompts).

Regardless of what OS you use, you will probably have to install Terraform yourself. Instructions for both Git and Terraform can be found here:

  1. Installing Git
  2. Installing Terraform

Getting the Terraform code

You can download all my Terraform example code (including the ownCloud setup code) by running the following command from a terminal (or PowerShell on Windows):

git clone https://github.com/jeremypedersen/terraformExamples.git

This will download a copy of my terraformExamples GitHub repository.

Note that it will be downloaded to whatever directory you were in when you ran the git command. Not sure where that is? You can run pwd from the command line, to find out which directory you are in, like this:

terminal_pwd

Now, from your terminal window, navigate to the document-management-owncloud directory, like this:

cd terraformExamples/abc/document-management-owncloud

Done? Good. Now, create a terraform variables file, like this:

cp terraform.tfvars.example terraform.tfvars

Open that file in your favorite text editor, and insert a valid access key, access key secret, and password for your MySQL database.

You might also want to change the "region". By default, the Terraform script will set up your RDS database and ECS virtual machine in ap-southeast-1 (Singapore). You can change that by editing the "optional" settings in terraform.tfvars.

If you haven't set up an Alibaba Cloud Access Key or Secret before, take a look at these docs:

  1. Create a RAM user
  2. Grant permissions to a RAM user
  3. Create an Access Key for a RAM user

For your MySQL password, be sure to choose something long and complex that will satisfy MySQL's strong password requirements. If you need some help generating a decent password, you can use the command line tool pwgen. On Linux, install it with your favorite package manager (yum, rpm, apt, whatever!) and on macOS, install it via brew, with brew install pwgen. You can get brew here. It's a great tool: I highly recommend it!

If you happen to be on Windows but still want a package manager, try Chocolatey. It does for Windows users what brew does for macOS users.

Running The Code

Running the Terraform code should be as easy as:

terraform init

And then (on Linux or macOS):

./setup.sh

If you are on Windows, you won't be able to run the setup.sh script, so you should directly run terraform instead, like this:

terraform apply --auto-approve

This will start and run terraform, which should:

  1. Set up an RDS database
  2. Set up an ECS instance
  3. Create an EIP, and attach it to the ECS instance
  4. Install ownCloud on the ECS instance

Just wait for the script to finish.

Final Step: Setting Up ownCloud!

Now that our Terraform code has finished running, we just need to set up ownCloud itself.

Take a look at the output of the Terraform script:

tf_outputs

One of the items listed will be your ECS instance's public IP address, which you should paste into a web browser.

That will take you to the ownCloud setup page, which will prompt you for some additional information:

  1. A username and password for your new ownCloud user.
  2. Your database name, database username, and database user password.
  3. The connection string for your database.

All that information is available in the output from the terraform script (as above).

Provide that info on the ownCloud setup page, as shown here:

owncloud_user

owncloud_setup

Note: Make make sure to include :3306 at the end of the "Database host" connection string. So in my case, I would set my "Database host" to rm-gs5rn48a51h6t9c84.mysql.singapore.rds.aliyuncs.com:3306

Click on Finish Setup and that's it! You should have a fresh, working ownCloud install:

owncloud_working

When you're done playing with this environment, you can easily shut everything down (to avoid a bill, of course) by running either:

./destroy.sh

or

terraform destroy --auto-approve
rm -f *.pem

That's all for this week, see you next week!

I've Got A Question!

Great! Reach out to me at jierui.pjr@alibabacloud.com and I'll do my best to answer in a future Friday Q&A blog.

You can also follow the Alibaba Cloud Academy LinkedIn Page. We'll re-post these blogs there each Friday.

Not a LinkedIn person? We're also on Twitter and YouTube.

0 0 0
Share on

JDP

71 posts | 157 followers

You may also like

Comments

JDP

71 posts | 157 followers

Related Products