Files
alextab93 af5fa8ca64
Build and deploy StartOS package / build (push) Failing after 1m25s
Automate StartOS package releases
2026-08-08 21:14:10 -05:00

46 lines
2.1 KiB
Markdown

# Todo Back
Todo Back is a deliberately small Rails JSON API packaged as a native StartOS 0.4 service. Its purpose is to validate the complete local-build → `.s9pk` → sideload workflow before investing in a larger application.
The interface root also serves a dependency-free browser page for quickly exercising every todo operation.
## API
- `GET /up` — Rails and PostgreSQL health check
- `GET /todos` — list todos
- `GET /todos/:id` — fetch one todo
- `POST /todos` — create with `{ "todo": { "title": "...", "completed": false } }`
- `PATCH /todos/:id` — update title and/or completion state
- `DELETE /todos/:id` — delete a todo
## Architecture
The package builds the Rails application from the root `Dockerfile` and runs PostgreSQL 17 as a second StartOS subcontainer. PostgreSQL data, Rails local storage, and generated secrets are persisted in separate StartOS volumes. On every start, PostgreSQL becomes healthy, `bin/rails db:prepare` runs, and then Puma starts on port 3000. StartOS publishes that port as an API interface and terminates TLS.
`SECRET_KEY_BASE` and the database password are generated during installation and stored in the backed-up config volume. Backups use the SDK PostgreSQL dump integration and also include config and local storage.
## Development
Install application dependencies and run tests:
```sh
bundle install
bin/rails db:prepare
bin/rails test
```
Build the x86_64 sideload package from inside a StartOS packaging workspace:
```sh
npm install
make x86
```
The resulting `todo-back_x86_64.s9pk` can be uploaded from StartOS under **System → Sideload Service**.
Gitea Actions builds an artifact for each push to `main`. A matching StartOS extended-SemVer tag, such as `v0.2.0_0` for package version `0.2.0:0`, additionally installs the package through the configured Gitea runner. See `.ai-workspace/UPDATING.md` for the release policy and runner requirements.
## Status
This is an unauthenticated MVP intended for sideload testing on a trusted network. Add authentication before exposing its interface beyond trusted gateways.