tradingview-webhooks-bot icon indicating copy to clipboard operation
tradingview-webhooks-bot copied to clipboard

Request: Please add install instructions with Apache

Open JDJoe opened this issue 5 years ago • 1 comments

  1. Directory structure
  2. if any files need to be edited (#8)
  3. if any files need to be moved
  4. sample Apache virtual host config

Something like:

<VirtualHost *:80>
		ServerName mywebsite.com
		ServerAdmin [email protected]
		WSGIScriptAlias / /var/www/FlaskApp/flaskapp.wsgi 
		<Directory /var/www/FlaskApp/FlaskApp/>
			Order allow,deny
			Allow from all
		</Directory>
		Alias /static /var/www/FlaskApp/FlaskApp/static
		<Directory /var/www/FlaskApp/FlaskApp/static/>
			Order allow,deny
			Allow from all
		</Directory>
		ErrorLog ${APACHE_LOG_DIR}/error.log
		LogLevel warn
		CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

JDJoe avatar Jan 21 '20 13:01 JDJoe

I used this as help https://dev.to/sm0ke/flask-deploy-with-apache-on-centos-minimal-setup-2kb7 and I got it up and running on with Apache on Ubuntu VPS at digitalocean.

BTW, I had to rename the webhook-bot.py to webhookbot.py because hyphen was causing problems.

flaskapp.wsgi looks like this:

#!/usr/bin/python
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/FlaskBot/") 

from webhookbot import app as application
application.secret_key = 'putsomethinghere'

wsgi.py looks like this:

#!/usr/bin/env python

import sys
import site

site.addsitedir('/var/www/FlaskBot/lib/python3.6/site-packages')

sys.path.insert(0, '/var/www/FlaskBot')

from webhookbot import app as application

your apache vhost conf needs:

...
               WSGIDaemonProcess hitme user=www-data group=www-data threads=2
                WSGIScriptAlias / /var/www/FlaskBot/wsgi.py
                <Directory /var/www/FlaskBot/>
                        Order allow,deny
                        Allow from all
                </Directory>
...

You probably want to create a new user just for this app and chown the files and change it in your apache config file.

JDJoe avatar Jan 21 '20 16:01 JDJoe