1
0
forked from crony/UpFast

added new way of installing with script!

This commit is contained in:
Raymaekers Luca 2023-04-04 18:37:35 +02:00
parent 9f8afe5054
commit 5d47eb3243
3 changed files with 40 additions and 6 deletions

View File

@ -23,15 +23,12 @@ cd
git clone https://code.cronyakatsuki.xyz/crony/upfast .
# Create the virtual environment and load it for user on default
python3 -m venv venv
python3 -m venv env
# Activate the virtual environment
source venv/bin/activate
source env/bin/activate
# Install all the requirements
pip install -r requirements.txt
# Load environment by default
echo "source /usr/local/upfast/venv/bin/activate" > "/usr/local/upfast/.profile"
# create the upload directory
mkdir upload
@ -52,7 +49,7 @@ Documentation=https://code.cronyakatsuki.xyz/crony/upfast
User=upfast
Group=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
```
Finally run following commmands.

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