Skip to content

Commit 0c16b33

Browse files
authored
Remove the old migration tool and document the new one (#4447)
2 parents 161306e + 6c0c110 commit 0c16b33

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+170
-5583
lines changed

.dockerignore

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ crates/*/target
33
crates/*/node_modules
44
frontend/node_modules
55
frontend/dist
6-
tools/syn2mas/**
76
docs/
87
.devcontainer/
98
.github/

.github/dependabot.yml

-17
Original file line numberDiff line numberDiff line change
@@ -106,20 +106,3 @@ updates:
106106
browser-logos:
107107
patterns:
108108
- "@browser-logos/*"
109-
110-
- package-ecosystem: "npm"
111-
directory: "/tools/syn2mas/"
112-
labels:
113-
- "A-Dependencies"
114-
- "Z-Deps-Syn2Mas"
115-
schedule:
116-
interval: "weekly"
117-
ignore:
118-
# Ignore @types/node until we can upgrade to Node 20
119-
- dependency-name: "@types/node"
120-
update-types: ["version-update:semver-major"]
121-
groups:
122-
production:
123-
dependency-type: "production"
124-
development:
125-
dependency-type: "development"

.github/scripts/commit-and-tag.cjs

+1-6
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,7 @@ module.exports = async ({ github, context }) => {
1313
const parent = context.sha;
1414
if (!version) throw new Error("VERSION is not defined");
1515

16-
const files = [
17-
"Cargo.toml",
18-
"Cargo.lock",
19-
"tools/syn2mas/package.json",
20-
"tools/syn2mas/package-lock.json",
21-
];
16+
const files = ["Cargo.toml", "Cargo.lock"];
2217

2318
/** @type {{path: string, mode: "100644", type: "blob", sha: string}[]} */
2419
const tree = [];

.github/workflows/build.yaml

-63
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ env:
2323
SCCACHE_GHA_ENABLED: "true"
2424
RUSTC_WRAPPER: "sccache"
2525
IMAGE: ghcr.io/element-hq/matrix-authentication-service
26-
IMAGE_SYN2MAS: ghcr.io/element-hq/matrix-authentication-service/syn2mas
2726
BUILDCACHE: ghcr.io/element-hq/matrix-authentication-service/buildcache
2827
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
2928

@@ -253,22 +252,6 @@ jobs:
253252
type=semver,pattern={{major}}
254253
type=sha
255254
256-
- name: Docker meta (syn2mas)
257-
id: meta-syn2mas
258-
uses: docker/[email protected]
259-
with:
260-
images: "${{ env.IMAGE_SYN2MAS }}"
261-
bake-target: docker-metadata-action-syn2mas
262-
flavor: |
263-
latest=auto
264-
tags: |
265-
type=ref,event=branch
266-
type=ref,event=pr
267-
type=semver,pattern={{version}}
268-
type=semver,pattern={{major}}.{{minor}}
269-
type=semver,pattern={{major}}
270-
type=sha
271-
272255
- name: Setup Cosign
273256
uses: sigstore/[email protected]
274257

@@ -294,7 +277,6 @@ jobs:
294277
./docker-bake.hcl
295278
cwd://${{ steps.meta.outputs.bake-file }}
296279
cwd://${{ steps.meta-debug.outputs.bake-file }}
297-
cwd://${{ steps.meta-syn2mas.outputs.bake-file }}
298280
set: |
299281
base.output=type=image,push=true
300282
base.cache-from=type=registry,ref=${{ env.BUILDCACHE }}:buildcache
@@ -318,43 +300,11 @@ jobs:
318300
env:
319301
REGULAR_DIGEST: ${{ steps.output.outputs.metadata && fromJSON(steps.output.outputs.metadata).regular.digest }}
320302
DEBUG_DIGEST: ${{ steps.output.outputs.metadata && fromJSON(steps.output.outputs.metadata).debug.digest }}
321-
SYN2MAS_DIGEST: ${{ steps.output.outputs.metadata && fromJSON(steps.output.outputs.metadata).syn2mas.digest }}
322303

323304
run: |-
324305
cosign sign --yes \
325306
"$IMAGE@$REGULAR_DIGEST" \
326307
"$IMAGE@$DEBUG_DIGEST" \
327-
"$IMAGE_SYN2MAS@$SYN2MAS_DIGEST"
328-
329-
syn2mas:
330-
name: Release syn2mas on NPM
331-
runs-on: ubuntu-24.04
332-
if: github.event_name != 'pull_request'
333-
334-
permissions:
335-
contents: read
336-
id-token: write
337-
338-
steps:
339-
- name: Checkout the code
340-
uses: actions/[email protected]
341-
342-
- name: Install Node
343-
uses: actions/[email protected]
344-
with:
345-
node-version-file: ./tools/syn2mas/.nvmrc
346-
347-
- name: Install Node dependencies
348-
working-directory: ./tools/syn2mas
349-
run: npm ci
350-
351-
- name: Publish
352-
uses: JS-DevTools/npm-publish@v3
353-
with:
354-
package: ./tools/syn2mas
355-
token: ${{ secrets.NPM_TOKEN }}
356-
provenance: true
357-
dry-run: ${{ !startsWith(github.ref, 'refs/tags/') }}
358308
359309
release:
360310
name: Release
@@ -363,7 +313,6 @@ jobs:
363313
needs:
364314
- assemble-archives
365315
- build-image
366-
- syn2mas
367316
steps:
368317
- name: Download the artifacts from the previous job
369318
uses: actions/download-artifact@v4
@@ -403,18 +352,6 @@ jobs:
403352
') }}
404353
```
405354
406-
`syn2mas` migration tool:
407-
408-
- Digest:
409-
```
410-
${{ env.IMAGE_SYN2MAS }}@${{ fromJSON(needs.build-image.outputs.metadata).syn2mas.digest }}
411-
```
412-
- Tags:
413-
```
414-
${{ join(fromJSON(needs.build-image.outputs.metadata).syn2mas.tags, '
415-
') }}
416-
```
417-
418355
files: |
419356
artifacts/mas-cli-aarch64-linux.tar.gz
420357
artifacts/mas-cli-x86_64-linux.tar.gz

.github/workflows/ci.yaml

-29
Original file line numberDiff line numberDiff line change
@@ -311,34 +311,6 @@ jobs:
311311
--archive-file nextest-archive.tar.zst \
312312
--partition count:${{ matrix.partition }}/3
313313
314-
syn2mas:
315-
name: Check syn2mas
316-
runs-on: ubuntu-24.04
317-
318-
permissions:
319-
contents: read
320-
321-
steps:
322-
- name: Checkout the code
323-
uses: actions/[email protected]
324-
325-
- name: Install Node
326-
uses: actions/[email protected]
327-
with:
328-
node-version-file: ./tools/syn2mas/.nvmrc
329-
330-
- name: Install Node dependencies
331-
working-directory: ./tools/syn2mas
332-
run: npm ci
333-
334-
- name: Lint
335-
working-directory: ./tools/syn2mas
336-
run: npm run lint
337-
338-
- name: Build
339-
working-directory: ./tools/syn2mas
340-
run: npm run build
341-
342314
tests-done:
343315
name: Tests done
344316
if: ${{ always() }}
@@ -352,7 +324,6 @@ jobs:
352324
- clippy
353325
- check-schema
354326
- test
355-
- syn2mas
356327
runs-on: ubuntu-24.04
357328

358329
steps:

.github/workflows/tag.yaml

-4
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ jobs:
4040
- name: Run `cargo metadata` to make sure the lockfile is up to date
4141
run: cargo metadata --format-version 1
4242

43-
- name: Set the tools/syn2mas version
44-
working-directory: tools/syn2mas
45-
run: npm version "${{ inputs.version }}" --no-git-tag-version
46-
4743
- name: Commit and tag using the GitHub API
4844
uses: actions/[email protected]
4945
id: commit

biome.json

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"frontend/.storybook/locales.ts",
2222
"frontend/.storybook/public/mockServiceWorker.js",
2323
"frontend/locales/*.json",
24-
"tools/syn2mas/package.json",
2524
"**/coverage/**",
2625
"**/dist/**"
2726
]

docker-bake.hcl

+1-7
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
variable "VERGEN_GIT_DESCRIBE" {}
55

66
// This is what is baked by GitHub Actions
7-
group "default" { targets = ["regular", "debug", "syn2mas"] }
7+
group "default" { targets = ["regular", "debug"] }
88

99
// Targets filled by GitHub Actions: one for the regular tag, one for the debug tag
1010
target "docker-metadata-action" {}
1111
target "docker-metadata-action-debug" {}
12-
target "docker-metadata-action-syn2mas" {}
1312

1413
// This sets the platforms and is further extended by GitHub Actions to set the
1514
// output and the cache locations
@@ -37,8 +36,3 @@ target "debug" {
3736
inherits = ["base", "docker-metadata-action-debug"]
3837
target = "debug"
3938
}
40-
41-
target "syn2mas" {
42-
inherits = ["base", "docker-metadata-action-syn2mas"]
43-
context = "./tools/syn2mas"
44-
}

docs/SUMMARY.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
- [Database setup](./setup/database.md)
1313
- [Homeserver configuration](./setup/homeserver.md)
1414
- [Configuring a reverse proxy](./setup/reverse-proxy.md)
15-
- [Configuring .well-known](./setup/well-known.md)
1615
- [Configure an upstream SSO provider](./setup/sso.md)
1716
- [Running the service](./setup/running.md)
1817
- [Migrating an existing homeserver](./setup/migration.md)
@@ -33,6 +32,7 @@
3332
- [`database`](./reference/cli/database.md)
3433
- [`manage`](./reference/cli/manage.md)
3534
- [`server`](./reference/cli/server.md)
35+
- [`syn2mas`](./reference/cli/syn2mas.md)
3636
- [`worker`](./reference/cli/worker.md)
3737
- [`templates`](./reference/cli/templates.md)
3838
- [`doctor`](./reference/cli/doctor.md)

docs/reference/cli/config.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ clients:
2626
# ...
2727
```
2828

29-
## `config generate`
29+
## `config generate [--synapse-config <synapse-config>] [--output <output>]`
3030

3131
Generate a sample configuration file.
3232
It generates random signing keys (`.secrets.keys`) and the cookie encryption secret (`.secrets.encryption`).
@@ -38,6 +38,10 @@ INFO generate:rsa: mas_config::oauth2: Done generating RSA key
3838
INFO generate:ecdsa: mas_config::oauth2: Done generating ECDSA key
3939
```
4040

41+
The `--synapse-config` option can be used to migrate over configuration options from an existing Synapse configuration.
42+
43+
The `--output` option can be used to specify the output file. If not specified, the output will be written to stdout.
44+
4145
## `config sync [--prune] [--dry-run]`
4246

4347
Synchronize the configuration with the database.
@@ -52,4 +56,4 @@ INFO cli.config.sync: Updating provider provider.id=01H3FDH2XZJS8ADKRGWM84PZTY
5256
INFO cli.config.sync: Adding provider provider.id=01H3FDH2XZJS8ADKRGWM84PZTF
5357
INFO cli.config.sync: Deleting client client.id=01GFWRB9MYE0QYK60NZP2YF905
5458
INFO cli.config.sync: Updating client client.id=01GFWRB9MYE0QYK60NZP2YF904
55-
```
59+
```

docs/reference/cli/syn2mas.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# `syn2mas`
2+
3+
Tool to import data from an existing Synapse homeserver into MAS.
4+
5+
Global options:
6+
- `--config <config>`: Path to the MAS configuration file.
7+
- `--help`: Print help.
8+
- `--synapse-config <synapse-config>`: Path to the Synapse configuration file.
9+
- `--synapse-database-uri <synapse-database-uri>`: Override the Synapse database URI.
10+
11+
## `syn2mas check`
12+
13+
Check the setup for potential problems before running a migration
14+
15+
```console
16+
$ mas-cli syn2mas check --config mas_config.yaml --synapse-config homeserver.yaml
17+
```
18+
19+
## `syn2mas migrate [--dry-run]`
20+
21+
Migrate data from the homeserver to MAS.
22+
23+
The `--dry-run` option will perform a dry-run of the migration, which is safe to run without stopping Synapse.
24+
It will perform a full data migration, but then empty the MAS database at the end to roll back.
25+
26+
27+
```console
28+
$ mas-cli syn2mas migrate --config mas_config.yaml --synapse-config homeserver.yaml
29+
```

docs/setup/README.md

+1-33
Original file line numberDiff line numberDiff line change
@@ -11,43 +11,11 @@ The authentication service becomes the source of truth for user accounts and acc
1111
At time of writing, the authentication service is meant to be run on a standalone domain name (e.g. `auth.example.com`), and the homeserver on another (e.g. `matrix.example.com`).
1212
This domain will be user-facing as part of the authentication flow.
1313

14-
When a client initiates an authentication flow, it will discover the authentication service through the deployment `.well-known/matrix/client` endpoint.
15-
This file will refer to an `issuer`, which is the canonical name of the authentication service instance.
16-
Out of that issuer, it will discover the rest of the endpoints by calling the `[issuer]/.well-known/openid-configuration` endpoint.
17-
By default, the `issuer` will match the root domain where the service is deployed (e.g. `https://auth.example.com/`), but it can be configured to be different.
18-
1914
An example setup could look like this:
2015

2116
- The deployment domain is `example.com`, so Matrix IDs look like `@user:example.com`
22-
- The issuer chosen is `https://auth.example.com/`
23-
- The homeserver is deployed on `matrix.example.com`
2417
- The authentication service is deployed on `auth.example.com`
25-
- Calling `https://example.com/.well-known/matrix/client` returns the following JSON:
26-
27-
```json
28-
{
29-
"m.homeserver": {
30-
"base_url": "https://matrix.example.com"
31-
},
32-
"org.matrix.msc2965.authentication": {
33-
"issuer": "https://auth.example.com/",
34-
"account": "https://auth.example.com/account"
35-
}
36-
}
37-
```
38-
39-
- Calling `https://auth.example.com/.well-known/openid-configuration` returns a JSON document similar to the following:
40-
41-
```json
42-
{
43-
"issuer": "https://auth.example.com/",
44-
"authorization_endpoint": "https://auth.example.com/authorize",
45-
"token_endpoint": "https://auth.example.com/oauth2/token",
46-
"jwks_uri": "https://auth.example.com/oauth2/keys.json",
47-
"registration_endpoint": "https://auth.example.com/oauth2/registration",
48-
"//": "..."
49-
}
50-
```
18+
- The homeserver is deployed on `matrix.example.com`
5119

5220
With the installation planned, it is time to go through the installation and configuration process.
5321
The first section focuses on [installing the service](./installation.md).

0 commit comments

Comments
 (0)