-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f268784
Showing
34 changed files
with
6,367 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
localhost, snatch.flipdot.org { | ||
handle_path /static/* { | ||
root * /mnt/static | ||
file_server | ||
} | ||
|
||
handle_path /media/* { | ||
root * /mnt/media | ||
file_server | ||
} | ||
|
||
handle_path /api/* { | ||
reverse_proxy api:8000 | ||
} | ||
|
||
handle { | ||
reverse_proxy frontend | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# SNATCH | ||
|
||
Surveillance Network for Auto Tag Capture and Hunting | ||
|
||
## Overview | ||
|
||
SNATCH is a tool for capturing car license plates by manual human input. | ||
It allows to record when a car passes by a certain location. | ||
|
||
It only saves the license plate temporarily and in a hashed form. | ||
|
||
## Setup | ||
|
||
``` | ||
docker-compose up --build -d | ||
# visit http://localhost | ||
``` | ||
|
||
## Development | ||
|
||
### Frontend | ||
|
||
``` | ||
cd frontend | ||
npm i | ||
npm run dev | ||
npm run format # reformats the code | ||
``` | ||
|
||
### Backend | ||
|
||
``` | ||
cd backend | ||
poetry install | ||
poetry shell | ||
uvicorn main:app --reload | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM python:3.10-slim | ||
|
||
ENV POETRY_HOME="/opt/poetry" | ||
ENV POETRY_VERSION=1.4.2 | ||
RUN pip install poetry==$POETRY_VERSION | ||
ENV PATH="$POETRY_HOME/bin:$PATH" | ||
|
||
WORKDIR /app | ||
|
||
COPY pyproject.toml . | ||
COPY poetry.lock . | ||
RUN poetry install --only main | ||
|
||
COPY . . | ||
|
||
ENTRYPOINT ["poetry", "run"] | ||
|
||
CMD ["uvicorn", "--host", "0.0.0.0", "--root-path", "/api", "main:app"] | ||
EXPOSE 8000 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from fastapi import FastAPI | ||
|
||
app = FastAPI() |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[tool.poetry] | ||
name = "snatch" | ||
version = "0.1.0" | ||
description = "" | ||
authors = ["soerface <[email protected]>"] | ||
license = "AGPL-3.0-only" | ||
readme = "README.md" | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.10" | ||
fastapi = "^0.97.0" | ||
redis = "^4.5.5" | ||
uvicorn = "^0.22.0" | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
pytest = "^7.3.2" | ||
black = "^23.3.0" | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
services: | ||
api: | ||
build: | ||
context: ./backend | ||
volumes: | ||
- .:/code | ||
environment: | ||
- REDIS_URL=redis://db:6379/0 | ||
depends_on: | ||
- db | ||
frontend: | ||
build: | ||
context: ./frontend | ||
depends_on: | ||
- api | ||
db: | ||
image: redis:7-alpine | ||
command: redis-server --save 60 1 --loglevel warning | ||
volumes: | ||
- redis-data:/data | ||
healthcheck: | ||
test: [ "CMD", "redis-cli", "ping" ] | ||
interval: 5s | ||
timeout: 5s | ||
retries: 5 | ||
caddy: | ||
image: caddy:2.4.5-alpine | ||
ports: | ||
- "80:80" | ||
- "443:443" | ||
volumes: | ||
- "./Caddyfile:/etc/caddy/Caddyfile" | ||
- "caddy-data:/data" | ||
- "static_files:/mnt/static" | ||
# - "media_files:/mnt/media" | ||
depends_on: | ||
- api | ||
- frontend | ||
volumes: | ||
redis-data: | ||
caddy-data: | ||
static_files: | ||
# media_files: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module.exports = { | ||
env: { browser: true, es2020: true }, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:react-hooks/recommended', | ||
], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' }, | ||
plugins: ['react-refresh'], | ||
rules: { | ||
'react-refresh/only-export-components': 'warn', | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM node:20-alpine as build | ||
USER node | ||
WORKDIR /home/node | ||
|
||
COPY --chown=node package.json package-lock.json ./ | ||
RUN npm ci | ||
|
||
COPY --chown=node . ./ | ||
RUN npm run build | ||
|
||
FROM ghcr.io/nikeee/docker-nginx-spa:latest | ||
WORKDIR /app | ||
|
||
COPY --from=build /home/node/dist /app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/snatch.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>SNATCH</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.