Deploying Server and Client to Azure VM - Plateful/plateful-mobile GitHub Wiki
This guide will walk you through setting up your server on an Azure virtual machine. We will also cover how to deploy updates to the app.
##Creating a Virtual Machine
- Login to the Azure management portal.
- Select VMs / New / From Gallery
- Select a Ubuntu server image (Ubuntu Server 14.04 LTS)
- Specify a
vm_name
andusername
and check the box to specify apassword
. You can uncheck the SSH Key box.
IMPORTANT: You will need to remember these items. - Your virtual machine will be created, this can take a few minutes to complete.
##Configuring Your Virtual Machine
-
Once your VM has been created login to it form the command line (these are the items you specified above - [email protected] in our case):
ssh <username>@<vm_name>.cloudapp.net
-
You'll be prompted for the password you created above. Enter it and you'll have access to your VM.
-
Follow this guide to install homebrew on your VM. This package will also install some utilities like git on your VM. IMPORTANT: Make sure to navigate to the
.bashrc
and enter the specified lines (brew will not be a recognized command until you do this). You will need to reboot the VM once you've completed these steps:sudo reboot
. -
Intall node:
brew install node
-
Clone your project repo:
https://github.com/Plateful/plateful-mobile.git
-
Navigate to your project directory and run the following commands to install your dependencies:
npm install sudo npm install -g bower // Install bower command line utility sudo npm install -g gulp // Install gulp command line utility sudo npm install -g cordova // Install cordova command line utility cordova plugin add org.apache.cordova.camera //Installs cordova plugins cordova plugin add org.apache.cordova.device cordova plugin add org.apache.cordova.file cordova plugin add org.apache.cordova.file-transfer cordova plugin add org.apache.cordova.geolocation cordova plugin add org.transistorsoft.cordova.background-geolocation gulp // Builds app, runs bower install, server and static server.
Once this process is complete your app should be up and running.
-
Next you need to install forever, so you can continuously run your server and client:
sudo npm install forever forever start server/app.js forever start server/staticServer.js
To view a list of forever tasks running: forever list
To stop a task (use the index number of the task to stop): forever stop 0
-
Your VM is configured. Go ahead and log out. The last thing you'll need to configure is your ports, so you can access your server and app:
azure vm endpoint create-multiple <vm_name> 9000:9000 // Set-up server port azure vm endpoint create-multiple <vm_name> 4400:4400 // Set-up client port
##Deploying Updates
-
Once the project master is production-grade and ready for deployment, login to your VM.
-
From your project directory pull down the changes:
git pull --rebase origin master
-
Stop your forever processes:
forever stopall
-
Run the following commands to install new dependencies and build your app:
npm install gulp
-
Finally restart your forever server:
forever start server/app.js forever start server/staticServer.js