Deploy MCS Code from the Command Line

Deploying custom code to the Oracle Mobile Cloud Service can be a lesson in frustration. You have to download the scaffold, write your code, zip it up and then upload that using the Web UI. You quickly get into the flow of doing this, but if you need to check logs or look at any other screen in MCS you will have to re-navigate back to the implementation screen over and over again.

Turns out that the MCS team has created a command-line npm tool to help with. This may be obvious to some, but it’s not highlighted well enough in my opinion! So to help others with this issue, let me show you how we use it.

First download any of the MCS SDKs and the navigate on the command line to the mcs-deploy folder. Then simply run npm install -g to install the mcs-deploy programme into your path.

Now navigate to your MCS project and make sure you’ve filled out the toolsConfig.json file. At a minimum you want to add the baseUrl and authorization parameters (they will have placeholders initially). This should be easy enough to fill in, most of the parameters are in the settings page of your mobile backend.

With that done, to upload your code just run the following on your command line (from within the implementation code folder):

mcs-deploy toolsConfig.json -u <username> -p <password>

This programme will package up your code and send it to MCS using the REST APIs. You can optionally leave off the username and password details and it will ask you for those interactively. It would be great if mcs-deploy could read these from a configuration file (say ~/.mcs-deply, much like my equivalent deploy tool for Application Container Cloud). That way you could include the script in your build tools without having to hard-code or change credentials.

This has already saved me a heap of time!

If the MCS Devs are reading this, it would be great if the mcs-deploy code was a proper npm package. It would mean we could install this just using npm install -g mcs-deploy (without having to download the SDK). 


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s