forked from crony/UpFast
Compare commits
No commits in common. "76963bcd889ec70136f8deb3c81ab209f54274f9" and "b376d91e21805a000c6ad242a501f47908729e5b" have entirely different histories.
76963bcd88
...
b376d91e21
77
README.md
77
README.md
@ -10,20 +10,60 @@ To run on a regular system I recommend to use a virtual environment to install t
|
|||||||
|
|
||||||
We will also be setting up an specific user to run the app as safe as possible with a systemd service file for startup
|
We will also be setting up an specific user to run the app as safe as possible with a systemd service file for startup
|
||||||
|
|
||||||
#### Installing
|
|
||||||
```bash
|
```bash
|
||||||
./install.sh
|
# Create the user (You can specify a different home-dir)
|
||||||
|
sudo useradd --shell /bin/bash --system \
|
||||||
|
--home-dir "/usr/local/upfast" -m upfast
|
||||||
|
|
||||||
|
# Change to upfast user and go to upfast dir
|
||||||
|
su upfast
|
||||||
|
cd
|
||||||
|
|
||||||
|
# Clone the project directly into upfast-src directory
|
||||||
|
git clone https://code.cronyakatsuki.xyz/crony/upfast .
|
||||||
|
|
||||||
|
# Create the virtual environment and load it for user on default
|
||||||
|
python3 -m venv env
|
||||||
|
# Activate the virtual environment
|
||||||
|
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
|
||||||
|
|
||||||
|
# UpFast go brrr
|
||||||
|
uvicorn main:app --host 127.0.0.1 --port 8000 --proxy-headers --forwarded-allow-ips='*'
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Running
|
#### Autostart with systemd
|
||||||
|
|
||||||
|
To autostart with systemd you will need to create a systemd .service file in path `/etc/systemd/system/upfast.service` and add this content to it.
|
||||||
|
|
||||||
|
```systemd
|
||||||
|
[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
|
||||||
|
```
|
||||||
|
Finally run following commmands.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
systemctl start upfast.service
|
# refresh services
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
# enable the service
|
||||||
|
sudo systemctl enable upfast.service
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Start on boot
|
|
||||||
```bash
|
|
||||||
systemctl enable upfast.service
|
|
||||||
```
|
|
||||||
### Docker
|
### Docker
|
||||||
|
|
||||||
In the repo there is an included dockerfile to generate an image from the latest version of everything, to generate an image just run `docker build . -t upfast` (You need root privileges or to be in the docker group).
|
In the repo there is an included dockerfile to generate an image from the latest version of everything, to generate an image just run `docker build . -t upfast` (You need root privileges or to be in the docker group).
|
||||||
@ -40,7 +80,22 @@ The sample command will need an upload directory, you can replace `./upload` wit
|
|||||||
### Nginx Proxy setup
|
### Nginx Proxy setup
|
||||||
|
|
||||||
This is an example nginx proxy config for http
|
This is an example nginx proxy config for http
|
||||||
```bash
|
|
||||||
cp ./upfast-nginx /etc/nginx/sites-available/upfast
|
```nginx
|
||||||
ln -sf /etc/nginx/sites-available/upfast /etc/nginx/sites-enabled/
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
@ -8,6 +8,3 @@ Group=upfast
|
|||||||
WorkingDirectory=/usr/local/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='*'
|
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
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
|
@ -7,6 +7,8 @@ then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
cp ./upfast.service /etc/systemd/system/upfast.service
|
||||||
|
|
||||||
useradd --shell /bin/sh --system --home-dir /usr/local/upfast upfast
|
useradd --shell /bin/sh --system --home-dir /usr/local/upfast upfast
|
||||||
mkdir -p /usr/local/upfast # dodge copying of skeletons
|
mkdir -p /usr/local/upfast # dodge copying of skeletons
|
||||||
|
|
||||||
@ -22,5 +24,4 @@ python3 -m venv env
|
|||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
mkdir upload'
|
mkdir upload'
|
||||||
|
|
||||||
cp ./upfast.service /etc/systemd/system/upfast.service
|
systemctl enable --now upfast.service
|
||||||
systemctl daemon reload
|
|
Loading…
Reference in New Issue
Block a user