Repository for BrokerX project from LOG430 (Software Architecture).
To run this project locally, you need the following tools installed:
-
Clone the repository
git clone https://github.com/cjayneb/log430-project.git cd log430-project -
Configure environment variables
Change the values in the
backend/config.gofile if you want to override defaults. Example:Port string `env:"APP_PORT" envDefault:"8181"` DBUrl string `env:"DATABASE_URL" envDefault:"user:pass@tcp(127.0.0.1:3306)/brokerx"`
The variables in
config.goare used when running the app locally. The environnement variables set in thedocker-compose.ymlwill override the values set inbackend/config.gowhen running the project with Docker Compose.
From the backend directory:
go run .This will start the API server on http://127.0.0.1:8080.
- Health endpoint: http://127.0.0.1:8080/health (GET)
- Login endpoint: http://127.0.0.1:8080/login (POST)
- Home page endpoint: http://127.0.0.1:8080/ (GET)
- Orders page endpoint: http://127.0.0.1:8080/order (GET)
You must have a MySQL instance running on your machine for all uses cases to work
From the project root:
docker compose down -v # To remove existing containers and their volumes
docker compose up --build -dThis starts:
- The Go backend (
brokerx_app) on http://localhost:8080 - A MySQL database (
brokerx_db) on port3306
Important : Before running all tests, you must have the test database up, because some of the tests are integration tests needing a real database.
Run the following command to start the test database:
#From the root of the project
docker compose -f docker-compose.test.yml up -dInside the backend folder:
go test ./... -coverprofile=coveragego tool cover -html=coverageAt this stage, the application is deployed locally or remotely using Docker Compose. A production-ready deployment would likely use Kubernetes or cloud-based services, but that is outside the current scope.
To deploy locally, you just have to run the following commands
docker compose down -v # Ensure Docker is clean with no previous deployment
docker compose up --build -d # Build the Docker image and run docker compose in detached modeThe GitHub Actions Workflow should take care of deploying the application to the ETS Virtual Machine self hosted runner automatically on every push. See .github/workflows/ci_cd.yml
The current deployment pipeline is broken because of issues with the storage on the ETS VM.
Note
To access the remote deployment, you must be connected to the ETS Cisco Secure Client via accesvpn.etsmtl.ca
See docs/Runbook.md for information on how to use BrokerX when it is deployed.
Refer to the architectural documentation here.