https://github.com/open-sauced/pizza
This is an engine that sources git commits and turns them to insights
https://github.com/open-sauced/pizza
Last synced: 6 months ago
JSON representation
This is an engine that sources git commits and turns them to insights
- Host: GitHub
- URL: https://github.com/open-sauced/pizza
- Owner: open-sauced
- License: apache-2.0
- Created: 2023-05-11T15:37:49.000Z (over 2 years ago)
- Default Branch: beta
- Last Pushed: 2024-01-08T23:28:51.000Z (almost 2 years ago)
- Last Synced: 2024-08-31T05:11:15.545Z (about 1 year ago)
- Language: Go
- Size: 85.9 KB
- Stars: 30
- Watchers: 7
- Forks: 13
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
🍕 Pizza Oven Micro-service 🍕
A Go micro-service that sources git commits from any arbitrary git repo and indexes them into a postgres database.
## 🚀 Routes
### `/bake`
The bake route accepts a `POST` request with the following json body:
```json
{
"url": "https://some-git-repo.com"
}
```
The server will then process the commits in the provided git repository by
cloning the repo into memory, storing the individual commits and their authors.
Example:
```bash
curl -d '{"url":"https://github.com/open-sauced/insights"}' \
-H "Content-Type: application/json" \
-X POST http://localhost:8080/bake
```
## 🖥️ Local development
There are a few required dependencies to build and run the pizza-oven service:
- The [Go toolchain](https://go.dev/doc/install)
- [Docker](https://docs.docker.com/engine/install/) (for building the container)
- Make
### Local postgres database setup
You can use a local postgres database (like with `brew services start postgresql`)
[configured to accept SSL connections](https://www.postgresql.org/docs/current/ssl-tcp.html)
that has been bootstrapped with the [OpenSauced API migrations](https://github.com/open-sauced/api/tree/beta/migrations).
It is highly recommended to follow the instructions in the API repository to get a locally running postgres going
that can be used with the `pizza` oven micro-service.
You'll also need an `.env` file with the database's secrets
(see `.env.example` in this repo for the required env variables),
and a locally running version of the Go application.
To start the pizza oven service:
```
$ make run
{"level":"info","ts":1687800220.829255,"caller":"server/server.go:36","msg":"initiated zap logger with level: 0"} │
{"level":"info","ts":1687800220.8293574,"caller":"server/server.go:48","msg":"Starting server on port 8080"}
```
This will start the go app, connect to your local postgres database
using your `.env` file or existing environment variables,
and start accepting requests.
See the `.env.example` file to see what environment variables are expected.
### Local kubernetes setup
To get a local environment setup with a postgres database without having to start and configure one yourself,
there is a convenience script that can be invoked with `make setup-test-env` which will bootstrap:
- A local kind kubernetes cluster
- A postgres database configured with the migrations using a postgres operator
- Build the pizza-oven container
- Load the newly built image to the kind cluster
- Start a deployment for the pizza-oven service
In order to run this setup script, you will _also_ need:
- Kubectl
- Helm
- Kind
- The psql command line tool
Once you see the final step complete, the script will open a port to the pizza-oven service
and be able to start accepting requests.