chore(ddev): local dev environment for testing the Projects API
`ddev start` provisions: - web container: Debian + Go 1.26.3 + node 24, builds gitea via `ddev build-gitea` - db: postgres 17 - router: https://gitea.ddev.site → gitea on container port 3000 First-run steps: ddev start ddev build-gitea ddev restart ddev exec './gitea --config .ddev/gitea/app.ini admin user create \ --admin --username ddev --password ddev1234567890 \ --email ddev@example.com --must-change-password=false' .ddev/.gitignore uses a whitelist: only the 6 files we authored are tracked; DDEV's generated content (compose files, provider templates, snapshots, gocache, gitea runtime data) is ignored.
This commit is contained in:
@@ -0,0 +1,17 @@
|
|||||||
|
# Whitelist approach: ignore everything in .ddev by default, then re-include
|
||||||
|
# the files we author. DDEV regenerates the rest on `ddev start`.
|
||||||
|
*
|
||||||
|
!.gitignore
|
||||||
|
!config.yaml
|
||||||
|
!web-build/
|
||||||
|
web-build/*
|
||||||
|
!web-build/Dockerfile
|
||||||
|
!commands/
|
||||||
|
commands/*
|
||||||
|
!commands/web/
|
||||||
|
commands/web/*
|
||||||
|
!commands/web/build-gitea
|
||||||
|
!gitea/
|
||||||
|
gitea/*
|
||||||
|
!gitea/app.ini
|
||||||
|
!gitea/.gitignore
|
||||||
Executable
+10
@@ -0,0 +1,10 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
## Description: Build the gitea backend binary inside the web container
|
||||||
|
## Usage: build-gitea
|
||||||
|
## Example: ddev build-gitea
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
cd /var/www/html
|
||||||
|
echo "Building gitea backend (cgo, sqlite + sqlite_unlock_notify tags)..."
|
||||||
|
make backend
|
||||||
|
echo "Done. Restart the daemon: ddev restart"
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
name: gitea
|
||||||
|
type: generic
|
||||||
|
docroot: .
|
||||||
|
webserver_type: generic
|
||||||
|
nodejs_version: "24"
|
||||||
|
corepack_enable: true
|
||||||
|
|
||||||
|
webimage_extra_packages:
|
||||||
|
- make
|
||||||
|
- build-essential
|
||||||
|
- libsqlite3-dev
|
||||||
|
|
||||||
|
database:
|
||||||
|
type: postgres
|
||||||
|
version: "17"
|
||||||
|
|
||||||
|
# Route HTTPS (gitea.ddev.site) to gitea's port 3000 inside the web container
|
||||||
|
web_extra_exposed_ports:
|
||||||
|
- name: gitea
|
||||||
|
container_port: 3000
|
||||||
|
http_port: 80
|
||||||
|
https_port: 443
|
||||||
|
|
||||||
|
web_extra_daemons:
|
||||||
|
- name: gitea-web
|
||||||
|
command: "/var/www/html/gitea web --config /var/www/html/.ddev/gitea/app.ini"
|
||||||
|
directory: /var/www/html
|
||||||
|
|
||||||
|
web_environment:
|
||||||
|
- GITEA_WORK_DIR=/var/www/html
|
||||||
|
- GITEA_CUSTOM=/var/www/html/.ddev/gitea
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
data/
|
||||||
|
repositories/
|
||||||
|
indexers/
|
||||||
|
queues/
|
||||||
|
log/
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
APP_NAME = Gitea (DDEV)
|
||||||
|
RUN_MODE = dev
|
||||||
|
WORK_PATH = /var/www/html
|
||||||
|
|
||||||
|
[server]
|
||||||
|
PROTOCOL = http
|
||||||
|
HTTP_ADDR = 0.0.0.0
|
||||||
|
HTTP_PORT = 3000
|
||||||
|
DOMAIN = gitea.ddev.site
|
||||||
|
ROOT_URL = https://gitea.ddev.site/
|
||||||
|
SSH_DOMAIN = gitea.ddev.site
|
||||||
|
DISABLE_SSH = true
|
||||||
|
APP_DATA_PATH = /var/www/html/.ddev/gitea/data
|
||||||
|
LFS_START_SERVER = false
|
||||||
|
OFFLINE_MODE = true
|
||||||
|
|
||||||
|
[database]
|
||||||
|
DB_TYPE = postgres
|
||||||
|
HOST = db:5432
|
||||||
|
NAME = db
|
||||||
|
USER = db
|
||||||
|
PASSWD = db
|
||||||
|
SSL_MODE = disable
|
||||||
|
SCHEMA = public
|
||||||
|
|
||||||
|
[repository]
|
||||||
|
ROOT = /var/www/html/.ddev/gitea/repositories
|
||||||
|
|
||||||
|
[security]
|
||||||
|
INSTALL_LOCK = true
|
||||||
|
SECRET_KEY = ddev-gitea-secret-key-placeholder
|
||||||
|
INTERNAL_TOKEN = ddev-gitea-internal-token-placeholder
|
||||||
|
|
||||||
|
[service]
|
||||||
|
DISABLE_REGISTRATION = false
|
||||||
|
REQUIRE_SIGNIN_VIEW = false
|
||||||
|
DEFAULT_KEEP_EMAIL_PRIVATE = false
|
||||||
|
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
|
||||||
|
|
||||||
|
[log]
|
||||||
|
ROOT_PATH = /var/www/html/.ddev/gitea/log
|
||||||
|
MODE = console
|
||||||
|
LEVEL = info
|
||||||
|
|
||||||
|
[session]
|
||||||
|
PROVIDER = memory
|
||||||
|
|
||||||
|
[mailer]
|
||||||
|
ENABLED = false
|
||||||
|
|
||||||
|
[indexer]
|
||||||
|
ISSUE_INDEXER_PATH = /var/www/html/.ddev/gitea/indexers/issues.bleve
|
||||||
|
REPO_INDEXER_PATH = /var/www/html/.ddev/gitea/indexers/repos.bleve
|
||||||
|
|
||||||
|
[queue]
|
||||||
|
TYPE = level
|
||||||
|
DATADIR = /var/www/html/.ddev/gitea/queues
|
||||||
|
|
||||||
|
[oauth2]
|
||||||
|
JWT_SECRET = Ox7IRtBouaVq1kogqXCOce5NZLi0OL42SbkRKLZvHY4
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
ARG BASE_IMAGE
|
||||||
|
FROM $BASE_IMAGE
|
||||||
|
|
||||||
|
# Install Go 1.26 — DDEV's base image doesn't ship Go
|
||||||
|
ENV GO_VERSION=1.26.3
|
||||||
|
RUN set -eux; \
|
||||||
|
arch="$(dpkg --print-architecture)"; \
|
||||||
|
case "$arch" in \
|
||||||
|
amd64) GO_ARCH=amd64 ;; \
|
||||||
|
arm64) GO_ARCH=arm64 ;; \
|
||||||
|
*) echo "unsupported arch $arch" >&2; exit 1 ;; \
|
||||||
|
esac; \
|
||||||
|
curl -fsSL "https://go.dev/dl/go${GO_VERSION}.linux-${GO_ARCH}.tar.gz" -o /tmp/go.tgz; \
|
||||||
|
tar -C /usr/local -xzf /tmp/go.tgz; \
|
||||||
|
rm /tmp/go.tgz
|
||||||
|
ENV GOPATH=/var/www/html/.ddev/gocache/path
|
||||||
|
ENV GOCACHE=/var/www/html/.ddev/gocache/build
|
||||||
|
ENV PATH="/usr/local/go/bin:${GOPATH}/bin:${PATH}"
|
||||||
|
|
||||||
|
# git, build-essential, sqlite, and node 24 are already in the ddev-webserver base
|
||||||
|
RUN go version
|
||||||
|
|
||||||
|
# Pre-warm pnpm cache root for the build step
|
||||||
|
ENV PNPM_HOME=/var/www/html/.ddev/gocache/pnpm
|
||||||
|
ENV PATH="${PNPM_HOME}:${PATH}"
|
||||||
Reference in New Issue
Block a user