Deploy your first PHP application on Mobingi Cloud in 5 minutes

Wayland Zhang
5 min readNov 30, 2015

--

Hey folks, I have an advent calendar schedule on Qiita(Japanese version of Stackoverflow) to post an article about how to start with mocloud.io — our PaaS product, for developers, so i’m wrapping up everything tonight on my own blog.

To deploy your project on mocloud.io is extremely simple and straightforward if you host your code on GitHub (It works for both private repo or public repo). All you need to have is an account on mocloud.io and your code on GitHub, Ok let’s get started.

First, login to the mocloud Dashboard, https://mocloud.io/login

Then, click on the “Create new” button on the left navigation menu. You will see the web interface showing you the cloud environment configuration page.

If you’re a devOps/programmer then that looks super familiar to you, right? If you are a product manager/designer, no problem, I’ll just walk through every fields for you:

  • Application Name fill in whatever you want (eg. “my first app”)
  • Subdomainyou can leave it blank :)
  • Regionchoose a datacenter region
  • Instance Typepick a server type for your app
  • Auto-scaling by defining the range, your stack will be configured with load-balancers, and it will automatically scales your servers up and down based on the traffic or server load. (If you are a free-tier user, this feature is disabled)

Next, select a pre-configured server Image (we’re still adding lots of different image boxes, or optionally you can provide your own customized Docker image). In this tutorial, let’s click on PHP Stack.

Then click on the large button at the bottom, “Start Deploy” to kick start your first server stack on mocloud.io.

You’ll see this page. Yes, it’s done here! Now, you can sit back and grab a cup of coffee. The automation software is doing all of the dirty works behind the scene.

In details, it will prepare the hardwares, build the environment, load-balancers, operating system, IP tables for security groups, VPC, monitoring services and many other pieces which are necessary for your application’s production environment. And please note here, that the server topology is that all of your resources are isolated from other users’, and there is no virtualization on your physical servers. We run a daemon we called moDaemon on each instance to handle all of the infrastructure level jobs.

It takes only couple minutes to build up your environment, and after its done, you can open the Dashboard to interact with your instances via the web based interface. (We also provide RESTful API)

After your stack is fully deployed, you can see the indicator icon turns to green and shows “running” state. Click on the application you just created, and you see this page.

It tells you:

Now, let’s deploy our PHP code to the machines. I forked an open-source sample PHP project to my own GitHub account, so I’m going to deploy this repo to the servers I just created.

Open the second tab “Deploy Code” on your Dashboard again. You will see the guide to lead you to a GitHub’s authorization page, just follow the instruction to allow moCloud to connect to your GitHub account and then head back to the “Deploy Code” tab, you’ll be able to select your public/private repos and deploy any of them to your moCloud servers.

Click on the “Connect” button, and you’re done! moCloud will grab the code from your GitHub’s repo and deploy to all instances that running within your application. Woohoo that’s easy isn’t it?!

You’ll see the “Status” of each instances changed from “running” to “restarting”, this indicates that the server is in the process of deploying your code. Note that Mobingi implements Blue/Green deployments that takes no down-time of your environment.

It’s running!!

Open the link again, you’ll see the code is successfully running and showing you the sample PHP website! (Do you actually need to know server-side programming? — No, not with Mobingi!)

Future more, there are many cool features for you to discover, trust me they’re awesome (tho we’re still improving features like add-ons and better monitoring):

  • change auto-scaling range
  • server monitoring
  • real-time logs
  • audit
  • environment variables
  • custom Docker images
  • default HTTPS connections for load-balanced stacks
  • ssh key-pairs
  • etc..

--

--