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
9 changes: 9 additions & 0 deletions .github/workflows/backend-docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,15 @@ jobs:
fi
echo "Backend is running $RUNNING_IMAGE"

# Record the deployed version in .env so compose commands run by hand
# on the server keep this image instead of an older tag.
if grep -q '^IMAGE_TAG=' .env; then
sed -i "s/^IMAGE_TAG=.*/IMAGE_TAG=$IMAGE_TAG/" .env
else
printf '%s=%s\n' IMAGE_TAG "$IMAGE_TAG" >> .env
fi
echo "Recorded IMAGE_TAG=$IMAGE_TAG in .env"

echo "Recent backend logs:"
docker compose "${COMPOSE_FILES[@]}" logs --tail 40 bitfinance-api
REMOTE
9 changes: 9 additions & 0 deletions .github/workflows/mcp-docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,4 +242,13 @@ jobs:
exit 1
fi
echo "MCP server is running $RUNNING_IMAGE"

# Record the deployed version in .env so compose commands run by hand
# on the server keep this image instead of an older tag.
if grep -q '^MCP_IMAGE_TAG=' .env; then
sed -i "s/^MCP_IMAGE_TAG=.*/MCP_IMAGE_TAG=$MCP_IMAGE_TAG/" .env
else
printf '%s=%s\n' MCP_IMAGE_TAG "$MCP_IMAGE_TAG" >> .env
fi
echo "Recorded MCP_IMAGE_TAG=$MCP_IMAGE_TAG in .env"
REMOTE
4 changes: 3 additions & 1 deletion docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ All publish workflows build from the release tag (`<app>/v<version>`), first che
- pull the `bitfinance-api` image with `IMAGE_TAG=<version>`;
- apply database migrations with `docker compose run --rm --no-deps bitfinance-api --migrate`;
- recreate the `bitfinance-api` container from the new image.
- record the version as `IMAGE_TAG` in the server's `.env`.

The deploy prints the service status and recent logs, including when it fails.

Expand All @@ -87,6 +88,7 @@ The deploy prints the service status and recent logs, including when it fails.
2. On the server, in `DEPLOY_PATH`, with `MCP_IMAGE_TAG=<version>`:
- pulls the new `bitfinance-mcp-server` image;
- recreates the `bitfinance-mcp-server` container from it. `--no-deps` leaves the API, database and cache untouched.
- records the version as `MCP_IMAGE_TAG` in the server's `.env`.

The backend and the MCP server share the compose project in `apps/backend` (`docker-compose.prod.yml` defines both services) and the same `DEPLOY_PATH`.

Expand All @@ -105,7 +107,7 @@ To put an earlier release back in production, run that app's publish workflow ma
Things to know:

- **Backend migrations are not reverted.** A rollback runs the older image's migrations, which only applies missing ones. If the newer release changed the schema in a way the older code cannot handle, revert the schema with a new migration instead of rolling back.
- **`latest` moves with every publish, including a republish.** The deploys set the image tag explicitly, so a `docker compose up` on the server without `IMAGE_TAG` / `MCP_IMAGE_TAG` uses the value in the server's `.env`.
- **`latest` moves with every publish, including a republish.** The deploys never use it: they set the image tag explicitly and, once the new container runs, record it as `IMAGE_TAG` / `MCP_IMAGE_TAG` in the server's `.env`. A `docker compose` command run by hand on the server therefore keeps the deployed versions.
- **Pushing a tag by hand deploys nothing.** Publishing only happens through Release or a manual run of a publish workflow.

## Configuration
Expand Down
Loading