Skip to content

Hosting a web app in the cloud

Almar Klein edited this page Jul 7, 2016 · 6 revisions

You can use Amazon EC2, Azure, or Google App Engine to host Flexx webs. This is a little guide to help you do that. It is assumed that you have SSH access to a Linux machine.

Setting the machine up

Installing Flexx should be as easy as:

$ python3 -m pip install flexx --upgrade

Or if you're using conda:

$ conda install flexx -c conda-forge

If you want the bleeding edge:

$ python3 -m pip install tornado
$ sudo apt-get install git-all
$ git clone https://github.com/zoofIO/flexx.git
$ cd flexx

Start hosting an app

You can start a demo server using:

$ python3 ~/flexx/ui/examples/serve_multiple1.py --flex-host=0.0.0.0 --flexx-port=8080

The host and port settings can also be set in ~/.flexx.cfg or using environment variables FLEXX_HOST and FLEXX_PORT.

Note that server will shutdown when you close the SSH connection. Therefore, use this to create a persistent server process:

$ nohup python3 ~/flexx/ui/examples/serve_multiple1.py --flex-host=0.0.0.0 --flexx-port=8080

To check and stop a running server, make a new ssh connection and do:

$ python3 -m flexx info 8080 
$ python3 -m flexx stop 8080

Hosting on port 80

I think you need to run this after each reboot.

sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080