Skip to content

Docassemble packaged for Cloudron (self-hosting platform) - working v0.1 #917

@OrcVole

Description

@OrcVole

Summary

We have packaged docassemble as a custom application for Cloudron, a self-hosting platform that manages applications, databases, backups, and TLS on a single server. The package is working: interviews run, the Playground functions, documents generate, and data persists across restarts.

The full write-up, including step-by-step deployment instructions, architecture decisions, and a detailed list of gotchas we encountered, is on the Cloudron forum:

https://forum.cloudron.io/topic/15247/how-to-install-docassemble-on-cloudron-as-a-custom-application/2

Source repository: https://github.com/OrcVole/docassemble-cloudron

How it works

The package builds on top of the official jhpyle/docassemble Docker image and adapts it for Cloudron's managed environment:

  • PostgreSQL and Redis are provided by Cloudron's managed addons (external to the container), connected via environment variables mapped to docassemble's config.yml.
  • RabbitMQ is replaced by LavinMQ, an AMQP 0.9.1 wire-compatible broker that uses approximately 40 MB of RAM instead of 200 MB. Celery connects to it identically.
  • Cloudron's reverse proxy handles TLS termination. The app runs with BEHINDHTTPSLOADBALANCER=true and nginx listening on port 8080.
  • CONTAINERROLE is set to web:celery:cron:log:mail (not all) to prevent the init script from starting internal PostgreSQL and Redis.
  • The read-only filesystem is handled by symlinking approximately 25 write paths to either /app/data/ (persistent) or /run/ (volatile, recreated each boot).

Where upstream changes could help

During packaging we identified a few areas where small upstream changes would make Cloudron deployment (and potentially other constrained-environment deployments) easier. These are not bugs, just observations from working through the process.

  1. DAREADONLYFILESYSTEM coverage. The flag is checked in about 25 places in initialize.sh, which is great. However, several write operations are not gated by it (for example, writes to /etc/localtime, /etc/locale.conf, /etc/cron.daily/, /var/www/.certs, /usr/share/docassemble/webapp/syslog-ng-orig.conf). Extending the flag's coverage would reduce the number of symlinks needed for read-only environments.

  2. initialize.sh does not exit after completing. After printing "Finished initializing" and starting all services, the initialize process continues running indefinitely. In our setup it consumes memory without doing further work. If this is intentional (for example, to keep supervisor from restarting it), a comment explaining why would be helpful.

  3. initialize.sh force-starts postgres via supervisorctl even when CONTAINERROLE does not include sql and even when DBHOST is set to an external server. On earlier attempts we had CONTAINERROLE=all, and the script started the internal PostgreSQL despite our supervisor override setting autostart=false. Switching to CONTAINERROLE=web:celery:cron:log:mail resolved this.

  4. Connection to postgres system database during init. The init script tests if the app database exists by connecting to the postgres database. Some managed PostgreSQL providers (including Cloudron's) only allow connections to the app-specific database, so this check fails. It is non-fatal (the script proceeds to create tables on the correct database), but generates confusing error messages in the logs.

Known limitations of the Cloudron package

  • First boot takes 15-20 minutes (venv copy, database migration, package table population)
  • Exim4 (email receiving) does not work due to read-only /etc/exim4/; outbound email works via Cloudron's SMTP addon
  • Playground package installs persist across restarts but not across image updates
  • No OIDC/SSO integration with Cloudron's user management yet
  • Requires ~8 GB RAM allocated to the container

Not a feature request or bug report

This is purely informational. We wanted to let the docassemble community know that a Cloudron deployment path exists and is working, and to share our findings in case they are useful for improving constrained-environment support. The upstream observations above are minor and the existing Docker support is excellent. The BEHINDHTTPSLOADBALANCER, DAREADONLYFILESYSTEM, and external database/Redis support made this packaging work possible.

Thank you for building and maintaining docassemble.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions