Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site











SourceForge.net Logo

Deploying Skylark application

 

This text consist of summarized experiences of a person with a very little web-serving experience. Therefore, some of the described methods might not be the most efficient ones and the terminology might be slightly inaccurate. However, all of the solutions here were tested and proved to work.

 


1. Simplest - all work is done by U++

 

If you want to have only simple web app that performs its task on dedicated address (i.e. there is nothing else, like web pages or other apps). Let's say we want to have myapp running on http://example.com/. For this you should configure root to empty string and set port to 80:

 

port=80;

root="";

 

Now everything you need to do is compile the application, copy it anywhere on the example.com server. Also, copy all the static files your application needs and all the witz templates. Those should be placed in a directory with path matching that in the code (e.g. if you have "http.RenderResult("myapp/templates/index.witz")" in your code, you should place the template in directory myapp/templates/). Make sure that the path variable is set correctly to point to the directories where you placed the witz templates and other static files. For the example above it would be to directory in which directory myapp can be found.

 

Now log to this remote server, and simply run the binary:

 

cd /path/to/myapp

nohup ./myapp &> myapp.log &

 

The nohup command prevents the application to close when you log off.

 

Depending on what you need from the application you might want to use some autoresurrecting mechanism that relaunches the application in case it crashes (there is many, search the web).

 


2. Using Nginx as a proxy

 

Now lets assume that your application myapp is only part of larger website, that is running on Nginx server. Alternatively, you can use this also when you just want to make things little bit faster and simpler by serving the static files (images, scripts etc.) by Nginx without processing the requests in myapp itself.

 

We will furthermore assume that you have Nginx already up and running (even the default settings in most of distributions is OK) and that your application is configured with

 

port=8001;

root="myapp";

 

All you have to do to make Nginx proxy all the requests to it is to add following in the nginx configuration file (usually located at /etc/nginx/nginx.conf), in the server section:

 

location /myapp {

    proxy_pass http://localhost:8001;

    proxy_set_header X-Forwarded-For $remote_addr;

}

 

To make it serve static files directly, you have to add one more location rule:

 

location /myapp/static {

    alias /path/to/static;

}

 

This configuration assumes that all the static files are referenced as /myapp/static/somepath/file.ext, if you have them scattered over multiple directories, just add one rule for each.

 

Now make sure the application is running (see paragraph 1 on how to launch it) and reload nginx configuration (if it is running already, otherwise use "start" instead of "reload"):

 

/etc/init.d/nginx reload

 


2. Using Apache as a proxy

 

You can also use Apache web server in the same way as Nginx was used in previous paragraph. The only difference is in configuration. To make Apache work as proxy for myapp, add following two lines in the apache configuration file (usually /etc/httpd/conf/httpd.conf):

 

ProxyPass         /myapp http://localhost:8001/myapp

ProxyPassReverse  /myapp http://localhost:8001/myapp

 

For direct serving of static files you can add this above the previous two lines:

 

<Directory /tmp/static>

       Allow from all

</Directory>

 

ProxyPass         /myapp/static/ !

Alias             /myapp/static /tmp/static

 

Reloading the Apache configuration works similar to nginx (again, use "start" instead of "reload" if the server is not running yet):

 

/etc/init.d/httpd reload

 

Last edit by cxl on 09/30/2012. Do you want to contribute?. T++