See issue #127
Install docker desktop and run cd backend; docker-compose up --build -d
to start the backend. Visit http://localhost:5127/ for the Directus UI, credentials are admin@admin.com:password. Go to http://localhost:5125/ to view swagger.
Run cd frontend; npm install; npm run dev
for the front-end. This project also supports bun. Install bun and replace all usages of npm with bun.
Note: To allow a PWA to work in development in Chromium browsers you must start it with an additional command line flag --ignore-certificate-errors
:
chromium --ignore-certificate-errors http://localhost:8080
Or in PowerShell:
Start-Process "C:\Program Files\Google\Chrome\Application\chrome.exe" -ArgumentList "--ignore-certificate-errors", "http://localhost:8080"
You can import the test data files in Directus in this order:
- families...json
- games...json
- leagues...json
- teams...json
- matches...json
- settings...json
There is a points json file, and you can import this to see what the actual points were at the end of ubg, but the points do not have to be imported, because this table will be populated during the game when scores are registered.
Go to Google Cloud Console > sidebar > SQL > buk-universal-games-pgsql-prod > sidebar > cloud SQL Studio
- Database: buk-universal-games-prod
- User: buk-universal-games-prod-default
- You can find the password by going to: Cloud run > buk-universal-games-api-prod > Revisions > Environment Variables > Press the link which says
buk-universal-games-api-prod-POSTGRES_PASSWORD
> Press 3 dots on the single row which shows up > View secret value. This is the password for the database user.
- Visit: http://localhost:5126/
- Log in with: admin@admin.com / password (Note: You may get stuck in a redirect loop on Firefox, use Chrome instead)
- Right click "Servers"->Register->Server...
- Add following parameters
- Name: buk-universal-games
- (Under connection)
- Host name:
host.docker.internal
on Windows / Mac (otherwise, see below) - Port:
5432
- Username:
admin
- Password:
password
- Host name:
- Database tables can be found under
buk-universal-games->Schemas->public
On Windows and MacOS, these DNS entries are auto-added. On Linux systems, this doesn't seem to be the case.
Instead run ip route
to get a list of adapter routes:
default via 192.168.2.254 dev eth0 proto dhcp metric 100
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
172.18.0.0/16 dev br-9a750de8dfd7 proto kernel scope link src 172.18.0.1
192.168.2.0/24 dev eth0 proto kernel scope link src 192.168.2.51 metric 100
In this case you can see three routing configurations:
docker0
the default network adapter for dockerbr-9a750de8dfd7
a bridge adapter created by docker-composeeth0
thedefault
LAN connection of the machine.
To connect to the database, use the gateway address for the docker-compose bridge adapter. This represents access to the buk-universal-games
network defined in the docker compose file. The IP to use is therefore 172.18.0.1
.
Note: If you're running multiple docker-compose configurations with custom networks at the same time, you'll see multiple bridge adapters and you'll have to guess which one is correct. There are of course more deterministic ways to find which one is correct, please expand this document with such methods if you find you need them.
cd .\backend\Buk.UniversalGames.Data\
dotnet tool install --global dotnet-ef
dotnet ef migrations add [Migration Name]
Migrations are automatically applied when the a new version of the application is deployed.
https://buk-universal-games-directus-prod-lo75nlp2va-ez.a.run.app/
This link may change when a new server is made. Ask Reng for new url in this case.