Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .claude/skills/indexing-diagnostics/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,7 @@ WHERE realm_url = '<realm-url>' AND username = '<user-from-artifact>';

Then re-mint with `--permissions read,write,realm-owner` (or whatever the columns are). Booleans translate one-to-one to array entries; column `realm_owner` becomes `realm-owner` (note the dash).

For local dev: matrix `server_name` is `localhost` (`packages/matrix/docker/synapse/dev/homeserver.yaml:1`), so user IDs are `@<username>:localhost`. Two local-dev modes are supported:
For local dev: matrix `server_name` is `localhost` (`packages/matrix/support/synapse/dev/homeserver.yaml:1`), so user IDs are `@<username>:localhost`. Two local-dev modes are supported:

- **Standard mode** (no `BOXEL_ENVIRONMENT` set) — realm at `https://localhost:4201/...`, host-app at `https://localhost:4200`.
- **Environment mode** (`BOXEL_ENVIRONMENT=<name>` set) — realm at `http://realm-server.<slug>.localhost/...`, host-app at `http://host.<slug>.localhost` (Traefik routing per `mise-tasks/lib/env-vars.sh`).
Expand Down
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ module.exports = {
'packages/boxel-cli/src/commands/realm/status.ts',
'packages/boxel-cli/src/commands/realm/sync.ts',
'packages/boxel-cli/src/lib/realm-sync-base.ts',
'packages/matrix/helpers/isolated-realm-server.ts',
'packages/matrix/support/isolated-realm-server.ts',
'packages/postgres/pg-queue.ts',
'packages/postgres/pg-transaction-manager.ts',
'packages/realm-server/node-realm.ts',
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-software-factory.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- "packages/base/**"
- "packages/boxel-icons/**"
- "packages/host/**"
- "packages/matrix/**"
- "packages/matrix/support/**"
- "packages/postgres/**"
Comment thread
backspace marked this conversation as resolved.
- "packages/realm-server/**"
- "packages/realm-test-harness/**"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/sync-synapse-templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [main]
paths:
- "packages/matrix/docker/synapse/templates/**"
- "packages/matrix/support/synapse/templates/**"
workflow_dispatch:
inputs:
environment:
Expand Down Expand Up @@ -56,15 +56,15 @@ jobs:

- name: Replace URL in registration success template
run: |
sed -i "s/http:\/\/localhost:4200/https:\/\/${{ env.HOST_DOMAIN }}/" packages/matrix/docker/synapse/templates/registration_success.html
sed -i "s/http:\/\/localhost:4200/https:\/\/${{ env.HOST_DOMAIN }}/" packages/matrix/support/synapse/templates/registration_success.html

- name: Replace icon URL with one from matching subdomain
run: |
sed -i "s/d12nxmpmo97fii.cloudfront.net\/boxel-icon.png/${{ env.BOXEL_ICON_DOMAIN_AND_PATH }}/" packages/matrix/docker/synapse/templates/_base.html
sed -i "s/d12nxmpmo97fii.cloudfront.net\/boxel-icon.png/${{ env.BOXEL_ICON_DOMAIN_AND_PATH }}/" packages/matrix/support/synapse/templates/_base.html

- name: S3 Sync
run: |
aws s3 sync packages/matrix/docker/synapse/templates s3://${{ env.AWS_S3_BUCKET }}/templates
aws s3 sync packages/matrix/support/synapse/templates s3://${{ env.AWS_S3_BUCKET }}/templates

- name: Restart Synapse ECS Service
run: |
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ This will create a new SQLite schema based on the current postgres DB (the schem

### Matrix Server

The boxel platform leverages a Matrix server called Synapse in order to support identity, workflow, and chat behaviors. This project uses a dockerized Matrix server. We have multiple matrix server configurations (currently one for development that uses a persistent DB, and one for testing that uses an in-memory DB). You can find and configure these matrix servers at `packages/matrix/docker/synapse/*`.
The boxel platform leverages a Matrix server called Synapse in order to support identity, workflow, and chat behaviors. This project uses a dockerized Matrix server. We have multiple matrix server configurations (currently one for development that uses a persistent DB, and one for testing that uses an in-memory DB). You can find and configure these matrix servers at `packages/matrix/support/synapse/*`.

This server is automatically started as part of `mise run dev`, but if you wish to control it separately:

Expand Down
7 changes: 6 additions & 1 deletion packages/matrix/docker/smtp4dev.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { dockerCreateNetwork, dockerRun, dockerStop, dockerRm } from './index';
import {
dockerCreateNetwork,
dockerRun,
dockerStop,
dockerRm,
} from '../support/docker';

interface Options {
mailClientPort?: number;
Expand Down
42 changes: 0 additions & 42 deletions packages/matrix/docker/synapse/templates/_base.html

This file was deleted.

9 changes: 0 additions & 9 deletions packages/matrix/docker/synapse/templates/add_threepid.html

This file was deleted.

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions packages/matrix/docker/synapse/templates/password_reset.html

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

8 changes: 0 additions & 8 deletions packages/matrix/docker/synapse/templates/registration.html

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 5 additions & 5 deletions packages/matrix/helpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, type Page } from '@playwright/test';
import type { Credentials } from '../docker/synapse';
import type { Credentials } from '../support/synapse';
import {
loginUser,
getAllRoomEvents,
Expand All @@ -9,11 +9,11 @@ import {
sync,
updateUser,
type UpdateUserOptions,
} from '../docker/synapse';
} from '../support/synapse';
import { realmPassword } from './realm-credentials';
import type { SQLExecutor } from './isolated-realm-server';
import { appURL, BasicSQLExecutor } from './isolated-realm-server';
import { APP_BOXEL_MESSAGE_MSGTYPE } from './matrix-constants';
import type { SQLExecutor } from '../support/isolated-realm-server';
import { appURL, BasicSQLExecutor } from '../support/isolated-realm-server';
import { APP_BOXEL_MESSAGE_MSGTYPE } from '../support/matrix-constants';
import { randomUUID } from 'crypto';

export const testHost = 'https://localhost:4205/test';
Expand Down
2 changes: 1 addition & 1 deletion packages/matrix/scripts/assert-synapse-running.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if [ "$RUNNING" = "$CONTAINER_NAME" ]; then
if [ -n "$BOXEL_ENVIRONMENT" ]; then
HOST_PORT=$(docker port "$CONTAINER_NAME" 8008/tcp 2>/dev/null | head -1 | awk -F: '{print $NF}')
if [ -n "$HOST_PORT" ]; then
pnpm exec ts-node --transpileOnly -e "import { registerSynapseWithTraefik } from './helpers/environment-config'; registerSynapseWithTraefik($HOST_PORT);"
pnpm exec ts-node --transpileOnly -e "import { registerSynapseWithTraefik } from './support/environment-config'; registerSynapseWithTraefik($HOST_PORT);"
fi
fi
else
Expand Down
10 changes: 5 additions & 5 deletions packages/matrix/scripts/migrate-account-data-http-to-https.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// Safe to re-run: rows already in the target scheme are left
// untouched, and the PUT only fires when at least one URL changed.

import { getSynapseURL } from '../helpers/environment-config';
import { getSynapseURL } from '../support/environment-config';

const ADMIN_USERNAME = 'admin';
const ADMIN_PASSWORD = 'password';
Expand Down Expand Up @@ -122,9 +122,7 @@ async function impersonate(
): Promise<string> {
// Synapse admin endpoint that returns an access token for any user.
let response = await fetch(
`${synapseURL}/_synapse/admin/v1/users/${encodeURIComponent(
userId,
)}/login`,
`${synapseURL}/_synapse/admin/v1/users/${encodeURIComponent(userId)}/login`,
{
method: 'POST',
headers: { Authorization: `Bearer ${adminToken}` },
Expand Down Expand Up @@ -259,7 +257,9 @@ async function main(): Promise<void> {
console.log(` Users migrated: ${migratedUsers}`);
console.log(` URLs rewritten: ${totalURLsChanged}`);
console.log(` Skipped (no data): ${skippedNoData}`);
console.log(` Skipped (${TO_SCHEME.padEnd(5)}):${' '.repeat(8 - TO_SCHEME.length)}${skippedAlreadyOnTargetScheme}`);
console.log(
` Skipped (${TO_SCHEME.padEnd(5)}):${' '.repeat(8 - TO_SCHEME.length)}${skippedAlreadyOnTargetScheme}`,
);
}

main().catch((err) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/matrix/scripts/migrate-realm-user.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { loginUser, updateUser } from '../docker/synapse';
import { loginUser, updateUser } from '../support/synapse';

import { realmPassword } from '../helpers/realm-credentials';

Expand Down
7 changes: 4 additions & 3 deletions packages/matrix/scripts/register-matrix-users.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as childProcess from 'child_process';

import { createRegistrationToken, loginUser } from '../docker/synapse';
import { createRegistrationToken, loginUser } from '../support/synapse';
import { ensureUserRecord } from '../helpers/ensure-user-record';
import {
getSynapseContainerName,
getSynapseURL,
} from '../helpers/environment-config';
} from '../support/environment-config';
import { realmPassword } from '../helpers/realm-credentials';

type Mode = 'all' | 'realms-only';
Expand Down Expand Up @@ -149,7 +149,8 @@ async function main() {
process.exit(-1);
}

const realmSecretSeed = process.env.REALM_SECRET_SEED || "shhh! it's a secret";
const realmSecretSeed =
process.env.REALM_SECRET_SEED || "shhh! it's a secret";

// In 'all' mode we'll INSERT into the users table for bot/writer accounts,
// so ensure Postgres is reachable too. 'realms-only' mode never touches
Expand Down
2 changes: 1 addition & 1 deletion packages/matrix/scripts/register-realm-user-using-api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { loginUser } from '../docker/synapse';
import { loginUser } from '../support/synapse';

const matrixURL = process.env.MATRIX_URL || 'http://localhost:8008';
const realmServerURL = process.env.REALM_SERVER_URL || 'http://localhost:4201';
Expand Down
4 changes: 2 additions & 2 deletions packages/matrix/scripts/register-realm-user.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as childProcess from 'child_process';

import { loginUser } from '../docker/synapse';
import { getSynapseContainerName } from '../helpers/environment-config';
import { loginUser } from '../support/synapse';
import { getSynapseContainerName } from '../support/environment-config';

import { realmPassword } from '../helpers/realm-credentials';

Expand Down
2 changes: 1 addition & 1 deletion packages/matrix/scripts/register-test-token.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createRegistrationToken, loginUser } from '../docker/synapse';
import { createRegistrationToken, loginUser } from '../support/synapse';
import { adminUsername, adminPassword } from './register-test-user';

(async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/matrix/scripts/register-test-user.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as childProcess from 'child_process';

import { loginUser } from '../docker/synapse';
import { loginUser } from '../support/synapse';
import { ensureUserRecord } from '../helpers/ensure-user-record';
import { getSynapseContainerName } from '../helpers/environment-config';
import { getSynapseContainerName } from '../support/environment-config';
export const adminUsername = 'admin';
export const adminPassword = 'password';

Expand Down
6 changes: 3 additions & 3 deletions packages/matrix/scripts/synapse.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { synapseStart } from '../docker/synapse';
import { dockerStop } from '../docker';
import { synapseStart } from '../support/synapse';
import { dockerStop } from '../support/docker';
import { resolve } from 'path';
import {
getSynapseContainerName,
deregisterSynapseFromTraefik,
} from '../helpers/environment-config';
} from '../support/environment-config';

const [command] = process.argv.slice(2);
let dataDir = process.env.SYNAPSE_DATA_DIR
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { execSync } from 'child_process';
import { execSync, spawn } from 'child_process';
Comment thread
backspace marked this conversation as resolved.
import { writeFileSync, renameSync, unlinkSync } from 'fs';
import { join, resolve } from 'path';
import yaml from 'yaml';
Expand Down Expand Up @@ -139,7 +139,6 @@ export function registerSynapseWithTraefik(hostPort: number): void {
// polling option. See dev-service-registry.ts for the full rationale.
function kickTraefikIfNeeded(): void {
if (process.platform !== 'darwin') return;
let { spawn } = require('child_process') as typeof import('child_process');
let child = spawn('docker', ['restart', 'boxel-traefik'], {
stdio: 'ignore',
detached: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { dirSync, setGracefulCleanup } from 'tmp';
import { ensureDirSync, copySync, readFileSync } from 'fs-extra';
import { Pool } from 'pg';
import { createServer as createNetServer, type AddressInfo } from 'net';
import type { SynapseInstance } from '../docker/synapse';
import type { SynapseInstance } from './synapse';

setGracefulCleanup();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import {
dockerLogs,
dockerRun,
dockerStop,
} from '../index';
import { APP_BOXEL_REALMS_EVENT_TYPE } from '../../helpers/matrix-constants';
import { appURL } from '../../helpers/isolated-realm-server';
} from '../docker';
import { APP_BOXEL_REALMS_EVENT_TYPE } from '../matrix-constants';
import { appURL } from '../isolated-realm-server';
import {
isEnvironmentMode,
getSynapseContainerName,
getSynapseURL,
registerSynapseWithTraefik,
} from '../../helpers/environment-config';
} from '../environment-config';

export const SYNAPSE_IP_ADDRESS = '172.20.0.5';
export const SYNAPSE_PORT = 8008;
Expand Down
Loading