diff --git a/onedev/data/docker/.gitkeep b/onedev/data/docker/.gitkeep new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/onedev/data/docker/.gitkeep @@ -0,0 +1 @@ + diff --git a/onedev/data/onedev/.gitkeep b/onedev/data/onedev/.gitkeep new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/onedev/data/onedev/.gitkeep @@ -0,0 +1 @@ + diff --git a/onedev/data/postgres/.gitkeep b/onedev/data/postgres/.gitkeep new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/onedev/data/postgres/.gitkeep @@ -0,0 +1 @@ + diff --git a/onedev/docker-compose.yml b/onedev/docker-compose.yml new file mode 100644 index 000000000..188df6919 --- /dev/null +++ b/onedev/docker-compose.yml @@ -0,0 +1,69 @@ +version: "3.7" + +services: + app_proxy: + environment: + APP_HOST: onedev_web_1 + APP_PORT: 6610 + # Allow Git, package, API, and agent clients to authenticate directly with OneDev. + PROXY_AUTH_ADD: "false" + + docker: + image: docker:27.2.0-dind@sha256:f9f72ad901a78f27be922b2d320bbc263174f12919c1b37e6a01f828fa904565 + privileged: true + network_mode: host + stop_grace_period: 1m + restart: on-failure + environment: + DOCKER_ENSURE_BRIDGE: "dind0:10.32.0.1/16" + entrypoint: /entrypoint.sh + command: > + dockerd + --bridge dind0 + --data-root /data/data + --exec-root /data/exec + --host unix:///data/docker.sock + --pidfile /data/docker.pid + volumes: + - ${APP_DATA_DIR}/entrypoint.sh:/entrypoint.sh + - ${APP_DATA_DIR}/data/docker:/data + + web: + image: 1dev/server:16.2.3@sha256:38e560bd9488c1dabf093c9f18c95f66ca3ed1b3f32bca9504881b2053024c25 + restart: on-failure + tty: true + depends_on: + postgres: + condition: service_healthy + docker: + condition: service_started + ports: + # Expose OneDev's Git-over-SSH endpoint, which cannot use the HTTP app proxy. + - "6611:6611" + volumes: + - ${APP_DATA_DIR}/data/onedev:/opt/onedev + - ${APP_DATA_DIR}/data/docker:/var/run + environment: + # Pre-fill the Umbrel URL while keeping system settings editable during onboarding. + ONEDEV_SERVICE_HOST: "${DEVICE_DOMAIN_NAME}:${APP_PROXY_PORT}" + hibernate_connection_password: ${APP_SEED} + hibernate_dialect: io.onedev.server.persistence.PostgreSQLDialect + hibernate_connection_driver_class: org.postgresql.Driver + hibernate_connection_url: jdbc:postgresql://onedev_postgres_1:5432/onedev + hibernate_connection_username: postgres + DOCKER_HOST: unix:///var/run/docker.sock + + postgres: + image: postgres:17.10-alpine@sha256:742f40ea20b9ff2ff31db5458d127452988a2164df9e17441e191f3b72252193 + restart: on-failure + environment: + POSTGRES_PASSWORD: ${APP_SEED} + POSTGRES_USER: "postgres" + POSTGRES_DB: "onedev" + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres -d onedev"] + interval: 5s + timeout: 5s + retries: 10 + volumes: + - ${APP_DATA_DIR}/data/postgres:/var/lib/postgresql/data diff --git a/onedev/entrypoint.sh b/onedev/entrypoint.sh new file mode 100755 index 000000000..9e29bdfee --- /dev/null +++ b/onedev/entrypoint.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +pidfile="/var/run/docker.pid" +if [[ -f "${pidfile}" ]] +then + rm -f "${pidfile}" +fi + +for command in iptables iptables-restore iptables-restore-translate iptables-save iptables-translate +do + ln -sf /sbin/xtables-nft-multi /sbin/$command +done + +ensure_bridge_exists() { + local name="${1}" + local ip_range="${2}" + if ip link show "${name}" &>/dev/null + then + echo "Bridge '${name}' already exists. Skipping creation." + ip addr show "${name}" + return + fi + echo "Bridge '${name}' does not exist. Creating..." + ip link add "${name}" type bridge + ip addr add "${ip_range}" dev "${name}" + ip link set "${name}" up + echo "Bridge '${name}' is now up with IP range '${ip_range}'." + ip addr show "${name}" +} + +if [[ "${DOCKER_ENSURE_BRIDGE}" != "" ]] +then + bridge="${DOCKER_ENSURE_BRIDGE%%:*}" + ip_range="${DOCKER_ENSURE_BRIDGE#*:}" + ensure_bridge_exists "${bridge}" "${ip_range}" +fi + +exec dockerd-entrypoint.sh $@ diff --git a/onedev/hooks/pre-start b/onedev/hooks/pre-start new file mode 100755 index 000000000..bdc3121ab --- /dev/null +++ b/onedev/hooks/pre-start @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -euo pipefail + +APP_DATA_DIR="$(readlink -f $(dirname "${BASH_SOURCE[0]}")/..)/data" + +DOCKER_DIR="${APP_DATA_DIR}/docker" + +# Remove stale Docker-in-Docker runtime state that can survive power loss, +# crashes, restarts, or updates and prevent the nested Docker daemon from +# starting. +# +# Keep ${DOCKER_DIR}/data intact. It is the nested Docker graph root and may +# contain user-managed Portainer containers, images, volumes, and stacks. +rm -f "${DOCKER_DIR}/docker.pid" +rm -f "${DOCKER_DIR}/docker.sock" +rm -rf "${DOCKER_DIR}/exec" diff --git a/onedev/umbrel-app.yml b/onedev/umbrel-app.yml new file mode 100644 index 000000000..1c7c3479e --- /dev/null +++ b/onedev/umbrel-app.yml @@ -0,0 +1,46 @@ +manifestVersion: 1 +id: onedev +name: OneDev +tagline: A streamlined server for code, builds, and packages +category: developer +version: "16.2.3" +port: 6610 +description: >- + ⚠️ OneDev can use significant system resources. Its first launch may take a few minutes, especially on lower-powered devices. + + + OneDev is a Git and DevOps platform that combines repository hosting, CI/CD pipelines, Kanban boards, and package management in one clean workspace. It helps you manage code, automate builds, track tasks, and ship projects from a single interface. + + + It brings the core tools for modern software development together in one clean workspace, including: + + 🔍 Version control: It provides built-in Git support, allowing code management directly within the platform. + + 📦 CI/CD (Continuous Integration / Continuous Delivery): OneDev enables you to create build and deployment pipelines for continuously testing and delivering code changes. + + 🐞 Issue tracking: It offers a task management system to organize projects and track progress. + + 👩‍💻 Code review: Developers can perform code reviews directly on the platform to ensure quality. + + 📝 Kanban boards: OneDev includes flexible boards to help manage tasks and workflows. + + 🔗 Third-party integration: It supports the integration of external services and tools. + + The tool is especially appealing for teams that prefer a complete DevOps solution in a single, self-hosted system without relying on external cloud services. +developer: OneDev Pty +website: https://onedev.io/ +submitter: dennysubke +submission: https://github.com/getumbrel/umbrel-apps/pull/5848 +repo: https://github.com/theonedev/onedev +support: https://code.onedev.io/onedev/server/~issues?query=%22State%22+is+%22Open%22 +gallery: + - 1.webp + - 2.webp + - 3.webp + - 4.webp + - 5.webp +releaseNotes: "" +dependencies: [] +path: "" +defaultUsername: "" +defaultPassword: ""