Added Dockerfile
The server can now be used on Docker
This commit is contained in:
parent
edc3e55ead
commit
958c5db462
17
Dockerfile
Normal file
17
Dockerfile
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
# start by pulling the python image
|
||||||
|
FROM python:3.11
|
||||||
|
|
||||||
|
# copy the requirements file into the image
|
||||||
|
COPY ./requirements.txt /app/requirements.txt
|
||||||
|
|
||||||
|
# switch working directory
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# install the dependencies and packages in the requirements file
|
||||||
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
|
# copy every content from the local file to the image
|
||||||
|
COPY ./flask/ /app
|
||||||
|
|
||||||
|
# configure the container to run in an executed manner
|
||||||
|
ENTRYPOINT [ "uwsgi", "--socket=0.0.0.0:5000", "--protocol=http", "-w", "wsgi:app" ]
|
46
README.md
46
README.md
|
@ -1,10 +1,18 @@
|
||||||
# RAR-Index
|
# RAR-Index
|
||||||
It's some project for my school which is supposed to index _rar_-archives and make them searchable over a very ugly web frontend.
|
It's some project for my school which is supposed to index _rar_-archives and make them searchable over a very ugly web frontend.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- Add and delete archives
|
||||||
|
- edit their labels (as their owner)
|
||||||
|
- search through archives based on:
|
||||||
|
- Keywords
|
||||||
|
- Category
|
||||||
|
- log into a user account
|
||||||
|
|
||||||
## Downloading
|
## Downloading
|
||||||
```bash
|
```bash
|
||||||
git clone https://git.marcelsite.com/marcel/rar-index
|
git clone https://git.marcelsite.com/marcel/rar-index-py
|
||||||
cd rar-index
|
cd rar-index-py
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
@ -23,9 +31,41 @@ Start the server:
|
||||||
```bash
|
```bash
|
||||||
python app.py
|
python app.py
|
||||||
```
|
```
|
||||||
|
This will start the server in a development environment. The Docker image is built with uWSGI for production use.
|
||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
TBA
|
I recommend just using the provided package on this server:
|
||||||
|
```yml
|
||||||
|
version: "2.4"
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: mariadb:latest
|
||||||
|
environment:
|
||||||
|
- MARIADB_USER=rar_index_app
|
||||||
|
- MARIADB_PASSWORD=password
|
||||||
|
- MYSQL_ROOT_PASSWORD=secretadminpassword
|
||||||
|
volumes:
|
||||||
|
- db-data:/var/lib/mysql
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
app:
|
||||||
|
image: git.marcelsite.com/marcel/rar-index-app
|
||||||
|
container_name: rar-index-app
|
||||||
|
environment:
|
||||||
|
- MARIADB_USER=rar_index_app
|
||||||
|
- MARIADB_HOST=db
|
||||||
|
- MARIADB_PASSWORD=password
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
ports:
|
||||||
|
- 5000:5000
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
db-data:
|
||||||
|
|
||||||
|
```
|
||||||
|
This will make the server accessible from anywhere over port 5000.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
I don't recommend wasting your time on this project. It is only created to get a (hopefully) good grade in school.
|
I don't recommend wasting your time on this project. It is only created to get a (hopefully) good grade in school.
|
|
@ -2,13 +2,14 @@
|
||||||
import mariadb as sql
|
import mariadb as sql
|
||||||
from os import environ
|
from os import environ
|
||||||
import time,re
|
import time,re
|
||||||
|
from config import *
|
||||||
|
|
||||||
## params populated with environment variables, defaults can be changed for a permanent solution
|
## params populated with environment variables, defaults can be changed for a permanent solution
|
||||||
conn_params={
|
conn_params={
|
||||||
"user" : environ.get('MARIADB_USER') if environ.get('MARIADB_USER') else MARIADB_USER,
|
"user" : environ.get('MARIADB_USER') if environ.get('MARIADB_USER') else MARIADB_USER,
|
||||||
"password" : environ.get('MARIADB_PASSWORD') if environ.get('MARIADB_PASSWORD') else MARIADB_PASSWORD,
|
"password" : environ.get('MARIADB_PASSWORD') if environ.get('MARIADB_PASSWORD') else MARIADB_PASSWORD,
|
||||||
"host" : environ.get('MARIADB_HOST') if environ.get('MARIADB_HOST') else MARIADB_HOST,
|
"host" : environ.get('MARIADB_HOST') if environ.get('MARIADB_HOST') else MARIADB_HOST,
|
||||||
"database" : environ.get('MARIADB_DB') if environ.get('MARIADB_DB') else MARIAD_DB
|
"database" : environ.get('MARIADB_DB') if environ.get('MARIADB_DB') else MARIADB_DB
|
||||||
}
|
}
|
||||||
|
|
||||||
class db:
|
class db:
|
||||||
|
|
4
flask/wsgi.py
Normal file
4
flask/wsgi.py
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
from app import app
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
app.run()
|
|
@ -1,3 +1,3 @@
|
||||||
flask
|
flask
|
||||||
mariadb
|
mariadb
|
||||||
hashlib
|
uwsgi
|
Loading…
Reference in a new issue