update instructions, add docker compose file for autorestart and local build
parent
f669b899ce
commit
1c1c53497c
|
|
@ -11,6 +11,7 @@ discord_bot/graph.png
|
||||||
discord_bot/config.py
|
discord_bot/config.py
|
||||||
env_win/
|
env_win/
|
||||||
velconnect.db
|
velconnect.db
|
||||||
|
db/
|
||||||
velconnect*.db
|
velconnect*.db
|
||||||
.idea/
|
.idea/
|
||||||
velconnect/data/
|
velconnect/data/
|
||||||
|
|
|
||||||
26
README.md
26
README.md
|
|
@ -1,10 +1,22 @@
|
||||||
## VELConnect API Setup
|
## VELConnect API Setup
|
||||||
|
|
||||||
### Option 1: Pull from Docker Hub:
|
## Option 1: Build and run using Docker Compose
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cd velconnect
|
||||||
|
docker compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
|
and visit http://localhost:8000 in your browser.
|
||||||
|
|
||||||
|
This will set up autorestart of the docker image. To pull updates, just run `docker compose up -d` again.
|
||||||
|
|
||||||
|
## Option 2: Pull from Docker Hub:
|
||||||
|
|
||||||
|
```sh
|
||||||
docker run -p 80:80 velaboratory/velconnect
|
docker run -p 80:80 velaboratory/velconnect
|
||||||
```
|
```
|
||||||
|
|
||||||
and visit http://localhost in your browser.
|
and visit http://localhost in your browser.
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|
@ -12,12 +24,14 @@ or
|
||||||
```sh
|
```sh
|
||||||
docker run -p 8000:80 --name web velaboratory/velconnect
|
docker run -p 8000:80 --name web velaboratory/velconnect
|
||||||
```
|
```
|
||||||
|
|
||||||
to access from http://localhost:8000 in your browser and name the container "web".
|
to access from http://localhost:8000 in your browser and name the container "web".
|
||||||
|
|
||||||
### Option 2: Build Docker Image:
|
## Option 3: Build Docker Image:
|
||||||
|
|
||||||
Make sure you're in the `velconnect/` folder.
|
Make sure you're in the `velconnect/` folder.
|
||||||
```
|
|
||||||
|
```sh
|
||||||
docker build --tag velconnect .
|
docker build --tag velconnect .
|
||||||
docker rm web
|
docker rm web
|
||||||
docker run -p 80:80 --name web velconnect
|
docker run -p 80:80 --name web velconnect
|
||||||
|
|
@ -25,7 +39,8 @@ docker run -p 80:80 --name web velconnect
|
||||||
|
|
||||||
or run `./rebuild.sh`
|
or run `./rebuild.sh`
|
||||||
|
|
||||||
### Option 3: Run Python locally (WSL or native Linux)
|
## Option 4: Run Python locally (WSL or native Linux)
|
||||||
|
|
||||||
1. `cd velconnect`
|
1. `cd velconnect`
|
||||||
2. Create pip env: `python3 -m venv env`
|
2. Create pip env: `python3 -m venv env`
|
||||||
3. Activate the env `. env/bin/activate`
|
3. Activate the env `. env/bin/activate`
|
||||||
|
|
@ -34,7 +49,9 @@ or run `./rebuild.sh`
|
||||||
- Get from some old server
|
- Get from some old server
|
||||||
- Or copy and fill out the values from `config_mysql_template.py`
|
- Or copy and fill out the values from `config_mysql_template.py`
|
||||||
6. Run `./run_server.sh`
|
6. Run `./run_server.sh`
|
||||||
|
|
||||||
- Or set up systemctl service:
|
- Or set up systemctl service:
|
||||||
|
|
||||||
```ini
|
```ini
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=VELConnect API
|
Description=VELConnect API
|
||||||
|
|
@ -50,6 +67,7 @@ or run `./rebuild.sh`
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
```
|
```
|
||||||
|
|
||||||
- Enter the above in `/etc/systemd/system/velconnect.service`
|
- Enter the above in `/etc/systemd/system/velconnect.service`
|
||||||
- `sudo systemctl enable velconnect`
|
- `sudo systemctl enable velconnect`
|
||||||
- `sudo systemctl start velconnect`
|
- `sudo systemctl start velconnect`
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
version: "1.0"
|
||||||
|
services:
|
||||||
|
web:
|
||||||
|
build: .
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "8000:80"
|
||||||
|
volumes:
|
||||||
|
- ./db:/usr/src/velconnect/db
|
||||||
|
|
@ -12,7 +12,7 @@ from enum import Enum
|
||||||
|
|
||||||
import db
|
import db
|
||||||
|
|
||||||
db = db.DB("velconnect.db")
|
db = db.DB("db/velconnect.db")
|
||||||
|
|
||||||
# APIRouter creates path operations for user module
|
# APIRouter creates path operations for user module
|
||||||
router = fastapi.APIRouter(
|
router = fastapi.APIRouter(
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import fastapi
|
||||||
|
|
||||||
import db
|
import db
|
||||||
|
|
||||||
db = db.DB("velconnect.db")
|
db = db.DB("db/velconnect.db")
|
||||||
|
|
||||||
# APIRouter creates path operations for user module
|
# APIRouter creates path operations for user module
|
||||||
router = fastapi.APIRouter(
|
router = fastapi.APIRouter(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue