1
0
forked from crony/UpFast

Compare commits

..

4 Commits

Author SHA1 Message Date
Raymaekers Luca
a5df50f43c Merge branch 'installation' into mine 2023-04-04 18:53:40 +02:00
Raymaekers Luca
b376d91e21 extracted nginx conf into file 2023-04-04 18:52:14 +02:00
Raymaekers Luca
da70b22fdf added upfast.sh for quick install and upfast.service 2023-04-04 18:47:37 +02:00
Raymaekers Luca
7c593f2fc2 renamed venv to env 2023-04-04 18:46:26 +02:00
5 changed files with 56 additions and 4 deletions

2
.gitignore vendored
View File

@ -1,3 +1,3 @@
__pycache__ __pycache__
upload upload
venv env

View File

@ -23,9 +23,9 @@ cd
git clone https://code.cronyakatsuki.xyz/crony/upfast . git clone https://code.cronyakatsuki.xyz/crony/upfast .
# Create the virtual environment and load it for user on default # Create the virtual environment and load it for user on default
python3 -m venv venv python3 -m venv env
# Activate the virtual environment # Activate the virtual environment
source venv/bin/activate source env/bin/activate
# Install all the requirements # Install all the requirements
pip install -r requirements.txt pip install -r requirements.txt
@ -52,7 +52,7 @@ Documentation=https://code.cronyakatsuki.xyz/crony/upfast
User=upfast User=upfast
Group=upfast Group=upfast
WorkingDirectory=/usr/local/upfast/ WorkingDirectory=/usr/local/upfast/
ExecStart=/usr/local/upfast/venv/bin/uvicorn main:app --host 127.0.0.1 --port 8000 --proxy-headers --forwarded-allow-ips='*' ExecStart=/usr/local/upfast/env/bin/uvicorn main:app --host 127.0.0.1 --port 8000 --proxy-headers --forwarded-allow-ips='*'
Restart=on-failure Restart=on-failure
``` ```
Finally run following commmands. Finally run following commmands.

15
upfast-nginx Normal file
View File

@ -0,0 +1,15 @@
server {
listen 80;
listen [::]:80;
server_name upfast.example.com ;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
proxy_buffering off;
}
}

10
upfast.service Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=UpFast service
Documentation=https://code.cronyakatsuki.xyz/crony/upfast
[Service]
User=upfast
Group=upfast
WorkingDirectory=/usr/local/upfast/
ExecStart=/usr/local/upfast/env/bin/uvicorn main:app --host 127.0.0.1 --port 8000 --proxy-headers --forwarded-allow-ips='*'
Restart=on-failure

27
upfast.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/sh
# quick install (and run) script for upfast using systemd
if [ $EUID -ne 0]
then
echo "Please run as root"
exit 1
fi
cp ./upfast.service /etc/systemd/system/upfast.service
useradd --shell /bin/sh --system --home-dir /usr/local/upfast upfast
mkdir -p /usr/local/upfast # dodge copying of skeletons
chown upfast:upfast /usr/local/upfast
chmod 700 /usr/local/upfast
su upfast -c'
cd
git clone https://git.craftmenners.men/upfast .
python3 -m venv env
. ./env/bin/activate
pip install -r requirements.txt
mkdir upload'
systemctl enable --now upfast.service