Gridiron
GoLang Modular Monolith designed to track American Football data.
ChatGPT 3.5 was heavily used for "busy" or "repetitive" work.
Setup
Offline - Locally
-
Configure Rabbit MQ
Start docker container running Rabbit MQ local.
docker compose --env-file ./.env.offline -f ./deployments/docker-compose.yml up gridiron-rabbitmq -d
-
Configure Database
Start docker container running Postgres local.
docker compose --env-file ./.env.offline -f ./deployments/docker-compose.yml up gridiron-db -d
-
Run Migrations
Check .env.offline and verify the correct username, password, host, and db is being used in the below command.
Run migrations
docker run -v ./deployments/sql/migrations:/migrations migrate/migrate -path migrations/ -database "postgres://my_user:my_password@host.docker.internal/my_db?sslmode=disable" up
-
Run Gridiron
Run the Gridiron docker container with
docker compose --env-file ./.env.offline -f ./deployments/docker-compose.yml up -d gridiron-service
You can rebuild the and run the app with the following
docker compose --env-file ./.env.offline -f ./deployments/docker-compose.yml up -d --no-deps --build gridiron-service
-
Run Web (React UI)
Run the Gridiron React App docker container
docker compose --env-file ./.env.offline -f ./deployments/docker-compose.yml up gridiron-web -d
You can visit the app at http://localhost:3000
Clean Up
You can easily clean up your local environment with the following...
-
Mark the bash script as executable.
chmod +x scripts/docker-nuke.sh
-
Run script to nuke environment
./scripts/docker-nuke.sh
Testing
Due to time constraints, I've opted to skip writing unit tests and instead rely solely on integration tests. While unit tests are valuable for isolating components, the effort required to mock data stores and other classes in Go can be significant. Given that this project is a demo, integration tests should suffice for validating the functionality.
go test ./test/...
Technical Design
Technical Design Document
Contributing
This project follows Feature branch workflow
Migrations
This project uses Migrate to manage migrations.
The following command can be used to generate a new migration.
migrate create -ext sql -dir deployments/sql/migrations/ -seq <name>
License
ISC License