DevOps

Deploy Oracle JET Web App on Application Container Cloud

There’s a few examples on the net about how to deploy a JET app to Application Container Cloud. All of these seem to either create an express app and then add oracle code to it later (eliminating the benefit of using grunt serve) or taking the compiled web folder and putting it into a new express application (making your devops or build automation slightly more painful). Let me show you an alternative.

Add the following to server.js in the root directory.

var http = require('http')
var url = require('url')
var fs = require('fs')
var path = require('path')
var baseDirectory = __dirname + '/web'

var port = process.env.PORT || 8000;

http.createServer(function (request, response) {
	try {
		var requestUrl = url.parse(request.url)
		if (requestUrl.pathname == '/') requestUrl.pathname = '/index.html';
  	// need to use path.normalize so people can't access directories underneath baseDirectory
   	var fsPath = baseDirectory+path.normalize(requestUrl.pathname)

  	response.writeHead(200)
  	var fileStream = fs.createReadStream(fsPath)
   		fileStream.pipe(response)
   		fileStream.on('error',function(e) {
    	response.writeHead(404)     // assume the file doesn't exist
    	response.end()
  	})
 	} catch(e) {
 		response.writeHead(500)
   	response.end()     // end the response so browsers don't hang
   	console.log(e.stack)
 	}
}).listen(port)

This uses the basic http module in Node to create a very simple http server to serve our JET code from the web directory. If you run this using node server.js you should see your node app running, just like if you used grunt serve

You will also need to create a manifest.json file (and optional deployment.json file) to ensure ACC understands your request. The manifest file should look something like this:

{
	"runtime" : {
		"majorVersion": "0.12"
	},
	"command" : "node server.js",
	"release" : {},
	"notes" : "Notes"
}

Now just upload this to ACC (use github.com/Joelith/acc-deploy to make life easier for yourself).

This approach means you can continue to run grunt serve locally as part of your build process and you can still use the same app folder to deploy to ACC.

Advertisements
Cloud, DevOps, Technical

Automated Moodle Deployment on the Oracle Cloud + DevOps

Was recently helping a customer deploy Moodle on the Oracle Cloud with a focus on how to do this in automated way with Developer Cloud Service. I thought I’d share my experience in case anyone else is trying to do something similar.

Goal

We want to deploy Moodle (which is a PHP application that uses MySQL) on the Oracle Cloud and we want the build to be automatically triggered every night (so we can test it fresh).

Continue reading

DevOps

Oracle Application Container Cloud – Ruby Support

The latest version of Oracle’s Application Development Platform was just released and with it bring’s Ruby support for Application Container Cloud Service! As a fan of ruby (scaffolding is the best!) this is great news. The ruby image comes from DockerHub, so in future we should hopefully receive a lot more languages.

Along with Java, Node, PHP, Python and now Ruby ACC is turning into a great polyglot development platform. I haven’t had a chance to play with it much, but once I get some of my ruby apps running I’ll post an update. In the meantime, here’s some screenshots to whet your appetite.

acc_ruby_1
Your current language choices
acc_ruby_2
The configuration for the container