Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ This project adheres to [Semantic Versioning](https://semver.org/).
*Unreleased* versions radiate potential—-and dread. Once you merge an infernal PR, move its bullet under a new version heading with the actual release date.*

-->
## [Unreleased] - YYYY-MM-DD
### Added
- 🔥 Moved alembic migration code into openSAMPL along with Docker image information
- 🔥 Moved backend api code into openSAMPL along with Docker image information
- 🔥 Docker-compose for developers which installs openSAMPL as editable on backend image

### Fixed
- 🩹 Bug which caused random data duration to always be 1 hour

## [1.1.5] - 2025-09-22
### Fixed
- 🩹 More durable timestamp extrapolation in time data insertion
Expand Down
14 changes: 9 additions & 5 deletions opensampl/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ def check_command(command: list[str]) -> bool:
return False


if not check_command(["docker", "--version"]):
raise ImportError("Docker is not installed or not found in PATH. Please install Docker.")
def ensure_docker():
"""Ensure Docker and Docker Compose are installed, error if not"""
if not check_command(["docker", "--version"]):
raise RuntimeError("Docker is not installed or not found in PATH. Please install Docker.")

compose_installed = check_command(["docker", "compose", "version"]) or check_command(["docker-compose", "--version"])
compose_installed = check_command(["docker", "compose", "version"]) or check_command(
["docker-compose", "--version"]
)

if not compose_installed:
raise ImportError("Neither 'docker compose' nor 'docker-compose' is installed. Please install Docker Compose.")
if not compose_installed:
raise RuntimeError("Neither 'docker compose' nor 'docker-compose' is installed. Please install Docker Compose.")
15 changes: 15 additions & 0 deletions opensampl/server/backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM python:3.12 AS base
ARG OPENSAMPL_VERSION=1.1.5

WORKDIR /tmp
ENV ROUTE_TO_BACKEND=false

FROM base AS prod

RUN pip install --no-cache-dir "opensampl[backend]==${OPENSAMPL_VERSION}"

CMD ["uvicorn", "opensampl.server.backend.main:app", "--proxy-headers", "--host", "0.0.0.0", "--port", "8000"]

FROM base AS dev

CMD ["sh", "-c", "pip install -e \"./opensampl[backend]\" && uvicorn opensampl.server.backend.main:app --proxy-headers --host 0.0.0.0 --port 8000 --log-level debug --reload"]
1 change: 1 addition & 0 deletions opensampl/server/backend/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Backend API tooling"""
Loading