Little project for managing spam-related text and comments.
You can check this API at https://pashok11.tw1.su/apis/yoas/docs
(For now tested only on Linux and Docker, Python 3.11.1, 3.12.4, 3.13.1)
Note: if Docker doesn't working, try this:
systemctl start docker.socket
- for desktopsystemctl start docker.service
- for server
Create .KEY
file in main directory with KEY=string
any string you want. This key would be used for adding and deleting users from the database. API doesn't run without it.
After this you have several ways to run an API:
- Docker Compose:
- Copy
.env.example
to.env
and edit it. docker compose up
- start Docker Compose. You can add-d
for run start it in background.docker compose down
- stop Docker Compose. You can add--rmi local
for delete related to compose images (only created by compose, not by pulling from docker hub), containers and networks.
- Copy
- Docker:
- Optional: Copy
.env.example
to.env
and edit it. docker volume create yoas-api_yoas
- create a volume for the database (name it like this for simple migrate to Docker Compose).docker build -t yoas .
for building an image.docker run -p 8000:8000 --mount type=volume,src=yoas-api_yoas,target=/app/db_n_logs --env-file .KEY --name yoas_container yoas
- run a container with nameyoas_container
, with publishing8000
port, mounting a volumeyoas-api_yoas
to the/app/db_n_logs
directory in a container and using.KEY
environment file. You can add-d
for run it in background,--rm
for deleting container when it exits and-e HOST=0.0.0.0 -e PORT=8000
for setting environment variables for a container (especially if you don't do anything with.env
file).- Stop container with
docker stop yoas_container
for just stop a container,docker rm -f yoas_container
for stop and delete a container or just pressCtrl+C
if it in foreground to stop it.
- Optional: Copy
- Bash scripts:
- Optional: Copy
.env.example
to.env
and edit it. - Set
HOST
andPORT
environment variables to what you want (HOST=0.0.0.0 && PORT=8000
) or edit./start.sh
(or./start_dev.sh
). - Run
./start.sh
(or./start_dev.sh
for development). If you can't run it - make script executable (chmod +x start.sh
).
- Optional: Copy
- or any other common way to run FastAPI app, like
fastapi run main.py --host 0.0.0.0 --port 8000
oruvicorn main:app --host 0.0.0.0 --port 8000
.