River UI consists of two apps: a Go backend API, and a TypeScript UI frontend.
The project uses a combination of direnv and dotenv (to suit Vite conventions). Copy the example and edit as necessary:
cp .envrc.sample .envrc
direnv allowDirenv's .envrc sources dotenv's .env.local to make all variables available in your shell, along with a .env if it exists. Both .env and .env.local get read by npm run dev.
go get ./...
npm installThis project uses Reflex for local dev. Install it.
go install github.com/cespare/reflex@latestmake devBy default the Go backend starts at http://localhost:8080 and the Vite React frontend starts at http://localhost:5173.
$ createdb river_dev
$ go install github.com/riverqueue/river/cmd/river
$ river migrate-up --database-url postgres://localhost/river_devUsing Docker compose, you can skip the database migration steps for testing and development.
The database will be bound to localhost:5432.
# start/restart
make docker-db/up
# stop
make docker-db/downRaise test database:
$ createdb river_test
$ river migrate-up --database-url postgres://localhost/river_testRun tests:
$ go test ./...Alternatively, build the TypeScript API to dist, which will be included in the Go API's bundle during compilation, if it's present:
$ npm run build-
Fetch changes to the repo and any new tags. Export
VERSIONby incrementing the last tag:git checkout master && git pull --rebase export VERSION=v0.x.y git checkout -b $USER-$VERSION
-
Prepare a PR with the changes, updating
CHANGELOG.mdwith any necessary additions at the same time. Have it reviewed and merged. -
Upon merge, pull down the changes, tag the main riverui module with the new version, and push the new tag:
git pull origin master git tag $VERSION git push --tags -
The build will cut a new release and create binaries automatically, but it won't have a good release message. Go the release list, find
$VERSIONand change the description to the release content inCHANGELOG.md(again, the build will have to finish first).
The riverproui submodule depends on the top level riverui module and in development it is customary to leave a replace directive in its go.mod so that it can be developed against the live local version. However, this replace directive makes it incompatible with go install ...@latest.
As such, we must use a two-phase release for these modules:
-
Release
riveruiwith an initial version (i.e. all the steps above). -
Comment out
replacedirectives to riverui./riverproui/go.mod. These were probably needed for developing the new feature, but need to be removed because they prevent the module from beinggo install-able. -
From
./riverproui,go getto upgrade to the main package versions were just released (make sure you're getting$VERSIONand not thwarted by shenanigans in Go's module proxy):cd ./riverproui go get -u riverqueue.com/riverui@$VERSION
-
Run
go mod tidy:go mod tidy
-
Prepare a PR with the changes. Have it reviewed and merged.
-
Pull the changes back down, add a tag for
riverproui/$VERSION, and push it to GitHub:git pull origin master git tag riverproui/$VERSION -m "release riverproui/$VERSION" git push --tags
The main
$VERSIONtag andriverproui/$VERSIONwill point to different commits, and although a little odd, is tolerable.