Copy .env.example
to .env
, and config/redis.conf.example
to config/redis.conf
, and (optionally) modify them.
These files are required for building and running the tripreporter. This step is necessary for both development and production use.
This is intended for production use.
This will run on http://localhost:3000
by default.
# Normal usage, re-running the command should rebuild quickly by using caches.
docker compose up -d
# If you have issues / want to troubleshoot, use this command to force re-build (add -d to run in background)
docker-compose up --build --force-recreate --no-deps
Before you can run the project outside of Docker, you need to have accessible PostgreSQL and Redis databases running.
- Setup PostgreSQL
-
Either install it via your package manager or follow the instructions on their official website.
-
Once installed, start the service. On most systems, this will be
sudo systemctl enable --now postgresql
. -
Now, follow the rest of their official documentation, starting here, in order to create a database that matches the PostgreSQL variables in
.env
. -
This initial setup is only required once.
- Setup Redis
-
Either install it via your package manager or follow the instructions on their official website.
-
Once installed,
cd
to the project directory, then runredis-server --daemonize yes config/redis.conf
. -
Running
redis-server
is required once per boot, whenever you want to be running the project.
Optionally, if you would like to enable autostart, edit theredis-tripreporter.service
file, and then run the following in the project directory:
mkdir -p ~/.config/systemd/user/
cp config/redis-tripreporter.service ~/.config/systemd/user/
systemctl --user enable --now redis-tripreporter
-
Run
make
in the project directory.
This is required only once, to have caches of static files formake dev-server
. -
Run
make dev-ui
andmake dev-server
in two separate terminals. They should both be running simultaneously. Congratulations, you now have a working development environment, navigate to http://localhost:3000.
This allows for hot reloading the Vue frontend, just re-runmake dev-server
when making changes to the Go backend.
The advantage of such a setup means you can replace either the backend or frontend while one of them is running.
An example of a senario where this can be incredibly useful is when testing different versions of the code at a certain commit to find out when a bug was introduced, to assist with debugging.
Another useful scenario is if you want to make a cleangit clone
of the project and use either the backend / frontend from it, while running the "dirty" local counterpart to rule out places in the codebase where a bug could come from, or if you'd like to swap between two versions of the frontend to quickly compare the changes made to it.