Files
wekan/docs/Platforms/FOSS/Container/Docker/Meteor3/README.md
T
Lauri Ojansivu ad51a03731 Log in by full-page redirect by default with OAuth2/OIDC, Google & co, SAML and CAS.
Every login that chooses between a popup and a redirect opened a popup by
default. Google's sign-in pages, and other identity providers', can send
Cross-Origin-Opener-Policy, which makes Meteor's popup look closed at
once: the login was tried before the provider answered, and the user
was back on the sign-in page with no error. Popups are also blocked in
iframes and on some phones. The full-page redirect has no popup to lose.

- OAUTH2_LOGIN_STYLE (OAuth2/OIDC): redirect unless it says popup, in the
  server, the Admin Panel catalog and the samples.
- OAUTH_PROVIDERS_LOGIN_STYLE (Google, GitHub, Facebook, X, Meteor
  Developer, Weibo, Meetup): redirect by default, in the code, Dockerfile,
  snap, Sandstorm package and samples.
- SAML: both identity-provider profiles log in by redirect;
  SAML_LOGIN_FLOW=popup still chooses the popup, and the client no longer
  falls back to a popup while the configuration loads.
- CAS: redirects unless "popup": true. Its redirect could never finish:
  nothing called Meteor.initCas, which the package now does at startup.
  The sign-in page also passed username and password as loginWithCas's
  options and callback, so its callback never ran, and the CAS redirect
  page echoed the request address into HTML unescaped.

A redirect login's error now reaches the reloaded sign-in page, from
accounts-oauth's page-load hook and the SAML and CAS events, instead of
the page coming back silently.

Verified against a freshly built and prepared bundle with the local
identity-provider suite and no login style set: OIDC, SAML, CAS and all
seven Meteor providers log in by redirect, and each refusal is shown on
the sign-in page (31 of 31 with Chromium). Its LDAP wrong-password case
expected wording that changed in 679a8b3499 and is corrected.

Thanks to xet7 !
2026-10-08 15:18:59 +03:00

5.8 KiB

Meteor 3 WeKan: Hosting many WeKan kanban, websites, etc

1) Install WeKan exactly like this

Use all settings and config files at this page and subdirectories.

Caddy, CloudFlare and the proxy headers

caddy/Caddyfile is the Caddy config for this setup: many WeKan Docker containers, Sandstorm and websites behind one Caddy. Each WeKan container is a few lines:

wekan.customer.com {
	import cloudflare_tls               # only when CloudFlare proxy is on
	import wekan_headers_google wekan.customer.com
	import wekan_well_known
	import wekan_proxy 3001             # the container's PORT
}
  • CloudFlare proxy on (orange cloud): import cloudflare_tls loads the CloudFlare Origin Certificate from /etc/caddy/certs, with CloudFlare SSL/TLS set to "Full (strict)". Also disable "HTTP/2 to Origin" and caching, see the cloudflare screenshots.
  • CloudFlare proxy off (grey cloud): leave cloudflare_tls out, and Caddy gets a Let's Encrypt certificate itself.
  • Who the visitor is: the global options trust CloudFlare's published address ranges, and only those, to say who the visitor is (CF-Connecting-IP). A request from anywhere else, including grey cloud sites, uses its own connecting address, so a forged header is ignored. Refresh the ranges from https://www.cloudflare.com/ips-v4 and https://www.cloudflare.com/ips-v6 when CloudFlare changes them.
  • What WeKan receives: wekan_proxy sends X-Forwarded-Proto: https and the visitor's address as the only X-Forwarded-For and X-Real-IP value. Caddy passes Host and X-Forwarded-Host unchanged.
  • HTTP_FORWARDED_COUNT=1 in every container (already in restore/docker-end.yml). Without it WeKan sees every visitor as the proxy's 127.0.0.1. All users then share the login cookie refresh limit of 30 per 10 seconds per address, so at busy times users are signed out, and a Google login returns to the sign-in page.
  • Google login (OAuth2/OIDC): keep OAUTH2_LOGIN_STYLE=redirect, the default (set it explicitly on WeKan versions that defaulted to popup), and open WeKan only at its ROOT_URL. Google's sign-in pages can break the popup login style, and a login started at any other address cannot finish.

Sandstorm behind the same Caddy: Sandstorm.

2) Backup your previous WeKan server

See backup scripts etc, mongodump and files directory

3) Restore to your new WeKan install

Use restore scripts to mongorestore and restore files (attachments and avatars)

4) Move all files from MongoDB to filesystem

This will speed up loading attachments a lot.

  1. Admin Panel / Attachments
  2. Default Storage: Filesystem
  3. Move Files: From MongoDB CollectionFS to Filesystem
  4. Move Files: From MongoDB Meteor-Files to Filesystem
  5. MongoDB GridFS Storage: Compact Database (this will make MongoDB disk usage smaller)

Migrating from Snap to Docker

Note: Only Oplog sockjs works with multitenancy, see multitenancy.md. For the alternatives to running one Node.js server per tenant — one server for many ROOT_URLs, and what each option costs — see Multitenancy design.

Migrating from Parallel Snap setup, because snap set wekan root-url=... etc commands are slow to run, and did not get Parallel Snap working properly yet.

caddy proxy: Let's Encrypt and CloudFlare TLS to localhost http ports
  |
  |==> Many Parallel WeKan Snap Containers at different ports,
  |    each Container with it's own Node.js/MongoDB
  |==> Sandstorm, many websites with WordPress and Hackers CMS
  |==> PHP/MySQL WordPress     (example)
  |==> PHP/MySQL Hesk Helpdesk (example)
  |==> PHP/MySQL Kanboard      (example)
  |==> Static websites         (example)

To this Docker setup:

caddy proxy: Let's Encrypt and CloudFlare TLS to localhost http ports
  |
  |==> Many Docker Meteor 3 WeKan Node.js Containers,
  |    Uses changeStreams and DDP_TRANSPORT=sockjs
  |     |
  |     |=> One MongoDB without container,
  |         always requires password to login,
  |         for admin and each other users,
  |         each user has it's own database, username and password
  |
  |==> Sandstorm, many websites with WordPress and Hackers CMS
  |==> PHP/MySQL WordPress     (example)
  |==> PHP/MySQL Hesk Helpdesk (example)
  |==> PHP/MySQL Kanboard      (example)
  |==> Static websites         (example)

Save all Parallel Snap container settings with:

snap-save-settings.sh

For setting up MongoDB etc, use examples at apt directory.

MongoDB config /etc/mongod.conf is at mongo directory.

Create MongoDB key:

./keys.sh

After installing mongo/mongod.conf and starting MongoDB, initialize its single-node replica set. The command is idempotent and waits for a writable primary:

./mongo/init-replica-set.sh
  1. Adding new user, it saves MongoDB connection string to username.txt:
./1createdb.sh username

Same username.txt is used when login to database, backup, restore, files transfer, etc.

You can connect to database:

./sh.sh username

Or sometime make Backup to backup/username/YYYY-MM-DD_HH-MM-SS/

./backup.sh username
  1. Create docker-compose.yml to restore/username/
./2docker.sh username

Edit docker-compose.yml and start Docker container:

cd restore/username/

nano docker-compose.yml

docker compose up -d
  1. Restore database
./3restoredb.sh username
  1. Transfer attachments and avatars from Snap server to Docker server:
./4files.sh username
  1. Restart Docker container:
cd restore/username/

docker compose stop

docker compose start
  1. Upgrade WeKan from old version to new version, for example:
./update-wekan-version.sh 9.10 9.11