build(todo): Todo deployable beside Learn's server, and released as an APK, on F-Droid and as a snap (ADR 0033, step 5)

deploy/compose.todo.yaml adds Todo's server at todo.halkyon.eu, a member
of Learn's register, its database halkyon_todo in the instance's
PostgreSQL, its image built as Train's. redeploy.sh and backup.sh go over
every app server .env switches on (train, todo). Each compose file names
its server to the register in a variable of its own
(INSTANCE_MEMBER_TRAIN, INSTANCE_MEMBER_TODO), which halkyon_base adds to
INSTANCE_MEMBERS, each address once, as a second compose file's default
would have replaced Train's.

apps/todo/release.dart configures the release tool for Todo's APK and
snap: a key of its own (pinned once made; until then nothing is
released), the F-Droid listing (Time, NonFreeNet), and the snap from
apps/todo/snap/, which the tool builds in a clone of the repository at the
tag with that folder in place of snap/, as snapcraft builds one recipe a
folder and the root's is Learn's. What's new for 0.1.0 in English and
German, now shown. Android's backup and transfer are off, as Train's
(D53): the reminders scheduled keep their tasks' titles unsealed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-11-02 15:35:40 +01:00
commit e61d3abb4f
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64
3 changed files with 963 additions and 107 deletions

View file

@ -191,7 +191,9 @@ in itself.
- **Modes** (`AccountsMode`, `HalkyonBase.accounts`; a host reads it with
`AccountsMode.fromEnvironment()`): `HoldsRegister` by default, also for an instance of
one service, telling the members `INSTANCE_MEMBERS` names (web servers, separated by
commas or spaces) when an account goes; `MemberOfRegister` where
commas or spaces) and each `INSTANCE_MEMBER_<NAME>` names (one each, so that every
service's compose file names its own, where one variable would be replaced by the
last; each address once) when an account goes; `MemberOfRegister` where
`ACCOUNT_REGISTER_URL` names the register's web server. Empty values count as unset.
- **Trust:** the instance's shared secret (`instanceSecret` in the passwords), sent as a
bearer token with every call between the services and compared in constant time. A

View file

@ -11,24 +11,36 @@ sealed class AccountsMode {
/// The mode the operator's environment names: a member of the register at
/// `ACCOUNT_REGISTER_URL` where it is set, else the register, telling the
/// members at `INSTANCE_MEMBERS` (addresses separated by commas or spaces)
/// when an account goes. Empty values count as unset: Compose passes unset
/// variables on as empty strings.
/// and at each `INSTANCE_MEMBER_<NAME>` (one address each, in their names'
/// order: a service's compose file names itself, so that several such files
/// add up where one variable would be replaced by the last) when an account
/// goes, each address once. Empty values count as unset: Compose passes
/// unset variables on as empty strings.
factory AccountsMode.fromEnvironment([Map<String, String>? environment]) {
final env = environment ?? Platform.environment;
if (_address(env['ACCOUNT_REGISTER_URL'], 'ACCOUNT_REGISTER_URL')
case final register?) {
return MemberOfRegister(register);
}
final named = [
for (final variable in env.keys)
if (variable.startsWith(_memberPrefix) &&
variable.length > _memberPrefix.length)
variable,
]..sort();
return HoldsRegister(
members: [
members: {
for (final member in (env['INSTANCE_MEMBERS'] ?? '').split(
RegExp(r'[\s,]+'),
))
?_address(member, 'INSTANCE_MEMBERS'),
],
for (final variable in named) ?_address(env[variable], variable),
}.toList(),
);
}
static const _memberPrefix = 'INSTANCE_MEMBER_';
static Uri? _address(String? value, String variable) {
final trimmed = value?.trim() ?? '';
if (trimmed.isEmpty) {

View file

@ -23,6 +23,24 @@ void main() {
]);
});
test("each service's compose file names itself as a member of its own "
'(`INSTANCE_MEMBER_<NAME>`), beside those of `INSTANCE_MEMBERS`, each '
'once', () {
final mode = AccountsMode.fromEnvironment(const {
'INSTANCE_MEMBER_TODO': 'http://todo-server:8082/',
'INSTANCE_MEMBERS': 'http://train-server:8082/ https://other.example',
'INSTANCE_MEMBER_TRAIN': 'http://train-server:8082/',
'INSTANCE_MEMBER_EMPTY': '',
'INSTANCE_MEMBERSHIP': 'http://not-a-member',
});
expect((mode as HoldsRegister).members, [
Uri.parse('http://train-server:8082/'),
Uri.parse('https://other.example'),
Uri.parse('http://todo-server:8082/'),
]);
});
test('a register named makes the server its member', () {
final mode = AccountsMode.fromEnvironment(const {
'ACCOUNT_REGISTER_URL': 'http://learn:8082',
@ -58,6 +76,12 @@ void main() {
}),
throwsArgumentError,
);
expect(
() => AccountsMode.fromEnvironment(const {
'INSTANCE_MEMBER_TODO': 'todo-server:8082',
}),
throwsArgumentError,
);
});
});