Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
cc4314e
Create a workflow to build the image and push it to Docker Hub
inistor Jul 15, 2024
1679858
Setting up health checks for postgres db to be ready before kicking o…
radhaksri Aug 12, 2024
b425e10
Removed version tag
radhaksri Aug 12, 2024
20ec5d2
Merge pull request #1 from radhaksri/master
zetneteork Jun 17, 2026
97c038f
Merge pull request #2 from TRon993/patch-1
zetneteork Jun 17, 2026
2309028
Merge pull request #3 from inistor/inistor-patch-docker-build
zetneteork Jun 17, 2026
3aafe0f
Merge pull request #4 from opentreecz/feature/unit-tests
zetneteork Jun 17, 2026
d8a4bf8
Merge pull request #5 from opentreecz/feature/auto-build-docker
zetneteork Jun 17, 2026
1537cc0
Add comprehensive tests, auto-linting, and code coverage docs
zetneteork Jun 17, 2026
e5dc3d4
Merge pull request #6 from opentreecz/feature/code-quality-tests-docs
zetneteork Jun 17, 2026
aab3341
Fix broken /admin/login/ layout by loading Bootstrap from CDN
zetneteork Jun 17, 2026
651ac60
docker-compose.yml
zetneteork Jun 17, 2026
bba0ecb
Add new test files for base repo, keyring, management commands, and e…
zetneteork Jun 17, 2026
9307743
Merge pull request #7 from opentreecz/feature/add-new-tests
zetneteork Jun 17, 2026
485d57c
Fix GitHub Actions workflows: migrate to ghcr.io and add CI test job
zetneteork Jun 17, 2026
ab0ef09
Fix worker startup race with migration healthcheck
zetneteork Jun 17, 2026
ad6caed
Fix duplicate build_number under concurrent workers
zetneteork Jun 17, 2026
0bfb1e4
Merge pull request #8 from opentreecz/fix/worker-migration-race
zetneteork Jun 17, 2026
f41520b
Build image locally in docker compose instead of pulling from registry
zetneteork Jun 17, 2026
839da3f
Revert "Build image locally in docker compose instead of pulling from…
zetneteork Jun 17, 2026
0756560
Build image from local source in docker compose
zetneteork Jun 17, 2026
131d599
Merge branch 'master' into openrepo-upstream-pull-request
zetneteork Jun 26, 2026
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
20 changes: 10 additions & 10 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build and Push Docker Image
on:
push:
branches:
- '**'
- 'main'
tags:
- 'v*'
workflow_dispatch:
Expand All @@ -16,38 +16,38 @@ jobs:
packages: write
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v4
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v4
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v6
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
type=ref,event=branch
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha

- name: Build and push
uses: docker/build-push-action@v7
uses: docker/build-push-action@v6
with:
context: .
push: true
no-cache: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
43 changes: 43 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI

on:
push:
branches: ['**']
pull_request:

jobs:
test:
runs-on: ubuntu-latest

env:
OPENREPO_VAR_DIR: /tmp/openrepo/

steps:
- uses: actions/checkout@v4

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
createrepo-c \
gpg \
libapt-pkg-dev \
libpq-dev \
python3-dev \
python3-pip \
python3-venv

- name: Set up Python venv
run: |
python3 -m venv .venv
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH

- name: Install Python dependencies
run: pip install -r web/requirements.txt

- name: Prepare var directory
run: mkdir -p /tmp/openrepo/packages /tmp/openrepo/keyring /tmp/openrepo/www /tmp/openrepo/rpmcache

- name: Run tests
working-directory: web
run: python manage.py test repo.tests --verbosity=2
39 changes: 25 additions & 14 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
services:
nginx:
build: .
image: ghcr.io/openkilt/openrepo:latest
command: nginx
restart: unless-stopped
Expand All @@ -15,12 +16,11 @@ services:
django:
condition: service_healthy
volumes:
- ./openrepo-data:/var/lib/openrepo


- openrepo-data:/var/lib/openrepo

django:
image: test #ghcr.io/openkilt/openrepo:latest
build: .
image: ghcr.io/openkilt/openrepo:latest
expose:
- "8000"
command: run_openrepoweb
Expand All @@ -32,7 +32,7 @@ services:
retries: 3
start_period: 15s
volumes:
- ./openrepo-data:/var/lib/openrepo
- openrepo-data:/var/lib/openrepo
environment:
# - "OPENREPO_CSRF_TRUSTED_ORIGINS=myproxiedname.example.com" #Multiple domains are space delimited"
- DJANGO_SECRET_KEY=${DJANGO_SECRET_KEY:-}
Expand All @@ -44,13 +44,19 @@ services:
depends_on:
db:
condition: service_healthy

healthcheck:
test: ["CMD-SHELL", "/app/django/manage.py migrate --check"]
interval: 10s
timeout: 5s
retries: 10
start_period: 30s

worker:
image: ghcr.io/openkilt/openrepo:latest
build: .
image: ghcr.io/opentreecz/openrepo:latest
command: ./django/manage.py runworker
volumes:
- ./openrepo-data:/var/lib/openrepo
- openrepo-data:/var/lib/openrepo
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pgrep -f 'manage.py runworker' || exit 1"]
Expand All @@ -66,14 +72,11 @@ services:
- OPENREPO_PG_PASSWORD=${OPENREPO_PG_PASSWORD:-postgres}
- OPENREPO_PG_HOSTNAME=db
depends_on:
db:
condition: service_healthy
django:
condition: service_started

condition: service_healthy

db:
image: postgres:16-alpine3.20
image: postgres:16-alpine
expose:
- "5432"
restart: unless-stopped
Expand All @@ -87,4 +90,12 @@ services:
- POSTGRES_USER=postgres
- POSTGRES_DB=openrepo
volumes:
- ./openrepo-data/postgres:/var/lib/postgresql/data
- openrepo-pq:/var/lib/postgresql/data
healthcheck:
test: [ "CMD-SHELL", "sh -c 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}'" ]
interval: 10s
timeout: 5s
retries: 5
volumes:
openrepo-data:
openrepo-pq:
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ Repo UID is created when a new repo is created.

# Create a new repo
POST /api/repos/
Example: curl -X POST http://<your-openrepo-instance>:7376/api/repos/ -H 'Authorization: Token <your-user-token>' -H 'Content-Type: application/json' -d '{"repo_uid": "<repo-name>", "repo_type": "deb|rpm|files", "signing_key": "<FINGERPRINT_OF_SIGNINGKEY>"}'
A signing key must be created before creating a repo.
Example: curl -X POST http://<your-openrepo-instance>:7376/api/repos/ -H 'Authorization: Token <your-user-token>' -F "repo_uid=<repo-name>" -F "repo_type=<deb|rpm|files>" -F "signing_key=<FINGERPRINT_OF_SIGNINGKEY"
You need to create a SigningKey otherwise you can not create

# Delete a repo
DELETE /api/<repo>/
Expand Down
16 changes: 16 additions & 0 deletions web/.coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[run]
source = .
omit =
*/migrations/*
*/tests/*
manage.py
openrepo/asgi.py
openrepo/wsgi.py
adapters/file/cli_inspect.py

[report]
skip_covered = False
show_missing = True

[html]
directory = htmlcov
19 changes: 19 additions & 0 deletions web/.flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[flake8]
max-line-length = 120
exclude =
migrations,
__pycache__,
.git,
.venv,
venv
# E501 long lines in shell command strings within adapter files are acceptable
per-file-ignores =
adapters/repo/deb_repo.py: E501
adapters/repo/rpm_repo.py: E501
adapters/repo/base_repo.py: E501
repo/worker/bgworker.py: E501
openrepo/settings.py: E501
repo/api/authentication.py: E501
repo/api/serializers.py: E501
repo/models.py: E501
repo/apps.py: F401
Loading