Skip to content

Commit 49a39c5

Browse files
author
AREMA Ontology Bot
committed
refactor: ontology manager compose
- Add automatic polling every 5 minutes for Google Sheets changes - Implement smart change detection using file hashing - Add git automation with pull/rebase and push - Configure GitHub PAT authentication for auto-commits - Add APScheduler for background task scheduling - Update Docker configuration for git operations - Add comprehensive documentation (AUTOMATION.md) - Update API to v2.0.0 with scheduler status endpoints
1 parent 8c0f55c commit 49a39c5

11 files changed

Lines changed: 891 additions & 58 deletions

File tree

.dockerignore

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Git
2+
.git
3+
.gitignore
4+
5+
# Python
6+
__pycache__
7+
*.pyc
8+
*.pyo
9+
*.pyd
10+
.Python
11+
*.so
12+
*.egg
13+
*.egg-info
14+
dist
15+
build
16+
.venv
17+
venv/
18+
19+
# IDE
20+
.vscode
21+
.idea
22+
*.swp
23+
*.swo
24+
*~
25+
26+
# Documentation
27+
docs/
28+
public/
29+
README.md
30+
31+
# External dependencies
32+
external/
33+
34+
# Environment
35+
.env
36+
.env.*
37+
!.env.dist
38+
39+
# Fuseki data
40+
tools/fuseki/data/
41+
42+
# GitHub
43+
.github/

.env.dist

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,13 @@ ONTOLOGY_SPARQL_ENDPOINT=
33
GRAPHDB_USERNAME=
44
GRAPHDB_PASSWORD=
55
GRAPH_URI=
6+
7+
# Fuseki Configuration (required for docker-compose)
8+
FUSEKI_URL=http://localhost:3030/arema/data
9+
FUSEKI_USERNAME=admin
10+
FUSEKI_PASSWORD=changeme
11+
12+
# GitHub Personal Access Token (required for auto-commit feature)
13+
# Create at: https://github.com/settings/tokens
14+
# Required scope: repo (Full control of private repositories)
15+
GITHUB_TOKEN=your_github_pat_here

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
external/skohub-vocabs
22
.env
3-
/tools/fuseki/data/
3+
/tools/fuseki/data/
4+
tools/python/converter/__pycache__/csv2ont.cpython-311.pyc
5+
tools/python/converter/__pycache__/csv2ont.cpython-312.pyc

Dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM python:3.11-slim
2+
3+
# Install system dependencies (git for auto-commit)
4+
RUN apt-get update && \
5+
apt-get install -y --no-install-recommends git && \
6+
apt-get clean && \
7+
rm -rf /var/lib/apt/lists/*
8+
9+
# Install uv for fast dependency management
10+
RUN pip install --no-cache-dir uv
11+
12+
WORKDIR /app
13+
14+
# Copy dependency files
15+
COPY pyproject.toml uv.lock ./
16+
17+
# Export and install dependencies
18+
RUN uv export --format requirements-txt > requirements.txt && \
19+
pip install --no-cache-dir -r requirements.txt && \
20+
pip install --no-cache-dir fastapi uvicorn requests
21+
22+
# Copy application code
23+
COPY . .
24+
25+
# Create data directory for mock inputs
26+
RUN mkdir -p /app/data
27+
28+
# Expose port
29+
EXPOSE 8000
30+
31+
# Health check
32+
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
33+
CMD python -c "import requests; requests.get('http://localhost:8000/health')" || exit 1
34+
35+
# Start Service
36+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]

docker-compose.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
services:
2+
arema-ontology:
3+
build: .
4+
container_name: arema-ontology-service
5+
ports:
6+
- "8000:8000"
7+
environment:
8+
- FUSEKI_URL=http://fuseki:3030/arema/data
9+
- FUSEKI_UPDATE_URL=http://fuseki:3030/arema/data
10+
- FUSEKI_USERNAME=${FUSEKI_USERNAME}
11+
- FUSEKI_PASSWORD=${FUSEKI_PASSWORD}
12+
- GITHUB_TOKEN=${GITHUB_TOKEN}
13+
volumes:
14+
- ./data:/app/data
15+
- ./src:/app/src
16+
- ./tools:/app/tools
17+
- ./.git:/app/.git
18+
depends_on:
19+
- fuseki
20+
networks:
21+
- arema-network
22+
23+
fuseki:
24+
image: stain/jena-fuseki:5.1.0
25+
container_name: arema-fuseki
26+
ports:
27+
- "3030:3030"
28+
environment:
29+
- ADMIN_PASSWORD=${FUSEKI_PASSWORD}
30+
volumes:
31+
- ./tools/fuseki/data:/fuseki/databases
32+
- ./tools/fuseki/config.ttl:/fuseki/config.ttl
33+
command: ["/jena-fuseki/fuseki-server", "--config=/fuseki/config.ttl"]
34+
networks:
35+
- arema-network
36+
37+
networks:
38+
arema-network:
39+
driver: bridge

0 commit comments

Comments
 (0)