11 Commits
2.0.0 ... 0.4.0

Author SHA1 Message Date
0988d53231 Bump versions and remove sentry
Some checks failed
release-tag / release-image (push) Failing after 4m26s
2024-07-01 21:10:07 +02:00
Marijn Doeve
02d225f2b2 Update dependencies
All checks were successful
release-nightly / release-image (push) Successful in 21m55s
2024-04-12 11:19:52 +02:00
89613e7b2a Update deps, makefile and compose config
All checks were successful
release-nightly / release-image (push) Successful in 18m52s
2023-09-24 21:20:37 +02:00
82f3f33478 Better css
Some checks failed
release-nightly / release-image (push) Has been cancelled
release-tag / release-image (push) Failing after 19m18s
2023-09-12 23:42:51 +02:00
b82724664e Add new index page
All checks were successful
release-nightly / release-image (push) Has been cancelled
release-tag / release-image (push) Successful in 20m28s
2023-09-05 00:07:21 +02:00
20535317c7 Update .gitea/workflows/release-tag.yml
All checks were successful
release-nightly / release-image (push) Successful in 17m29s
release-tag / release-image (push) Successful in 19m44s
2023-08-22 09:22:12 +02:00
4c94209a45 Update .gitea/workflows/release-nightly.yml 2023-08-22 09:21:43 +02:00
f97426956a Boring cache
Some checks failed
release-nightly / release-image (push) Failing after 18m20s
2023-08-22 08:50:40 +02:00
fa067061b3 Cache again
Some checks failed
release-nightly / release-image (push) Failing after 17m29s
2023-08-21 23:59:34 +02:00
cfa0055488 More!
Some checks failed
release-nightly / release-image (push) Failing after 17m30s
2023-08-21 23:15:53 +02:00
27437c87ac New Deploy action 2023-08-21 23:03:42 +02:00
13 changed files with 1012 additions and 813 deletions

View File

@@ -1,51 +0,0 @@
name: release-nightly
on:
push:
branches: [ main ]
jobs:
release-image:
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
env:
DOCKER_ORG: gitea
DOCKER_LATEST: nightly
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # all history for all branches and tags
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v2
- name: Login to Container Registry
uses: docker/login-action@v2
with:
registry: gitea.marijndoeve.nl
username: ${{ gitea.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Get Meta
id: meta
run: |
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v4
env:
ACTIONS_RUNTIME_TOKEN: '' # See https://gitea.com/gitea/act_runner/issues/119
with:
context: .
file: ./Containerfile
platforms: |
linux/amd64
linux/arm/v7
push: true
tags: |
gitea.marijndoeve.nl/marijn/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }}

View File

@@ -11,7 +11,6 @@ jobs:
container:
image: catthehacker/ubuntu:act-latest
env:
DOCKER_ORG: marijn
DOCKER_LATEST: latest
steps:
- name: Checkout
@@ -42,13 +41,32 @@ jobs:
uses: docker/build-push-action@v4
env:
ACTIONS_RUNTIME_TOKEN: '' # See https://gitea.com/gitea/act_runner/issues/119
IMAGE_NAME: gitea.marijndoeve.nl/marijn/${{ steps.meta.outputs.REPO_NAME }}
with:
context: .
file: ./Containerfile
platforms: |
linux/arm64
linux/arm/v7
push: true
tags: |
gitea.marijndoeve.nl/marijn/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}
gitea.marijndoeve.nl/marijn/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }}
${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}
${{ env.IMAGE_NAME }}:${{ env.DOCKER_LATEST }}
# cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:${{ env.DOCKER_LATEST }}
# cache-to: type:inline
# cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache
# cache-to: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache,mode=max
- name: Deploy Image to Sever
id: deploy
env:
DOCKER_COMPOSE: IMAGE_TAG=${{ gitea.ref_name }} docker compose --ansi=never -f=compose.yaml -f=compose.prod.yaml
uses: https://github.com/appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script: |
cd /opt/projectorpi-web
${{ env.DOCKER_COMPOSE }} pull
${{ env.DOCKER_COMPOSE }} up -d

View File

@@ -2,14 +2,14 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/python-poetry/poetry
rev: 1.5.0 # add version here
rev: 1.8.0 # add version here
hooks:
- id: poetry-check
- id: poetry-lock
@@ -23,6 +23,6 @@ repos:
"--without-hashes",
]
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 24.4.2
hooks:
- id: black

View File

@@ -1,4 +1,4 @@
FROM docker.io/python:3.11-slim AS base
FROM docker.io/python:3.12-slim AS base
WORKDIR /app
@@ -6,17 +6,19 @@ FROM base as dev
RUN pip3 install poetry
CMD [ "uvicorn", "projectorpi_web.app:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
CMD [ "poetry", "run", "uvicorn", "--app-dir", "projectorpi_web", "app:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
FROM base as prod
ADD requirements.txt ./
RUN apt-get update && apt-get install -y build-essential \
&& pip install --upgrade pip \
&& pip3 install -r requirements.txt \
&& pip3 install --no-cache --upgrade pip \
&& pip3 install --no-cache -r requirements.txt \
&& apt-get remove -y build-essential
ADD projectorpi_web/* ./
ADD projectorpi_web ./projectorpi_web
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "80" ]
CMD ["uvicorn", "--app-dir", "projectorpi_web", "app:app", "--host", "0.0.0.0", "--port", "80" ]

3
Makefile Normal file
View File

@@ -0,0 +1,3 @@
.PHONY: prod
prod:
docker compose -f compose.yaml compose.prod.yaml up -d

View File

@@ -1,3 +1,4 @@
services:
app:
image: gitea.marijndoeve.nl/marijn/projectorpi-web:${IMAGE_TAG:-nightly}
image: gitea.marijndoeve.nl/marijn/projectorpi-web:${IMAGE_TAG:-latest}
restart: always

1511
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1 +1 @@
__version__ = "0.2.0"
__version__ = "0.4.0"

View File

@@ -1,22 +1,13 @@
from fastapi import FastAPI, Path, HTTPException, status
from fastapi.responses import RedirectResponse
from projectorpi.cli import ProjectorSerial, ExtronSerial
from fastapi.responses import FileResponse
from projectorpi import ProjectorSerial, ExtronSerial
from pydantic import BaseModel
from time import sleep
from http import HTTPStatus
from typing import Optional
import sentry_sdk
sentry_sdk.init(
dsn="https://8dce3a0f69f643c0a3547b8baf19d00b@sentry.marijndoeve.nl/3",
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
# We recommend adjusting this value in production,
traces_sample_rate=1.0,
)
app = FastAPI()
extron = ExtronSerial()
projector = ProjectorSerial()
@@ -27,8 +18,9 @@ class Response(BaseModel):
@app.get("/")
async def index() -> RedirectResponse:
return RedirectResponse("/docs", HTTPStatus.MOVED_PERMANENTLY)
async def index() -> FileResponse:
return FileResponse("projectorpi_web/index.html")
# return RedirectResponse("/docs", HTTPStatus.MOVED_PERMANENTLY)
@app.post("/sleep", response_model=Response)

101
projectorpi_web/index.html Normal file
View File

@@ -0,0 +1,101 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
#top {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(7, 1fr);
column-gap: normal;
justify-items: center;
}
#bottom {
display: grid;
grid-template: auto / repeat(4, 1fr);
justify-items: center;
}
.remote-button {
width: 70px;
height: 70px;
font-size: 50px;
}
#pwr {
grid-area: 1 / 3;
}
[data-direction="up"] {
grid-area: 2 / 2;
}
[data-direction="down"] {
grid-area: 4 / 2;
}
[data-direction="left"] {
grid-area: 3 / 1;
}
[data-direction="right"] {
grid-area: 3 / 3;
}
[data-direction="enter"] {
grid-area: 3 / 2;
}
[data-direction="menu"] {
grid-area: 5 / 1;
}
[data-direction="vol_up"] {
grid-area: 6 / 2;
}
[data-direction="vol_down"] {
grid-area: 7 / 2;
}
</style>
</head>
<body>
<main>
<div id="top">
<button class="remote-button" data-direction="up">🔼</button>
<button class="remote-button" data-direction="right">▶️</button>
<button class="remote-button" data-direction="down">🔽</button>
<button class="remote-button" data-direction="left">◀️</button>
<button class="remote-button" data-direction="enter">🆗</button>
<button class="remote-button" data-direction="menu">↩️</button>
<button class="remote-button" data-direction="vol_up">⏫️</button>
<button class="remote-button" data-direction="vol_down">⏬️</button>
<button class="remote-button" id="pwr">⏹️</button></div>
<div id="bottom">
<button class="remote-button" data-number="1">1</button>
<button class="remote-button" data-number="2">2</button>
<button class="remote-button" data-number="3">3</button>
<button class="remote-button" data-number="4">4</button>
</div>
</main>
<script>
document.addEventListener('DOMContentLoaded', () => {
document.addEventListener('click', (e) => {
let direction = e.target.dataset.direction
let number = e.target.dataset.number
if (direction) {
fetch(`/control/${direction}`, {method: 'POST'})
}
if (number) {
fetch(`/select/${number}`, {method: 'POST'})
}
if (e.target.id === 'pwr') {
fetch('/sleep', {method: 'POST'})
}
});
})
</script>
</body>
</html>

View File

@@ -1,15 +1,15 @@
[tool.poetry]
name = "projectorpi-web"
version = "0.2.0"
version = "0.4.0"
description = ""
authors = ["Marijn Doeve <marijn@doeve.me>"]
[tool.poetry.dependencies]
python = "^3.9"
fastapi = {extras = ["all"], version = "^0.101.0"}
pydantic = "^2.0.0"
projectorpi = {version = "^0.3.0", source = "gitea"}
sentry-sdk = {extras = ["fastapi"], version = "^1.25.0"}
fastapi = { extras = ["all"], version = "^0.111.0" }
pydantic = "^2.8.0"
projectorpi = { version = "^0.4.1", source = "gitea" }
uvicorn = "^0.30.1"
[tool.poetry.group.dev.dependencies]
mypy = "^1.3.0"

View File

@@ -1,41 +1,45 @@
--extra-index-url https://gitea.marijndoeve.nl/api/packages/Marijn/pypi/simple
annotated-types==0.5.0 ; python_version >= "3.9" and python_version < "4.0"
anyio==3.7.1 ; python_version >= "3.9" and python_version < "4.0"
certifi==2023.7.22 ; python_version >= "3.9" and python_version < "4.0"
annotated-types==0.7.0 ; python_version >= "3.9" and python_version < "4.0"
anyio==4.4.0 ; python_version >= "3.9" and python_version < "4.0"
certifi==2024.6.2 ; python_version >= "3.9" and python_version < "4.0"
click==8.1.7 ; python_version >= "3.9" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.9" and python_version < "4.0" and platform_system == "Windows"
dnspython==2.4.2 ; python_version >= "3.9" and python_version < "4.0"
email-validator==2.0.0.post2 ; python_version >= "3.9" and python_version < "4.0"
exceptiongroup==1.1.3 ; python_version >= "3.9" and python_version < "3.11"
fastapi==0.101.1 ; python_version >= "3.9" and python_version < "4.0"
fastapi[all]==0.101.1 ; python_version >= "3.9" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.9" and python_version < "4.0" and (sys_platform == "win32" or platform_system == "Windows")
dnspython==2.6.1 ; python_version >= "3.9" and python_version < "4.0"
email-validator==2.2.0 ; python_version >= "3.9" and python_version < "4.0"
exceptiongroup==1.2.1 ; python_version >= "3.9" and python_version < "3.11"
fastapi-cli==0.0.4 ; python_version >= "3.9" and python_version < "4.0"
fastapi[all]==0.111.0 ; python_version >= "3.9" and python_version < "4.0"
h11==0.14.0 ; python_version >= "3.9" and python_version < "4.0"
httpcore==0.17.3 ; python_version >= "3.9" and python_version < "4.0"
httptools==0.6.0 ; python_version >= "3.9" and python_version < "4.0"
httpx==0.24.1 ; python_version >= "3.9" and python_version < "4.0"
idna==3.4 ; python_version >= "3.9" and python_version < "4.0"
itsdangerous==2.1.2 ; python_version >= "3.9" and python_version < "4.0"
jinja2==3.1.2 ; python_version >= "3.9" and python_version < "4.0"
markupsafe==2.1.3 ; python_version >= "3.9" and python_version < "4.0"
orjson==3.9.5 ; python_version >= "3.9" and python_version < "4.0"
projectorpi==0.3.0 ; python_version >= "3.9" and python_version < "4.0"
pydantic-core==2.6.1 ; python_version >= "3.9" and python_version < "4.0"
pydantic-extra-types==2.0.0 ; python_version >= "3.9" and python_version < "4.0"
pydantic-settings==2.0.3 ; python_version >= "3.9" and python_version < "4.0"
pydantic==2.2.1 ; python_version >= "3.9" and python_version < "4.0"
httpcore==1.0.5 ; python_version >= "3.9" and python_version < "4.0"
httptools==0.6.1 ; python_version >= "3.9" and python_version < "4.0"
httpx==0.27.0 ; python_version >= "3.9" and python_version < "4.0"
idna==3.7 ; python_version >= "3.9" and python_version < "4.0"
itsdangerous==2.2.0 ; python_version >= "3.9" and python_version < "4.0"
jinja2==3.1.4 ; python_version >= "3.9" and python_version < "4.0"
markdown-it-py==3.0.0 ; python_version >= "3.9" and python_version < "4.0"
markupsafe==2.1.5 ; python_version >= "3.9" and python_version < "4.0"
mdurl==0.1.2 ; python_version >= "3.9" and python_version < "4.0"
orjson==3.10.5 ; python_version >= "3.9" and python_version < "4.0"
projectorpi==0.4.1 ; python_version >= "3.9" and python_version < "4.0"
pydantic-core==2.20.0 ; python_version >= "3.9" and python_version < "4.0"
pydantic-extra-types==2.8.2 ; python_version >= "3.9" and python_version < "4.0"
pydantic-settings==2.3.4 ; python_version >= "3.9" and python_version < "4.0"
pydantic==2.8.0 ; python_version >= "3.9" and python_version < "4.0"
pygments==2.18.0 ; python_version >= "3.9" and python_version < "4.0"
pyserial==3.5 ; python_version >= "3.9" and python_version < "4.0"
python-dotenv==1.0.0 ; python_version >= "3.9" and python_version < "4.0"
python-multipart==0.0.6 ; python_version >= "3.9" and python_version < "4.0"
python-dotenv==1.0.1 ; python_version >= "3.9" and python_version < "4.0"
python-multipart==0.0.9 ; python_version >= "3.9" and python_version < "4.0"
pyyaml==6.0.1 ; python_version >= "3.9" and python_version < "4.0"
sentry-sdk==1.29.2 ; python_version >= "3.9" and python_version < "4.0"
sentry-sdk[fastapi]==1.29.2 ; python_version >= "3.9" and python_version < "4.0"
sniffio==1.3.0 ; python_version >= "3.9" and python_version < "4.0"
starlette==0.27.0 ; python_version >= "3.9" and python_version < "4.0"
typing-extensions==4.7.1 ; python_version >= "3.9" and python_version < "4.0"
ujson==5.8.0 ; python_version >= "3.9" and python_version < "4.0"
urllib3==2.0.4 ; python_version >= "3.9" and python_version < "4.0"
uvicorn[standard]==0.23.2 ; python_version >= "3.9" and python_version < "4.0"
uvloop==0.17.0 ; (sys_platform != "win32" and sys_platform != "cygwin") and platform_python_implementation != "PyPy" and python_version >= "3.9" and python_version < "4.0"
watchfiles==0.19.0 ; python_version >= "3.9" and python_version < "4.0"
websockets==11.0.3 ; python_version >= "3.9" and python_version < "4.0"
rich==13.7.1 ; python_version >= "3.9" and python_version < "4.0"
shellingham==1.5.4 ; python_version >= "3.9" and python_version < "4.0"
sniffio==1.3.1 ; python_version >= "3.9" and python_version < "4.0"
starlette==0.37.2 ; python_version >= "3.9" and python_version < "4.0"
typer==0.12.3 ; python_version >= "3.9" and python_version < "4.0"
typing-extensions==4.12.2 ; python_version >= "3.9" and python_version < "4.0"
ujson==5.10.0 ; python_version >= "3.9" and python_version < "4.0"
uvicorn==0.30.1 ; python_version >= "3.9" and python_version < "4.0"
uvicorn[standard]==0.30.1 ; python_version >= "3.9" and python_version < "4.0"
uvloop==0.19.0 ; (sys_platform != "win32" and sys_platform != "cygwin") and platform_python_implementation != "PyPy" and python_version >= "3.9" and python_version < "4.0"
watchfiles==0.22.0 ; python_version >= "3.9" and python_version < "4.0"
websockets==12.0 ; python_version >= "3.9" and python_version < "4.0"

View File

@@ -1,5 +1,5 @@
from projectorpi_web import __version__
def test_version():
assert __version__ == "0.1.0"
def test_version() -> None:
assert __version__ == "0.4.0"