A Remote Cache for Bob
bobc is a lightweight, open source implementation of the bob Cloud Platform - https://bob.build. It is implemented in Go, and it uses an AWS S3-compatible storage backend for storing build artifacts, along with a Postgres database for storing projects and artifact metadata.
To build and run bobc locally, you must have the following tools present on your system:
- Bob with Nix (https://bob.build/docs/getting-started/installation/)
- Docker-Compose (https://docs.docker.com/get-docker/)
Bob is used to build the Go binary and the container image. Docker-compose is used to ramp up a local environment with a Postgres database, MinIO (S3-compatible object storage) and Adminer to aid in inspecting the database contents.
First of all, clone the repository and cd into it:
git clone https://github.com/benchkram/bobc
cd bobcYou also need to clone the bob repo, since the openapi-related generated files will need to be updated once the actual build is invoked.
bob cloneTo build the bobc container, run the following command:
bob build containerThis command will install any build dependencies (Go, Docker, GolangCI-Lint), bootstrap the project, build the bobc binary and subsequently build the container.
To set up the docker-compose environment and start the server run:
export API_KEY="example-api-key"
docker compose up -dYou should now see bobc running on port 8100.
Note: MinIO at localhost requires a host alias to be set up in order to work properly.
You should add the following to your /etc/hosts file:
127.0.0.1 minioYou must create a project to be able to sync artifacts to the server.
To do so, open a new terminal session and use the following curl command:
curl -X POST http://localhost:8100/api/projects \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
-d '{"name": "bobc-example"}'This will create a project named bobc-example.
Next, you should configure an authentication context for bob. We'll use the same API_TOKEN as bearer token:
export API_KEY="example-api-key"
bob auth init --token=$API_KEYYou can verify artifact sync is working by typing
cd example
bob build --insecure --pushWe have to use the --insecure flag since bobc is running over HTTP by default locally.
We also pass the --push flag to instruct bob to attempt to push artifacts to the artifact store. Bob will not push artifacts upstream by default.
For more information on how to use bob with bobc, please refer to the official documentation: https://bob.build/docs/remote-cache#pushing--pulling-artifacts
