diff --git a/.env.example b/.env.example index 52181c2..0142512 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,3 @@ REGISTRATION_SHARED_SECRET='look in your synapses homeserver.yaml' +AS_TOKEN='look in the app-service.yaml' EXCLUDED_USERS='rocket.cat' # Comma-separated list of usernames or IDs diff --git a/README.md b/README.md index ac6c38e..4d99f76 100644 --- a/README.md +++ b/README.md @@ -14,13 +14,15 @@ mongoexport --collection=users --db=rocketchat --out=users.json Export them to `inputs/` -## Running the Matrix Dev Server +## Configuring the Matrix Dev Server + +Generate a Synapse homeserver config with the following command (you might change `my.matrix.host` for the actual server name, as it can't be changed afterwards): ```shell docker-compose run --rm -e SYNAPSE_SERVER_NAME=my.matrix.host -e SYNAPSE_REPORT_STATS=no synapse generate ``` -To run the script without hitting rate limiting, you SHOULD add the following options to the freshly generated `files/homeserver.yaml`. **Do not leave these in the production setup!** +To run the script without hitting rate limiting and activating an *Application Service* to send messages by different users with our desired timestamps, you MUST add the following options to the freshly generated `files/homeserver.yaml`. **Do not leave these in the production setup!** ```yaml rc_joins: @@ -43,9 +45,17 @@ rc_invites: per_issuer: per_second: 1024 burst_count: 2048 +app_service_config_files: + - /data/app-service.yaml ``` -Continue setting up the server: +Now edit `app-service.example.yaml` and save it at `files/app-service.yaml`, changing the tokens. + +Copy over `.env.example` to `.env` and insert your values. + +## Starting the Matrix Dev Server + +Boot up the container and (for the first time starting the server or after resetting it manually) create an admin user: ```shell docker-compose up -d @@ -65,12 +75,12 @@ curl --request POST \ > src/config/synapse_access_token.json ``` +## Installing and Running the Script + +Install NodeJS and npm on your system, install the script's dependencies via `npm install`. + To finally run the script, execute it via `npm start`. -## Configuration - -Copy over `.env.example` to `.env` and insert your values. - ## Running Tests `npm test`. @@ -85,7 +95,7 @@ sudo rm files/homeserver.db rm db.sqlite ``` -Then you can restart with an empty but quite equal server, following the instructions above, excluding the `generate` command. +Then you can restart with an empty but quite equal server, following the instructions above to start the dev server. ## Design Decisions diff --git a/app-service.example.yaml b/app-service.example.yaml new file mode 100644 index 0000000..6075f18 --- /dev/null +++ b/app-service.example.yaml @@ -0,0 +1,9 @@ +id: "rc2matrix migration" +url: "http://127.0.0.1:1234" +as_token: "30c05ae90a248a4188e620216fa72e349803310ec83e2a77b34fe90be6081f46" # Change me to something different and random +hs_token: "312df522183efd404ec1cd22d2ffa4bbc76a8c1ccf541dd692eef281356bb74e" # Change me to something different and random +sender_localpart: "_rc_migration_bot" +namespaces: + users: + - exclusive: false + regex: "@.*"