Scaffold Cloudron packaging workspace
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
{
|
||||
"manifestVersion": 2,
|
||||
"id": "{{APP_ID}}",
|
||||
"title": "{{APP_TITLE}}",
|
||||
"author": "Known Element Packaging Team",
|
||||
"tagline": "TODO: Short one-line pitch",
|
||||
"description": "TODO: Comprehensive description for the Cloudron App Store entry.",
|
||||
"changelog": "Initial scaffold",
|
||||
"website": "{{APP_WEBSITE}}",
|
||||
"supportUrl": "{{APP_ISSUE}}",
|
||||
"sourceUrl": "{{APP_REPO}}",
|
||||
"version": "0.1.0",
|
||||
"tags": {{APP_TAGS}},
|
||||
"healthCheckPath": "/",
|
||||
"memoryLimit": 536870912,
|
||||
"httpPort": {{HTTP_PORT}},
|
||||
"addons": {
|
||||
"localstorage": {}
|
||||
}
|
||||
}
|
27
templates/cloudron-app/CloudronManifest.json.j2
Normal file
27
templates/cloudron-app/CloudronManifest.json.j2
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"manifestVersion": 2,
|
||||
"id": "{{ app_id }}",
|
||||
"title": "{{ app_title }}",
|
||||
"author": "Known Element Packaging Team",
|
||||
"tagline": "TODO: Short one-line pitch",
|
||||
"description": "TODO: Comprehensive description for the Cloudron App Store entry.",
|
||||
"changelog": "Initial scaffold",
|
||||
"website": "{{ app_website }}",
|
||||
"supportUrl": "{{ app_issue }}",
|
||||
"sourceUrl": "{{ app_repo }}",
|
||||
"version": "0.1.0",
|
||||
"tags": {{ app_tags }},
|
||||
"healthCheckPath": "/",
|
||||
"httpPort": {{ http_port }},
|
||||
"memoryLimit": "{{ memory_limit | default('512M') }}", // IMPORTANT: Replace with a realistic value, e.g., "2G", "1024M"
|
||||
"addons": {
|
||||
"localstorage": {}
|
||||
},
|
||||
"optionalAddons": {
|
||||
"postgresql": {},
|
||||
"redis": {},
|
||||
"mysql": {},
|
||||
"mongodb": {},
|
||||
"sendmail": {}
|
||||
}
|
||||
}
|
@@ -1,22 +0,0 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM {{BASE_IMAGE}}
|
||||
|
||||
LABEL org.opencontainers.image.source="{{APP_REPO}}"
|
||||
LABEL org.opencontainers.image.description="Cloudron package for {{APP_TITLE}}"
|
||||
|
||||
ARG APP_VERSION
|
||||
ENV APP_VERSION=${APP_VERSION:-latest}
|
||||
|
||||
# Copy application source into image at build time
|
||||
# Replace this with a multi-stage build if upstream provides Docker images.
|
||||
COPY ./app /app/code
|
||||
|
||||
# Copy start script and make it executable
|
||||
COPY ./start.sh /app/pkg/start.sh
|
||||
RUN chmod +x /app/pkg/start.sh
|
||||
|
||||
# Cloudron expects all processes to run as cloudron user
|
||||
USER cloudron
|
||||
WORKDIR /app/code
|
||||
|
||||
CMD ["/app/pkg/start.sh"]
|
39
templates/cloudron-app/Dockerfile.j2
Normal file
39
templates/cloudron-app/Dockerfile.j2
Normal file
@@ -0,0 +1,39 @@
|
||||
# syntax=docker/dockerfile:1.6
|
||||
|
||||
ARG APP_VERSION={{ default_app_version }}
|
||||
|
||||
FROM {{ builder_image }} AS builder
|
||||
WORKDIR /build
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# TODO: Fetch and build {{ app_title }}
|
||||
# Example:
|
||||
# RUN git clone --depth 1 --branch "${APP_VERSION}" {{ app_repo }} source \
|
||||
# && cd source \
|
||||
# && npm ci \
|
||||
# && npm run build
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
FROM {{ base_image }}
|
||||
LABEL org.opencontainers.image.source="{{ app_repo }}"
|
||||
LABEL org.opencontainers.image.description="Cloudron package for {{ app_title }}"
|
||||
|
||||
ENV APP_VERSION=${APP_VERSION}
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# TODO: Copy build artefacts from the builder stage
|
||||
# COPY --from=builder /build/source/dist /app/code
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
COPY ./app /app/code
|
||||
COPY ./start.sh /app/pkg/start.sh
|
||||
COPY ./test /app/pkg/test
|
||||
|
||||
RUN chmod +x /app/pkg/start.sh /app/pkg/test/smoke.sh \
|
||||
&& mkdir -p /app/data \
|
||||
&& chown -R cloudron:cloudron /app
|
||||
|
||||
USER cloudron
|
||||
WORKDIR /app/code
|
||||
|
||||
CMD ["/app/pkg/start.sh"]
|
@@ -1,20 +0,0 @@
|
||||
# {{APP_TITLE}} on Cloudron
|
||||
|
||||
- **Upstream repository**: {{APP_REPO}}
|
||||
- **Implementation issue**: {{APP_ISSUE}}
|
||||
- **Status**: Draft scaffolding generated on $(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||
|
||||
## Packaging Checklist
|
||||
|
||||
1. Review upstream deployment requirements and map them to Cloudron services (database, cache, object storage, workers).
|
||||
2. Update `Dockerfile` with the correct build steps and runtime dependencies.
|
||||
3. Implement `start.sh` to configure the app from Cloudron-provided environment variables and launch the primary process.
|
||||
4. Edit `CloudronManifest.json` with accurate metadata, permissions, ports, addons, and health checks.
|
||||
5. Add integration and smoke tests under `test/` to validate the package.
|
||||
6. Document manual configuration steps, migration requirements, and known gaps in this README.
|
||||
|
||||
## Notes
|
||||
|
||||
- Replace the placeholder long-running process in `start.sh`.
|
||||
- Populate the `app/` directory with the application build artefacts or git submodules.
|
||||
- Use the shared packaging container (`docker/packager`) to run `cloudron build` and `cloudron install` so the host remains clean.
|
20
templates/cloudron-app/README.md.j2
Normal file
20
templates/cloudron-app/README.md.j2
Normal file
@@ -0,0 +1,20 @@
|
||||
# {{ app_title }} on Cloudron
|
||||
|
||||
- **Upstream repository**: {{ app_repo }}
|
||||
- **Implementation issue**: {{ app_issue }}
|
||||
- **Generated**: {{ generated_at }} UTC
|
||||
|
||||
## Packaging Checklist
|
||||
|
||||
1. Map upstream services (databases, caches, workers) to Cloudron addons; remove unused entries from `optionalAddons` and enable required ones under `addons`.
|
||||
2. Implement the multi-stage build in `Dockerfile` to fetch/compile the correct release of {{ app_title }}.
|
||||
3. Update `start.sh` to configure the app from Cloudron environment variables and launch the primary process.
|
||||
4. Replace the placeholder health checks and smoke test with real coverage.
|
||||
5. Complete `CloudronManifest.json` (tagline, description, versioning, resource limits, ingress, TCP ports, etc.).
|
||||
6. Document manual configuration steps, migrations, and known gaps below.
|
||||
|
||||
## Notes
|
||||
|
||||
- Populate the `app/` directory with runtime overlays or artifacts generated during the build stage.
|
||||
- Use the shared packaging container (`docker/packager`) for `cloudron build/install` to keep the host clean.
|
||||
- Record decisions and operational requirements under `docs/apps/{{ app_slug }}/` as work progresses.
|
9
templates/cloudron-app/metadata.json.j2
Normal file
9
templates/cloudron-app/metadata.json.j2
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"slug": "{{ app_slug }}",
|
||||
"title": "{{ app_title }}",
|
||||
"issue": "{{ app_issue }}",
|
||||
"repo": "{{ app_repo }}",
|
||||
"additionalRepos": {% if additional_repos_json != '[]' %}{{ additional_repos_json | indent(2, True) }}{% else %}[]{% endif %},
|
||||
"created": "{{ generated_at }}",
|
||||
"notes": "TODO: capture packaging notes"
|
||||
}
|
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# Cloudron injects configuration via environment variables and files under /run
|
||||
# Use this script to render config files and launch the upstream service.
|
||||
|
||||
# TODO: Replace the command below with the correct process supervisor.
|
||||
exec /bin/sh -c "echo 'Replace start.sh with application startup logic for {{APP_TITLE}}' && sleep infinity"
|
9
templates/cloudron-app/start.sh.j2
Normal file
9
templates/cloudron-app/start.sh.j2
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# TODO: render configuration files from CLOUDRON_* environment variables
|
||||
# Example:
|
||||
# envsubst < /app/pkg/config.tmpl > /run/config.yaml
|
||||
|
||||
>&2 echo "start.sh for {{ app_title }} is not implemented yet."
|
||||
exit 1
|
@@ -1,16 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# Basic container reachability check executed inside the packaging container.
|
||||
# Replace curl target with an endpoint exposed by the app once the package is functional.
|
||||
cloudron_app_url=${CLOUDRON_APP_ORIGIN:-"http://localhost"}
|
||||
|
||||
http_code=$(curl -s -o /tmp/smoke.log -w "%{http_code}" "${cloudron_app_url}")
|
||||
|
||||
if [[ "${http_code}" != "200" ]]; then
|
||||
echo "Unexpected HTTP status: ${http_code}" >&2
|
||||
cat /tmp/smoke.log >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Smoke test passed"
|
14
templates/cloudron-app/test/smoke.sh.j2
Normal file
14
templates/cloudron-app/test/smoke.sh.j2
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
cloudron_app_origin=${CLOUDRON_APP_ORIGIN:-http://localhost}
|
||||
|
||||
http_code=$(curl --silent --show-error --output /tmp/smoke.log --write-out "%{http_code}" "${cloudron_app_origin}/")
|
||||
|
||||
if [[ "${http_code}" != "200" ]]; then
|
||||
>&2 echo "Smoke test failed for {{ app_title }}: expected HTTP 200 from ${cloudron_app_origin}/, got ${http_code}"
|
||||
>&2 cat /tmp/smoke.log
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Smoke test placeholder passed for {{ app_title }}"
|
Reference in New Issue
Block a user