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
26 changes: 26 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,29 @@
# -- Copybutton configuration -------------------------------------------------
copybutton_exclude = ".linenos, .gp"
copybutton_selector = "div:not(.no-copybutton) > div.highlight > pre"

# -- Version substitution -----------------------------------------------------
# Replaced in all source and included files, including inside code blocks

node_version = "v0.1.1"
_SUBSTITUTIONS = {"|node_version|": node_version}


def _substitute(content: list[str]) -> None:
"""Replace substitution tokens in raw source content (in place)."""
for token, value in _SUBSTITUTIONS.items():
content[0] = content[0].replace(token, value)


def _on_source_read(app, docname, content) -> None:
_substitute(content)


def _on_include_read(app, relative_path, parent_docname, content) -> None:
_substitute(content)


def setup(app) -> None:
"""Register source substitution hooks."""
app.connect("source-read", _on_source_read)
app.connect("include-read", _on_include_read)
10 changes: 10 additions & 0 deletions docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,13 @@ fl_ready_dataset
fedbiomed_node_part_1
fedbiomed_node_part_2
```

```{toctree}
---
hidden:
includehidden:
titlesonly:
caption: Maintenance
---
node_update
```
2 changes: 1 addition & 1 deletion docs/source/initial_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Clone and enter the [`brainflex-node`](https://github.com/neurodatascience/brainflex-node) repository:

```bash
git clone --branch v0.1.1 https://github.com/neurodatascience/brainflex-node
git clone --branch |node_version| https://github.com/neurodatascience/brainflex-node
cd brainflex-node
```

Expand Down
86 changes: 86 additions & 0 deletions docs/source/node_update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Updating the node

When a new version of [`brainflex-node`](https://github.com/neurodatascience/brainflex-node) is released, follow these steps to update to the latest version (**|node_version|**).

```{include} _includes/working_directory.md
```

## Update the code

First, check whether you created a work branch:

```bash
git branch --show-current
```

If this prints `work` (or another branch name you created):

```bash
git fetch origin tag |node_version| --no-tags
git merge --no-edit |node_version|
```

If this prints nothing (you skipped the optional `git switch -c work` step in [Initial setup](initial_setup.md)):

```bash
git fetch origin tag |node_version| --no-tags
git switch --detach |node_version|
```

To confirm the update worked, run:

```bash
git describe --tags
```

If you have no commits of your own, this prints `|node_version|`.
If you merged into a branch that had your own commits, it prints something like `|node_version|-2-gabc1234`, which is also fine.

### Troubleshooting: uncommitted changes

If you edited files tracked by Git (e.g. `docker-compose.yml`), the update stops with an error like:

```{code-block}
:caption: Output
error: Your local changes to the following files would be overwritten by [merge|checkout]:
docker-compose.yml
Please commit your changes or stash them before you [merge|switch branches].
Aborting
```

Nothing has been changed yet: your files and your version are as they were.
Commit your changes so they are kept, then update again.

If `git branch --show-current` printed `work` (or another branch name):

```bash
git commit -a -m "My local changes"
git merge --no-edit |node_version|
```

If it printed nothing, first create a branch so that your commit is not lost, then update with `git merge` (not `git switch --detach`):

```bash
git switch -c work
git commit -a -m "My local changes"
git merge --no-edit |node_version|
```

## Update Python dependencies

With your virtual environment (or `conda` environment) activated, run:

```bash
uv pip install -r requirements.txt # or: pip install -r requirements.txt
```

This only installs packages that are new or changed in this version.

## Restart the Fed-BioMed node

Only do this if you have already started the node (see [Fed-BioMed node: Part 1](fedbiomed_node_part_1.md)):

```bash
docker compose down
docker compose up -d
```