sudo apt update
sudo apt install python3 python3-pip -y
sudo apt install git -y
git clone https://github.com/bambangirawans/marketxmind.git
cd marketxmind
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
- Edit
config.py
with appropriate settings.
sudo apt install nginx -y
sudo nano /etc/nginx/sites-available/marketxmind
server {
listen 80;
server_name your_domain_or_IP;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
sudo ln -s /etc/nginx/sites-available/marketxmind /etc/nginx/sites-enabled
sudo nginx -t
sudo systemctl restart nginx
flask db init
flask db migrate
flask db upgrade
pip install gunicorn
gunicorn --bind 0.0.0.0:8000 wsgi:app
sudo nano /etc/systemd/system/marketxmind.service
[Unit]
Description=Gunicorn instance to serve marketxmind
After=network.target
[Service]
User=ubuntu
Group=www-data
WorkingDirectory=/path/to/marketxmind
Environment="PATH=/path/to/marketxmind/venv/bin"
ExecStart=/path/to/marketxmind/venv/bin/gunicorn --workers 3 --bind unix:marketxmind.sock -m 007 wsgi:app
[Install]
WantedBy=multi-user.target
sudo systemctl start marketxmind
sudo systemctl enable marketxmind