Opened 2 months ago

Last modified 2 months ago

#15056 assigned Question/How do I...?

need root control of apache to run Flask

Reported by: Dave Britton Owned by: JaimeV
Priority: Medium Component: Tech
Keywords: Flask, Python Cc: Jamie McClelland
Sensitive: no

Description

I dislike PHP (believing that logic should be separated from presentation, and that PHP is chronically insecure) and would like to use Flask to enable me to have an Apache WSGI interface to Python using Jinja2 templates for my web pages. What do I need to do to arrange this, since my ssh access does not have sudoer privileges, thus keeping me from governing my own Apache web server configuration? I see on the new control panel's advanced page that there is a location to enter what would appear to be Apache configuration commands, which presumably would be placed into my web domain's Virtual Host section, but that will still not let me install the Flask Python library (e.g. "sudo pip install Flask"), and if/when I need to restart Apache while debugging my application code, I probably can't do that either. Is it possible to set up a virtual environment in which I can run another instance of Apache that I control, and have requests for my domain automatically redirected to this instance, which would have to be run on a different port, so that web browser requests to https://amilcar.altout.net/ would get sent to that port instead of port 443? Or perhaps there are other solutions Thanks! Dave Britton

Change History (1)

comment:1 Changed 2 months ago by JaimeV

Cc: Jamie McClelland added
Owner: set to JaimeV
Status: newassigned

Hi David, we don't provide root access on servers that are shared by members but we do provide root access for members who request their own virtual private server. A dedicated VPS may be an inefficient use of resources for running a single website so the following scenario is what has worked for us in the past for members who have had similar goals as yourself.

We can install any additional system libraries and packages for you upon request. Logging into the console as your own user, python should allow you to create a virtual environment for installing libraries unique to your application. Configure your python flask application to run and listen for connections on a unique port, not 443 or 80 directly.

You are correct that the web configurations you can modify through the control panel will become a virtual host file for the apache2 web server. You can add a line to the advanced configuration like ProxyPass / http://localhost:3000/ to forward to whatever port your application will be listening on. This also allows you to enable https in the web configuration so external users can use a secure https connection and those connections proxied to your app locally over http.

Some of the challenges with this setup are finding ways to ensure your app runs continually and is restarted in case of a server reboot. I think there are solutions for this and we can address those as we go.

Last edited 2 months ago by JaimeV (previous) (diff)

Please login to add comments to this ticket.

Note: See TracTickets for help on using tickets.