Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
4428dec
refactor: reuse NCDD for the devcontainer
vitormattos Oct 4, 2026
d4b41d8
test: validate the NCDD devcontainer adapter
vitormattos Oct 4, 2026
73ce507
fix: resolve devcontainer through the NCDD worker contract
vitormattos Oct 4, 2026
3794e94
fix: forward web services in the devcontainer
vitormattos Oct 4, 2026
e23af07
fix: keep Nextcloud access behind the NCDD proxy
vitormattos Oct 4, 2026
278f9c3
test: assert canonical NCDD proxy access
vitormattos Oct 4, 2026
9fc2fb2
fix: support browser access from Codespaces
vitormattos Oct 4, 2026
0421593
fix: layer the LibreSign devcontainer over NCDD
vitormattos Oct 4, 2026
e352e36
refactor: route Codespaces through the NCDD proxy
vitormattos Oct 5, 2026
b308dfd
test: exercise NCDD services from the devcontainer
vitormattos Oct 5, 2026
17ba5f4
test: inspect resolved devcontainer services reliably
vitormattos Oct 5, 2026
5513221
refactor: align devcontainer with the current specification
vitormattos Oct 5, 2026
0eae00c
test: exercise the Dev Container with the CLI up flow
vitormattos Oct 5, 2026
60fd479
fix: preserve host ownership in the devcontainer
vitormattos Oct 5, 2026
25ed312
test: simplify devcontainer coverage
vitormattos Oct 5, 2026
3143e73
refactor: remove unused devcontainer worker state
vitormattos Oct 5, 2026
2452e20
refactor: finalize the NCDD devcontainer adapter
vitormattos Oct 5, 2026
a8d998e
fix: satisfy ShellCheck in devcontainer bootstrap
vitormattos Oct 5, 2026
aa9a3ec
test: harden devcontainer bootstrap contract
vitormattos Oct 5, 2026
dca2ca8
ci: separate devcontainer contract and integration checks
vitormattos Oct 5, 2026
e93acb6
ci: collect devcontainer diagnostics on failure
vitormattos Oct 5, 2026
f04fb1a
fix: keep Codespaces port configuration portable
vitormattos Oct 5, 2026
0eb0502
test: cover devcontainer bootstrap with Bats
vitormattos Oct 5, 2026
f98b74a
test: assert devcontainer contract structurally
vitormattos Oct 5, 2026
b904471
test: exercise Nextcloud with a real Playwright browser
vitormattos Oct 5, 2026
5781518
test: run Playwright as an ephemeral smoke service
vitormattos Oct 5, 2026
960d7d6
ci: pin the Bats test runtime
vitormattos Oct 5, 2026
311fc77
test: make the Playwright devcontainer smoke deterministic
vitormattos Oct 5, 2026
8e30e9b
test: validate the Playwright smoke script syntax
vitormattos Oct 5, 2026
cf3e685
test: cover devcontainer bootstrap recovery and repeatability
vitormattos Oct 5, 2026
a1c123b
style: format devcontainer contract tests
vitormattos Oct 5, 2026
047567c
fix: separate proxy and Playwright devcontainer smoke tests
vitormattos Oct 5, 2026
873d8b3
test: assert the devcontainer readiness summary
vitormattos Oct 5, 2026
2d78f45
fix: avoid reconciling the devcontainer during Playwright smoke
vitormattos Oct 5, 2026
e68654d
ci: keep devcontainer diagnostics non-invasive
vitormattos Oct 5, 2026
06ac472
test: make LibreSign devcontainer setup directly testable
vitormattos Oct 5, 2026
35ed3f1
style: align devcontainer readiness banner with NCDD
vitormattos Oct 5, 2026
2843e65
style: use LibreSign green in readiness banner
vitormattos Oct 5, 2026
1297c79
test: align readiness assertions with the banner
vitormattos Oct 5, 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
83 changes: 52 additions & 31 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,68 @@
<!--
- SPDX-FileCopyrightText: 2024 LibreCode coop and contributors
- SPDX-FileCopyrightText: 2024-2026 LibreCode coop and contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
## Starting devcontainer
# LibreSign dev container

- Use vscode (codium don't will work)
- Stup the extension devcontainer
- Open libresign folder at vscode
- After open you will see a message "Reopen in container", do this
The dev container is a thin adapter over
`LibreCodeCoop/nextcloud-docker-development` (NCDD).

## Stopping devcontainer
Open the LibreSign repository in VS Code and choose **Reopen in Container**.
The initialization step fetches the pinned NCDD revision and asks NCDD's
`dev-worker config` command to resolve the canonical environment for this
worktree. LibreSign only adds its source mount at
`/var/www/html/apps-extra/libresign`.

```bash
docker stop $(docker ps -aq)
docker rm $(docker ps -aq)
```
## Cleaning all volumes
A deterministic worker id is derived from the local worktree path, so separate
worktrees resolve to separate NCDD mutable-state directories.

This will be necessary when you want to have a new clean environment
## Browser access

```bash
docker volume rm $(docker volume ls -q )
For local Docker/VS Code development, use NCDD's shared HTTPS proxy. The setup
script prints the canonical URL:

```text
https://ncdev-libresign-<id>.localhost
```
## Looking logs

### Nginx
For GitHub Codespaces, the same shared proxy remains the only HTTP entry point.
NCDD already publishes the proxy on port `443` of the Codespaces VM. Codespaces
detects that port and exposes it using its normal port-forwarding mechanism,
while the adapter configures Nextcloud with the public hostname GitHub assigns
to forwarded port `443`:

```bash
docker logs libresign_devcontainer-nginx-1 -f --tail 100
```text
https://<codespace>-443.<forwarding-domain>
```

### Nextcloud
The forwarding domain comes from
`GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN`; it is not hard-coded.

Individual workers do not publish separate nginx host ports. The Dev Container
configuration intentionally avoids service-qualified `forwardPorts` entries,
because GitHub Codespaces does not support the `host:port` form.

- Open the console inside vscode
- Run:
```bash
tail -f data/nextcloud.log
```
Mailpit remains available locally through NCDD's shared proxy. In Codespaces it
is still reachable from the development environment and is covered by CI, but
its browser UI is not exposed as a separate forwarded URL by this adapter.

The Playwright service is optional and is not started as part of normal Dev
Container use. When enabled, NCDD routes its canonical Nextcloud hostname back
through the shared proxy so browser tests exercise the same public URL.

The adapter defaults to PHP 8.3, Nextcloud `master`, MariaDB 10.6. These may be
changed on the host before reopening the container:

```bash
export LIBRESIGN_PHP_VERSION=83
export LIBRESIGN_NEXTCLOUD_VERSION=master
export LIBRESIGN_DB_TYPE=mariadb
export LIBRESIGN_MARIADB_VERSION=10.6
```

### Database
Closing or rebuilding this dev container only affects its Compose project.
Do not use global Docker cleanup commands to stop unrelated containers or
delete unrelated volumes.

- Open the console inside vscode
- Run:
```bash
tail -f data/database.log
```
Canonical development documentation lives in the
[LibreSign Developer Manual](https://docs.libresign.coop/developer_manual/).
51 changes: 19 additions & 32 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
{
"name": "LibreSign",
"dockerComposeFile": "docker-compose.yml",
"service": "nextcloud",
"forwardPorts": [
80,
8025
"initializeCommand": [
"sh",
".devcontainer/prepare.sh"
],
"dockerComposeFile": [
"ncdd.generated.yml",
"docker-compose.yml"
],
"service": "nextcloud",
"workspaceFolder": "/var/www/html/apps-extra/libresign",
"containerEnv": {
"XDEBUG_MODE": "debug",
"XDEBUG_CONFIG": "client_host=127.0.0.1 client_port=9003 start_with_request=yes"
"XDEBUG_CONFIG": "client_host=host.docker.internal client_port=9003 start_with_request=yes"
},
"customizations": {
"codespaces": {
"openFiles": [
".devcontainer/README.md"
]
},
"vscode": {
"extensions": [
"MehediDracula.php-namespace-resolver",
Expand All @@ -39,31 +38,19 @@
],
"gitlens.showWelcomeOnInstall": false,
"telemetry.telemetryLevel": "off",
"intelephense.telemetry.enabled": false,
"intelephense.environment.includePaths": [
"apps-extra"
],
"git.scanRepositories": [
"/apps-extra/libresign"
]
"intelephense.telemetry.enabled": false
}
}
},
"workspaceFolder": "/var/www/html",
"overrideCommand": true,
"postAttachCommand": "bash /var/www/html/apps-extra/libresign/.devcontainer/setup.sh",
"postCreateCommand": [
"bash",
"/var/www/html/apps-extra/libresign/.devcontainer/setup.sh"
],
"portsAttributes": {
"80": {
"label": "http",
"protocol": "http",
"onAutoForward": "openBrowser",
"elevateIfNeeded": true
},
"8025": {
"label": "mailpit",
"protocol": "http",
"onAutoForward": "notify",
"elevateIfNeeded": true
"443": {
"label": "Nextcloud via NCDD proxy",
"protocol": "https",
"onAutoForward": "openBrowser"
},
"9000": {
"label": "php-fpm",
Expand Down
77 changes: 5 additions & 72 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,80 +1,13 @@
# SPDX-FileCopyrightText: 2024 LibreCode coop and contributors
# SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
# SPDX-License-Identifier: AGPL-3.0-or-later

services:
# pgsql:
# image: postgres:13-alpine
# restart: unless-stopped
# volumes:
# - ./volumes/postgres/data:/var/lib/postgresql/data
# environment:
# - POSTGRES_DB=${POSTGRES_DB:-nextcloud}
# - POSTGRES_USER=${POSTGRES_USER:-nextcloud}
# - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-nextcloud}
# ports:
# - 127.0.0.1:5432:5432
# command: postgres -c log_statement=all
mysql:
image: mariadb:10.6
volumes:
- ./.docker/config/mysql:/etc/mysql/conf.d
- mysql-init:/docker-entrypoint-initdb.d
- mysql-data:/var/lib/mysql
ports:
- 127.0.0.1:3306:3306
restart: unless-stopped
environment:
- TZ=${TZ:-CET}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root}
- MYSQL_DATABASE=${MYSQL_DATABASE:-nextcloud}
- MYSQL_USER=${MYSQL_USER:-nextcloud}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-nextcloud}
nextcloud:
image: ghcr.io/librecodecoop/nextcloud-dev:8.3
volumes:
- ~/.composer:/var/www/.composer/
- ~/.npm:/var/www/.npm/
- nextcloud:/var/www/html
- ../:/var/www/html/apps-extra/libresign
restart: unless-stopped
environment:
- HOST_UID=${HOST_UID:-1000}
- HOST_GID=${HOST_GID:-1000}
- DEFAULT_PHONE_REGION=${DEFAULT_PHONE_REGION:-UTC}
- NEXTCLOUD_ADMIN_USER=${NEXTCLOUD_ADMIN_USER:-admin}
- NEXTCLOUD_ADMIN_PASSWORD=${NEXTCLOUD_ADMIN_PASSWORD:-admin}
- NEXTCLOUD_ADMIN_EMAIL=${NEXTCLOUD_ADMIN_EMAIL:-a@test.tld}
- DB_HOST=${DB_HOST:-mysql}
- MYSQL_DATABASE=${MYSQL_DATABASE:-nextcloud}
- MYSQL_USER=${MYSQL_USER:-nextcloud}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-nextcloud}
- POSTGRES_DB=${POSTGRES_DB:-nextcloud}
- POSTGRES_USER=${POSTGRES_USER:-nextcloud}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-nextcloud}
- MAIL_FROM_ADDRESS=${MAIL_FROM_ADDRESS:-nextcloud}
- MAIL_DOMAIN=${MAIL_DOMAIN:-mailpit}
- MAIL_SMTPPORT=${MAIL_SMTPPORT:-1025}
- MAIL_SMTPHOST=${MAIL_SMTPHOST:-mailpit}
- VERSION_NEXTCLOUD=${VERSION_NEXTCLOUD:-master}
- AUTOINSTALL=${AUTOINSTALL:-1}
- XDEBUG_CONFIG
- HTTP_PORT=${HTTP_PORT:-80}
extra_hosts:
- host.docker.internal:host-gateway
nginx:
image: ghcr.io/librecodecoop/nextcloud-dev-nginx:latest
restart: unless-stopped
volumes:
- nextcloud:/var/www/html:ro
- ../:/var/www/html/apps-extra/libresign:ro
ports:
- ${HTTP_PORT:-80}:80
mailpit:
image: axllent/mailpit
ports:
- 127.0.0.1:${MAILPIT_PORT:-8025}:8025
redis:
image: redis
volumes:
mysql-init:
mysql-data:
nextcloud:
playwright:
volumes:
- ../:/var/www/html/apps-extra/libresign
63 changes: 63 additions & 0 deletions .devcontainer/prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
# SPDX-License-Identifier: AGPL-3.0-or-later

set -eu

repo_root="$(CDPATH='' cd -- "$(dirname -- "$0")/.." && pwd)"
ncdd_dir="$repo_root/.devcontainer/.nextcloud-docker-development"
generated_compose="$repo_root/.devcontainer/ncdd.generated.yml"
ncdd_commit="b33c4dee93a4d41ce856e7480c871cf1171b3cbb"

prepare_ncdd() {
if [ ! -d "$ncdd_dir/.git" ]; then
rm -rf "$ncdd_dir"
git clone \
--filter=blob:none \
--no-checkout \
https://github.com/LibreCodeCoop/nextcloud-docker-development.git \
"$ncdd_dir"
fi

if ! git -C "$ncdd_dir" cat-file -e "$ncdd_commit^{commit}" 2>/dev/null; then
git -C "$ncdd_dir" fetch --depth=1 origin "$ncdd_commit"
fi

git -C "$ncdd_dir" checkout --detach "$ncdd_commit"
}

worker_id() {
workspace_key="$(printf '%s' "$repo_root" | cksum | awk '{print $1}')"
printf 'libresign-%s\n' "$workspace_key"
}

render_compose() {
id="$1"
tmp="$generated_compose.tmp.$$"
trap 'rm -f "$tmp"' EXIT HUP INT TERM

set -- env \
HOST_UID="$(id -u)" \
HOST_GID="$(id -g)" \
DB_TYPE="${LIBRESIGN_DB_TYPE:-mariadb}" \
MARIADB_VERSION="${LIBRESIGN_MARIADB_VERSION:-10.6}" \
PHP_VERSION="${LIBRESIGN_PHP_VERSION:-83}" \
VERSION_NEXTCLOUD="${LIBRESIGN_NEXTCLOUD_VERSION:-master}" \
COMPOSE_PROFILES=playwright

if [ "${CODESPACES:-}" = "true" ]; then
: "${CODESPACE_NAME:?CODESPACE_NAME is required in Codespaces}"
: "${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN:?GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN is required in Codespaces}"

set -- "$@" \
NEXTCLOUD_HOST="${CODESPACE_NAME}-443.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}" \
NEXTCLOUD_PROTOCOL=https
fi

"$@" sh "$ncdd_dir/dev-worker" "$id" config > "$tmp"
mv "$tmp" "$generated_compose"
trap - EXIT HUP INT TERM
}

prepare_ncdd
render_compose "$(worker_id)"
Loading
Loading