rueder.example.env
to rueder-prod.env
and
1.1 change LOGINSRV_JWT_SECRET
and RUEDER_JWT
to something secure (eg. the output of pwgen -s 128 1
)
1.2 change LOGINSRV_SIMPLE
to something else, however you want to authenticate your usersdocker-compose.yaml
to match your setup's imgproxy URLdocker-compose build
docker-compose up -d db
docker-compose -f docker-compose.initdb.yaml up
, then
Ctrl+C
after it's donedocker-compose up -d
While the docker-compose.*
files in the main directory are for production use
the ones inside backend/
and frontend/
are intended for development purposes.
The Dockerfiles for production and development are named Dockerfile
and
Dockerfile.dev
respectively and are located next to each other in the docker
sub-directories inside the backend and frontend directories.
To start a local instance of rueder3
with hot-reload on code changes, simply do:
make run
# OR
docker-compose up --force-recreate --build
inside backend/
directory in one terminal and inside frontend/
directory in
another terminal. If you prefer to run the frontend without a docker container
you can also use pnpm dev
instead.
First run: On the first run you need to initialize the database by running
./utils/reset_db.sh
from the backend/
directory. Restart all containers after this.
Note: Please use the provided Git hooks to make sure your changes pass linting and testing.
The commands above spawn the following services, all listening on localhost:
Open the web frontend and login with user bob
and password secret
.
You can also access the Swagger docs at http://127.0.0.1:8080/swagger/index.html for the Feed API, and http://127.0.0.1:8081/swagger/index.html for the Feedfinder.
Development Requirements:
GOPATH
environment variable is set)After installing these requirements and cloning the repository do these steps to set up Git hooks:
# install pre-commit (mainly for backend stuff)
pipx install pre-commit
# note that something like ~/.local/bin needs to be in your PATH
pre-commit install
# install husky (mainly for frontend stuff)
cd frontend
pnpm install
# DO NOT run husky install
This installs pre-commit which is triggered on Git commits.
The included config file .pre-commit-config.yaml
then runs some backend checks
and finally runs husky for frontend checks
using frontend/.husky/
.
To just check if everything is in order:
pre-commit run --all-files
For backend use gofmt
for formatting and the linters configured in golangci-lint
.
Use make lint
inside ./backend
directory to lint all files.
For frontend use (inside ./frontend
directory) pnpm format
for formatting
and as linters use pnpm lint
and pnpm validate
.
Look at the GitHub Workflows in .github
if anything is unclear.
Use make test
inside ./backend
to run tests using the included _test.go
files.
When you change something which affects test execution in APIPopRepository
you need to start the test database service with docker-compose up db
in ./backend
and then run make test_record
to update copyist's logfiles. The updated files
need to be committed, too.
Use pnpm test
to run tests with Jest using the included .test.ts
files.
Before deploying to production you can test the production build of the
frontend with pnpm preview
with the development version of the backend.
You can also test production backend and frontend with:
cp config/rueder.example.env config/rueder-test.env
# edit rueder-test.env to set LOGINSRV_JWT_SECRET and RUEDER_JWT values
docker network create http_default
docker-compose -f docker-compose.test.yaml up
The test-prod build will be accessible under http://127.0.0.1:5000/rueder/.