Skip to content
 
 

Repository files navigation

License: GPL v3 CircleCI Dependencies Status

Built with Spacemacs Join the chat at https://gitter.im/bob-cd/bob

Bob the Builder

This is what CI/CD should've been.

Why Bob

🚧 This is a proof of concept and isn't fully functional yet. 🚧

See the Kanban board to see the roadmap and planned work.

Build requirements

  • Any OS supporting Java and Docker
  • JDK 8 to 12. 13+ will be supported when #56 is fixed.
  • Boot 2.7+

Running requirements

  • Any OS supporting Java and Docker
  • JDK 8 to 12. 13+ will be supported when #56 is fixed.
  • Docker (latest preferred for optimal performance)

Testing, building and running locally

  • Clone this repository.
  • Install the Build requirements.
  • Following steps need Docker:
    • Run boot kaocha to run tests.

    • Start a PostgreSQL server instance locally on port 5432, and ensure a DB bob and a user bob exists on the DB.

        docker run --name bob-db \
          -p 5432:5432 \
          -e POSTGRES_DB=bob \
          -e POSTGRES_USER=bob \
          -d postgres
    • Optionally if Resources and Artifacts are to be used follow the instuctions in the Resources doc and Artifacts doc respectively.

    • Run boot run to start the server on port 7777.

Running integration tests:

Docker may need to be installed for this

One way to run the integration tests is to use docker. In the integration-tests dir, run:

docker-compose up --abort-on-container-exit integration-tests

Note: This will try to create new containers that might have been created by running docker-compose up in the source root. Hence you might need to clean up.

You can also run the tests using strest.

  • Start Bob either via boot or docker as mentioned above.
  • Install strest
    npm i -g @strest/cli
    
  • Run
    strest bob-tests.strest.yaml
    

Note: We're simulating a stateful client on the tests. Which means you'll have to reset the database between each run. (Drop the db docker container and restart it)

Running Bob in Docker

Bob uses Docker as its engine to execute builds, but its now possible to run Bob inside Docker using dind.

To use the provided docker-compose file, in the root dir of the project, run:

docker-compose up bob

This runs a single Bob instance forwarded on port 7777 along with a PostgreSQL server, the reference artifact store and the resource provider. Bob needs the privileged flag as it uses system Docker in Docker to function. A reference CLI like Wendy may be used to talk to Bob.

Running Bob on Kubernetes

To deploy Bob in Kubernetes, the necessary YAML files are provided in the deploy folder in the root of the project.

Deploying locally on a KinD or Minikube cluster:

  1. Install KinD or Minikube.
  2. Run kind create cluster --name bob or minikube start to create a single node cluster for Bob. If using KinD, run export KUBECONFIG="$(kind get kubeconfig-path --name="bob")" to set the cluster context.
  3. Install kubectl.
  4. Run kubectl apply -f deploy/psp.yaml to apply the privileged security policies needed for Bob.
  5. Run kubectl apply -f deploy/db.yaml to create a local PostgreSQL service.
  6. [Optional] Run kubectl apply -f deploy/artifact-local.yaml to create the reference artifact store. Alternatively a custom artifact store may also be used here.
  7. [Optional] Run kubectl apply -f deploy/resource-git.yaml to create the reference resource provider. Alternatively a custom resource provider may also be used here.
  8. Finally, run kubectl apply -f deploy/bob.yaml to create a 2 replica Bob cluster. The number of replicas can be altered in the spec/replicas section of the Deployment.
  9. Run kubectl port-forward svc/bob-lb 7777:7777 to forward Bob's load balancer on the 7777 host port and the cluster can be accessed via http://localhost:7777

Deploying on an actual Kubernetes cluster

Its STRONGLY RECOMMENDED to run Bob on its own isolated cluster as it uses container privilege escalations for its functionality.

  1. Setup an ideally multi-node Kubernetes cluster either On-Prem, or cloud or via an managed provider like Amazon EKS.
  2. Follow the steps from 3 to 8 from the previous section. For step 5, its recommended to use a managed PostgreSQL provider like Amazon RDS. Change the environment values in the container spec of Bob's Deployment accordingly.
  3. Bob will be available via its load balancer's public IP.

For Cursive users:

This project is built using the Boot build tool which is unsupported on Cursive at the moment.

To get it running on Cursive using leiningen:

  • Install Boot 2.7+.
  • Install Leiningen 2.8+.
  • Run boot -d onetom/boot-lein-generate generate to generate a project.clj.
  • Open up this directory in Cursive and it should work.
  • Happy development!

Extensive Usage + API docs

Join the conversation

For discussions regarding the usage and general development of Bob join the Gitter channel.

For a more Clojure specific discussion we also have a clojurians Slack workspace on the channel #bob-cd.

You can come with us with any questions that seem too lengthy for github issues.

Happy Coding!

About

This is what CI/CD should've been.

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages