commit a0d992022d1658da9cd2c069b12c8697d59da5bc Author: Michael Kinder <60057409+FoggyMtnDrifter@users.noreply.github.com> Date: Sat Nov 21 13:45:14 2026 -0500 Cottage catalog: three starter recipes Vaultwarden, Actual Budget and Uptime Kuma, each a Harbor template with a listing, an icon, first-run notes and a smoke test. CI builds Harbor at the pinned commit and runs every recipe's smoke test against its fake runtime. diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..4c0ac50 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,42 @@ +name: validate +on: [push, pull_request] +permissions: { contents: read } +jobs: + fake-runtime: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: { go-version: "1.26" } + # Harbor is private: a read-only deploy key is needed (secret HARBOR_DEPLOY_KEY). + - name: Build harbord at the pinned commit + env: { HARBOR_DEPLOY_KEY: "${{ secrets.HARBOR_DEPLOY_KEY }}" } + run: | + if [ -z "$HARBOR_DEPLOY_KEY" ]; then + if [ "${{ github.event.pull_request.head.repo.full_name || github.repository }}" != "${{ github.repository }}" ]; then + echo "::notice::Pull requests from forks can't build private Harbor, so the recipe tests are skipped. A maintainer runs them before merging." + echo "skip=true" >> "$GITHUB_ENV" + exit 0 + fi + echo "::error::Add the HARBOR_DEPLOY_KEY secret (a read-only deploy key on cottage-host/harbor) to run the recipe smoke tests." + exit 1 + fi + mkdir -p ~/.ssh && printf '%s\n' "$HARBOR_DEPLOY_KEY" > ~/.ssh/id_ed25519 && chmod 600 ~/.ssh/id_ed25519 + ssh-keyscan github.com >> ~/.ssh/known_hosts + git clone -q git@github.com:cottage-host/harbor.git /tmp/harbor + git -C /tmp/harbor checkout -q "$(cat harbor.ref)" + (cd /tmp/harbor && go build -o /tmp/harbord ./cmd/harbord) + # harbord runs as root, as on a node: it hands volume directories to the containers' + # non-root users (x-harbor.volumes uid/gid), which needs root or CAP_CHOWN. + # Capacity is fixed so the runner's disk size can't refuse a pod. + - name: Smoke test every recipe + if: env.skip != 'true' + run: | + export HARBOR_DATA_DIR=$RUNNER_TEMP/h HARBOR_RUNTIME=fake HARBOR_BASE_DOMAIN=pods.test + export HARBOR_CAPACITY_CPU_MILLIS=8000 HARBOR_CAPACITY_MEMORY_MB=8192 HARBOR_CAPACITY_STORAGE_MB=65536 + # The runner's sudo ignores -E, so pass Harbor's settings explicitly. + H="HARBOR_DATA_DIR=$HARBOR_DATA_DIR HARBOR_RUNTIME=$HARBOR_RUNTIME HARBOR_BASE_DOMAIN=$HARBOR_BASE_DOMAIN HARBOR_CAPACITY_CPU_MILLIS=$HARBOR_CAPACITY_CPU_MILLIS HARBOR_CAPACITY_MEMORY_MB=$HARBOR_CAPACITY_MEMORY_MB HARBOR_CAPACITY_STORAGE_MB=$HARBOR_CAPACITY_STORAGE_MB" + export HARBOR_TOKEN=$(sudo env $H /tmp/harbord token create ci | grep -o 'hbr_[A-Za-z0-9_-]*') + sudo env $H /tmp/harbord serve & sleep 2 + export HARBOR_URL=http://127.0.0.1:7700 + for t in apps/*/tests/smoke.sh; do sh "$t"; done diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..57bc88a --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/README.md b/README.md new file mode 100644 index 0000000..fe5b96d --- /dev/null +++ b/README.md @@ -0,0 +1,59 @@ +# Cottage catalog + +The recipes behind every app on [Cottage](https://cottage.host), managed hosting for open-source +apps. Each recipe is a Harbor template (Docker Compose plus a few Cottage settings) and a listing. +Cottage's control plane syncs this repo and pushes the templates to the servers that run your apps. + +Maintainers are welcome here: if you make one of these apps, you can check how we run it, suggest +changes, or co-maintain its recipe. See Cottage's maintainer program for how revenue is shared. + +``` +apps// + template.yml Harbor template: Compose + x-harbor (resources, parameters, health path) + cottage.yml listing: name, tagline, category, upstream, license, image digests + README.md first-run notes shown on the app's Overview tab + icon.svg 64×64 icon, no scripts or event handlers + tests/smoke.sh deploy → running → HTTP 200 on health_path → delete +schema/cottage.schema.json +``` + +## Rules + +- **Slug** = directory name = `x-harbor.slug`, lowercase with hyphens, matching the upstream project. +- **Version** = `-c`, e.g. `1.34.3-c1`. Bump `-c` when only the + recipe changes. A published version is never edited: Harbor and Hearth both refuse a changed + document under an existing version. +- Images come from the official upstream, pinned by tag in `template.yml`, with the multi-arch + digest recorded in `cottage.yml`. +- Containers run as a non-root user; `x-harbor.volumes` hands the volume to that uid/gid. +- First-run admin credentials are generated secret parameters, never defaults. If the app can only + create its admin on first visit, set `first_visit_claims_admin: true` so the dashboard tells the + owner to finish setup straight away. +- Mail ports (25/465/587) are blocked by Harbor's egress firewall. Don't rely on SMTP. +- Copy follows the Cottage voice: plain, warm, specific, sentence case, no exclamation marks. + +## Testing a recipe + +Each recipe has a smoke test (`apps//tests/smoke.sh`): deploy, wait for it to run, check the +health path, delete. CI runs every test against Harbor's fake runtime on each push and pull request. + +Harbor isn't public yet, so CI needs a key to build it. Pull requests from forks can't use that +key: their recipe tests are skipped, and we run them before merging. + +```sh +# With a Harbor node to test against (URL and API token): +HARBOR_URL=http://127.0.0.1:7700 HARBOR_TOKEN=... apps/vaultwarden/tests/smoke.sh + +# Against a real Docker node, also check the health path over HTTPS: +HEALTH_BASE='https://%s' HARBOR_URL=... HARBOR_TOKEN=... apps/vaultwarden/tests/smoke.sh +``` + +## Contributing + +Open an issue or a pull request. Keep a recipe's published version unchanged: bump the `-c` +revision instead. Please don't include secrets, real credentials or personal data. + +## Licence + +[Apache-2.0](LICENSE). The apps themselves keep their own licences (listed in each `cottage.yml`), +and their names and logos belong to their projects. diff --git a/apps/actual-budget/README.md b/apps/actual-budget/README.md new file mode 100644 index 0000000..81e9136 --- /dev/null +++ b/apps/actual-budget/README.md @@ -0,0 +1,13 @@ +## First login + +Open your app as soon as it's live. The first visit asks you to set a server password, so do it before you share the address with anyone. + +Then choose **Create new file**, or import from YNAB or another Actual file. + +## End-to-end encryption + +Under **Settings → Encryption** you can add a key that only your devices know. Cottage can't read an encrypted budget, and can't recover it if you lose the key. + +## Export your data + +Open **Settings → Export data** for a zip of your budget. Cottage also keeps nightly backups of the whole app. diff --git a/apps/actual-budget/cottage.yml b/apps/actual-budget/cottage.yml new file mode 100644 index 0000000..7633dbb --- /dev/null +++ b/apps/actual-budget/cottage.yml @@ -0,0 +1,15 @@ +name: Actual Budget +tagline: Give every dollar a job, and see where it went. +category: Finance +description: >- + A fast envelope budgeting app. Your budget lives on your devices and syncs + through your own server, with optional end-to-end encryption. +upstream: https://github.com/actualbudget/actual +website: https://actualbudget.org +license: MIT +images: + - ref: actualbudget/actual-server:25.11.0 + digest: sha256:8f72d73e68958566850325c1f9fe780a4477340979969bd6979649dc519723ab +mobile_apps: false +# The first visit sets the server password. +first_visit_claims_admin: true diff --git a/apps/actual-budget/icon.svg b/apps/actual-budget/icon.svg new file mode 100644 index 0000000..8af9afe --- /dev/null +++ b/apps/actual-budget/icon.svg @@ -0,0 +1 @@ + diff --git a/apps/actual-budget/template.yml b/apps/actual-budget/template.yml new file mode 100644 index 0000000..ef29790 --- /dev/null +++ b/apps/actual-budget/template.yml @@ -0,0 +1,21 @@ +# Actual Budget: envelope budgeting with a local-first sync server. +x-harbor: + slug: actual-budget + name: Actual Budget + description: Local-first personal finance and budgeting. + version: "25.11.0-c1" + primary: { service: app, port: 5006 } + health_path: /health + default_resources: { cpu_millis: 250, memory_mb: 512, storage_mb: 5120 } + min_resources: { cpu_millis: 250, memory_mb: 256, storage_mb: 1024 } + volumes: + data: { uid: 1000, gid: 1000, mode: "0750" } + +services: + app: + image: actualbudget/actual-server:25.11.0 + user: "1000:1000" + volumes: [ "data:/data" ] + +volumes: + data: diff --git a/apps/actual-budget/tests/smoke.sh b/apps/actual-budget/tests/smoke.sh new file mode 100755 index 0000000..1855d7b --- /dev/null +++ b/apps/actual-budget/tests/smoke.sh @@ -0,0 +1,3 @@ +#!/bin/sh +# Deploy, wait for running, check the health path, delete. See scripts/smoke.sh. +exec "$(dirname "$0")/../../../scripts/smoke.sh" "$(dirname "$0")/.." diff --git a/apps/uptime-kuma/README.md b/apps/uptime-kuma/README.md new file mode 100644 index 0000000..a3c21ce --- /dev/null +++ b/apps/uptime-kuma/README.md @@ -0,0 +1,13 @@ +## First login + +Open your app as soon as it's live. The first visit asks you to create the admin account, so do it before you share the address with anyone. + +## Monitors + +Choose **Add New Monitor**, pick a type (HTTP is the usual one), and paste the address to watch. Under **Settings → Notifications** you can add email, ntfy, Slack and many others. + +Outbound mail ports are blocked on Cottage. For email alerts, use a provider with an HTTPS API, or a push service such as ntfy. + +## Export your data + +Open **Settings → Backup** and choose **Export**. Cottage also keeps nightly backups of the whole app. diff --git a/apps/uptime-kuma/cottage.yml b/apps/uptime-kuma/cottage.yml new file mode 100644 index 0000000..8110963 --- /dev/null +++ b/apps/uptime-kuma/cottage.yml @@ -0,0 +1,15 @@ +name: Uptime Kuma +tagline: Know the moment a site you care about goes down. +category: Monitoring +description: >- + Watch websites, APIs and servers with HTTP, TCP, ping and DNS checks, then get + told by email, push notification or chat when something breaks. +upstream: https://github.com/louislam/uptime-kuma +website: https://uptime.kuma.pet +license: MIT +images: + - ref: louislam/uptime-kuma:1.23.16 + digest: sha256:431fee3be822b04861cf0e35daf4beef6b7cb37391c5f26c3ad6e12ce280fe18 +mobile_apps: false +# Uptime Kuma 1.x has no way to set the admin account before first visit. +first_visit_claims_admin: true diff --git a/apps/uptime-kuma/icon.svg b/apps/uptime-kuma/icon.svg new file mode 100644 index 0000000..a33a015 --- /dev/null +++ b/apps/uptime-kuma/icon.svg @@ -0,0 +1 @@ + diff --git a/apps/uptime-kuma/template.yml b/apps/uptime-kuma/template.yml new file mode 100644 index 0000000..1cdbd4b --- /dev/null +++ b/apps/uptime-kuma/template.yml @@ -0,0 +1,26 @@ +# Uptime Kuma: monitors websites and services and alerts when they go down. +x-harbor: + slug: uptime-kuma + name: Uptime Kuma + description: Self-hosted uptime monitoring. + version: "1.23.16-c2" + primary: { service: app, port: 3001 } + health_path: /api/entry-page + default_resources: { cpu_millis: 250, memory_mb: 256, storage_mb: 5120 } + min_resources: { cpu_millis: 250, memory_mb: 192, storage_mb: 1024 } + volumes: + data: { uid: 1000, gid: 1000, mode: "0750" } + +services: + app: + image: louislam/uptime-kuma:1.23.16 + user: "1000:1000" + # The image's entrypoint chowns /app/data and then drops privileges, which + # fails for a non-root user. Harbor already gives the volume to uid 1000, + # so start the server directly under dumb-init. + entrypoint: [ "/usr/bin/dumb-init", "--" ] + command: [ "node", "server/server.js" ] + volumes: [ "data:/app/data" ] + +volumes: + data: diff --git a/apps/uptime-kuma/tests/smoke.sh b/apps/uptime-kuma/tests/smoke.sh new file mode 100755 index 0000000..1855d7b --- /dev/null +++ b/apps/uptime-kuma/tests/smoke.sh @@ -0,0 +1,3 @@ +#!/bin/sh +# Deploy, wait for running, check the health path, delete. See scripts/smoke.sh. +exec "$(dirname "$0")/../../../scripts/smoke.sh" "$(dirname "$0")/.." diff --git a/apps/vaultwarden/README.md b/apps/vaultwarden/README.md new file mode 100644 index 0000000..db7ab5f --- /dev/null +++ b/apps/vaultwarden/README.md @@ -0,0 +1,17 @@ +## First login + +New sign-ups are off, so nobody else can create an account on your vault. + +1. Open `/admin` on your app's address and paste the **Admin page token** from the app's Overview tab. +2. Under **Users**, invite your own email address. +3. Go back to the main page, choose **Create account**, and use that same address. + +Invite family members the same way. The admin page can also turn on open sign-ups (**General settings → Allow new signups**), but then anyone who finds your address can make an account. + +## Apps and extensions + +Use the official Bitwarden apps and browser extensions. When they ask for a server, choose **Self-hosted** and enter your app's full address, starting with `https://`. + +## Export your data + +In the web vault, open **Tools → Export vault** and choose the encrypted JSON format. Cottage also keeps nightly backups of the whole app. diff --git a/apps/vaultwarden/cottage.yml b/apps/vaultwarden/cottage.yml new file mode 100644 index 0000000..57ae03b --- /dev/null +++ b/apps/vaultwarden/cottage.yml @@ -0,0 +1,13 @@ +name: Vaultwarden +tagline: Your passwords, in a vault only you hold the key to. +category: Passwords +description: >- + A lightweight server for the Bitwarden apps and browser extensions. Keep every + password, passkey and note in sync across your devices. +upstream: https://github.com/dani-garcia/vaultwarden +website: https://github.com/dani-garcia/vaultwarden/wiki +license: AGPL-3.0-only +images: + - ref: vaultwarden/server:1.34.3 + digest: sha256:84fd8a47f58d79a1ad824c27be0a9492750c0fa5216b35c749863093bfa3c3d7 +mobile_apps: true diff --git a/apps/vaultwarden/icon.svg b/apps/vaultwarden/icon.svg new file mode 100644 index 0000000..78cb0ad --- /dev/null +++ b/apps/vaultwarden/icon.svg @@ -0,0 +1 @@ + diff --git a/apps/vaultwarden/template.yml b/apps/vaultwarden/template.yml new file mode 100644 index 0000000..aa7723d --- /dev/null +++ b/apps/vaultwarden/template.yml @@ -0,0 +1,31 @@ +# Vaultwarden: a Bitwarden-compatible password server. One container, one volume. +x-harbor: + slug: vaultwarden + name: Vaultwarden + description: Bitwarden-compatible password manager. + version: "1.34.3-c1" + primary: { service: app, port: 8080 } + health_path: /alive + default_resources: { cpu_millis: 250, memory_mb: 256, storage_mb: 5120 } + min_resources: { cpu_millis: 250, memory_mb: 128, storage_mb: 1024 } + volumes: + data: { uid: 1000, gid: 1000, mode: "0750" } + parameters: + - { key: ADMIN_TOKEN, label: Admin page token, type: string, secret: true, generate: random32 } + - { key: SIGNUPS_ALLOWED, label: Allow anyone to sign up, type: bool, default: "false", editable: true } + +services: + app: + image: vaultwarden/server:1.34.3 + user: "1000:1000" + environment: + DOMAIN: ${HARBOR_PUBLIC_URL} + ROCKET_PORT: "8080" + ADMIN_TOKEN: ${ADMIN_TOKEN} + SIGNUPS_ALLOWED: ${SIGNUPS_ALLOWED} + # With mail off, an invited address can register directly from the sign-up page. + INVITATIONS_ALLOWED: "true" + volumes: [ "data:/data" ] + +volumes: + data: diff --git a/apps/vaultwarden/tests/smoke.sh b/apps/vaultwarden/tests/smoke.sh new file mode 100755 index 0000000..1855d7b --- /dev/null +++ b/apps/vaultwarden/tests/smoke.sh @@ -0,0 +1,3 @@ +#!/bin/sh +# Deploy, wait for running, check the health path, delete. See scripts/smoke.sh. +exec "$(dirname "$0")/../../../scripts/smoke.sh" "$(dirname "$0")/.." diff --git a/harbor.ref b/harbor.ref new file mode 100644 index 0000000..e91083b --- /dev/null +++ b/harbor.ref @@ -0,0 +1 @@ +e6c8b85797a9068c211702afa30a9b8bba082f66 diff --git a/schema/cottage.schema.json b/schema/cottage.schema.json new file mode 100644 index 0000000..59abfd3 --- /dev/null +++ b/schema/cottage.schema.json @@ -0,0 +1,29 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://cottage.host/schema/cottage.schema.json", + "title": "Cottage listing (cottage.yml)", + "type": "object", + "additionalProperties": false, + "required": ["name", "tagline", "category", "description", "upstream", "license", "images"], + "properties": { + "name": { "type": "string", "minLength": 1, "maxLength": 40 }, + "tagline": { "type": "string", "minLength": 1, "maxLength": 80, "description": "One sentence, sentence case, no exclamation marks." }, + "category": { "type": "string", "minLength": 1, "maxLength": 24 }, + "description": { "type": "string", "minLength": 1, "maxLength": 400 }, + "upstream": { "type": "string", "pattern": "^https://" }, + "website": { "type": "string", "pattern": "^https://" }, + "license": { "type": "string", "description": "SPDX identifier", "minLength": 2 }, + "images": { + "type": "array", "minItems": 1, + "items": { + "type": "object", "additionalProperties": false, "required": ["ref", "digest"], + "properties": { + "ref": { "type": "string", "pattern": "^[a-z0-9./_-]+:[A-Za-z0-9._-]+$" }, + "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" } + } + } + }, + "mobile_apps": { "type": "boolean" }, + "first_visit_claims_admin": { "type": "boolean", "description": "The app's first visitor creates the admin account; the dashboard tells the owner to finish setup at once." } + } +} diff --git a/scripts/smoke.sh b/scripts/smoke.sh new file mode 100755 index 0000000..4094cec --- /dev/null +++ b/scripts/smoke.sh @@ -0,0 +1,40 @@ +#!/bin/sh +# Smoke test one recipe against a harbord: upload → deploy → wait for running → +# HTTP check of health_path through the node's router (real runtime only) → delete. +# +# HARBOR_URL=http://127.0.0.1:7700 HARBOR_TOKEN=hbr_... scripts/smoke.sh apps/vaultwarden +# +# HEALTH_BASE (optional) is how this machine reaches pod hostnames, e.g. https://%s +# where %s is replaced with the pod's domain. Without it the HTTP check is skipped, +# which is what the fake runtime needs. +set -eu +dir=$(cd "${1:?recipe directory}" && pwd) +: "${HARBOR_URL:?}" "${HARBOR_TOKEN:?}" +api() { curl -fsS -H "Authorization: Bearer $HARBOR_TOKEN" "$@"; } +json() { python3 -c "import sys,json; d=json.load(sys.stdin); print($1)"; } + +slug=$(basename "$dir") +api -X POST -H 'Content-Type: application/yaml' --data-binary @"$dir/template.yml" "$HARBOR_URL/v1/templates" >/dev/null +version=$(api "$HARBOR_URL/v1/templates?slug=$slug" | json "sorted(d['data'], key=lambda t: t['created_at'])[-1]['version']") +health=$(api "$HARBOR_URL/v1/templates/$slug?version=$version" | json "d.get('health_path','/')") +ref="smoke-$slug-$$" +pod=$(api -X POST -H "Idempotency-Key: $ref" -d "{\"slug\":\"smoke-$$\",\"external_ref\":\"$ref\",\"template\":\"$slug\",\"template_version\":\"$version\"}" \ + "$HARBOR_URL/v1/pods" | json "d['pod']['id']") +trap 'api -X DELETE "$HARBOR_URL/v1/pods/$pod?purge=true" >/dev/null || true' EXIT + +for _ in $(seq 1 60); do + status=$(api "$HARBOR_URL/v1/pods/$pod" | json "d['status']") + [ "$status" = running ] && break + [ "$status" = failed ] && { echo "$slug: pod failed"; exit 1; } + sleep 2 +done +[ "$status" = running ] || { echo "$slug: not running after 120 s (status $status)"; exit 1; } + +if [ -n "${HEALTH_BASE:-}" ]; then + domain=$(api "$HARBOR_URL/v1/pods/$pod" | json "d['domain']") + # shellcheck disable=SC2059 + url="$(printf "$HEALTH_BASE" "$domain")$health" + code=$(curl -s -o /dev/null -w '%{http_code}' --max-time 120 --retry 20 --retry-delay 3 --retry-all-errors "$url") + [ "$code" = 200 ] || { echo "$slug: $url returned $code"; exit 1; } +fi +echo "$slug@$version: ok"