add new installer
This commit is contained in:
parent
e04959e7ae
commit
e66179a267
13
install.sh
13
install.sh
@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if ! command -v python3 &> /dev/null
|
|
||||||
then
|
|
||||||
echo "Error: python3 could not be found"
|
|
||||||
exit
|
|
||||||
else
|
|
||||||
python3 -m venv venv
|
|
||||||
source venv/bin/activate
|
|
||||||
pip install Flask
|
|
||||||
pip install flask_jwt_extended
|
|
||||||
chmod +x run.sh
|
|
||||||
fi
|
|
||||||
29
installer.sh
Normal file
29
installer.sh
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# Clone the repository
|
||||||
|
git clone https://git.maxprint.io/MaxApex/ticket_ai_flask_app.git /opt/ticket-ai
|
||||||
|
|
||||||
|
# navigate to the repo
|
||||||
|
cd /opt/ticket-ai
|
||||||
|
|
||||||
|
# Create virtual environment
|
||||||
|
python3 -m venv /opt/ticket-ai/venv
|
||||||
|
|
||||||
|
# Activate virtual environment and install Flask and flask_jwt_extended
|
||||||
|
source /opt/ticket-ai/venv/bin/activate
|
||||||
|
pip install Flask
|
||||||
|
pip install flask_jwt_extended
|
||||||
|
|
||||||
|
# Create systemd service file
|
||||||
|
cat <<EOF > /etc/systemd/system/ticket-ai.service
|
||||||
|
[Unit]
|
||||||
|
Description=Ticket AI
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=/opt/ticket-ai/venv/bin/python3 /opt/ticket-ai/src/app.py
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Start the service
|
||||||
|
systemctl start ticket-ai.service
|
||||||
@ -44,7 +44,7 @@ def login():
|
|||||||
def get_logs():
|
def get_logs():
|
||||||
issue_type = request.args.get("issue_type")
|
issue_type = request.args.get("issue_type")
|
||||||
try:
|
try:
|
||||||
with open('./src/config.json') as config_file:
|
with open('/opt/ticket-ai/src/config.json') as config_file:
|
||||||
config = json.load(config_file)
|
config = json.load(config_file)
|
||||||
if issue_type not in config:
|
if issue_type not in config:
|
||||||
return jsonify({"error": "Invalid issue type"})
|
return jsonify({"error": "Invalid issue type"})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user