Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions openbao/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# OpenBao Playground

A simple setup to run OpenBao in Docker for learning and experimentation.

## What is OpenBao?

OpenBao is an open-source secrets management platform that helps you securely store and access secrets like API keys, passwords, certificates, and more. It's a fork of HashiCorp Vault focused on community governance and open development.

## Quick Start

### Prerequisites

- Docker and Docker Compose installed
- curl (for health checks)

### Running OpenBao

1. **Start OpenBao**:
```bash
./run-openbao.sh
```

2. **Access the Web UI**:
Open http://localhost:8200 in your browser

3. **Login**:
- Token: `myroot`

### Alternative: Manual Docker Commands

```bash
# Start with docker-compose
docker-compose up -d

# Stop
docker-compose down

# View logs
docker-compose logs -f
```

## Basic Usage

### CLI Setup

Install the OpenBao CLI:
```bash
# Download from https://github.com/openbao/openbao/releases
# Or use the container:
docker exec -it openbao-dev openbao
```

### Environment Variables

```bash
export OPENBAO_ADDR='http://localhost:8200'
export OPENBAO_TOKEN='myroot'
```

### Basic Commands

```bash
# Check status
openbao status

# Enable key-value secrets engine
openbao secrets enable -path=secret kv-v2

# Store a secret
openbao kv put secret/myapp db_password="supersecret"

# Retrieve a secret
openbao kv get secret/myapp

# List secrets
openbao kv list secret/
```

## Learning Resources

- [OpenBao Documentation](https://openbao.org/docs/)
- [API Reference](https://openbao.org/api-docs/)
- [GitHub Repository](https://github.com/openbao/openbao)

## Development Notes

- This setup uses **development mode** - data is stored in memory and lost on restart
- For production, configure persistent storage and proper authentication
- The root token `myroot` is for development only

## Troubleshooting

### OpenBao won't start
```bash
# Check if port 8200 is in use
lsof -i :8200

# View container logs
docker-compose logs openbao
```

### Permission issues
```bash
# Ensure the script is executable
chmod +x run-openbao.sh
```

## Stopping OpenBao

```bash
docker-compose down
```

To remove all data:
```bash
docker-compose down -v
```
20 changes: 20 additions & 0 deletions openbao/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: bao-dev
services:
openbao:
image: quay.io/openbao/openbao:latest
container_name: openbao-dev
ports:
- "8200:8200"
environment:
- BAO_DEV_ROOT_TOKEN_ID=myroot # never use this on production
# - BAO_DEV_LISTEN_ADDRESS=0.0.0.0:8200
- BAO_ADDR=0.0.0.0:8200
cap_add:
- IPC_LOCK
volumes:
- openbao-data:/openbao/data
- ./config:/openbao/config
command: ["bao", "server", "-dev"]

volumes:
openbao-data:
38 changes: 38 additions & 0 deletions openbao/run-openbao.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

# OpenBao Docker Runner Script
# This script helps you run OpenBao in development mode using Docker

set -e

echo "🔐 Starting OpenBao in development mode..."

# Create config directory if it doesn't exist
mkdir -p config

# Check if Docker is running
if ! docker info >/dev/null 2>&1; then
echo "❌ Docker is not running. Please start Docker first."
exit 1
fi

# Start OpenBao using docker-compose
docker compose up -d

# Wait for OpenBao to be ready
echo "⏳ Waiting for OpenBao to start..."
sleep 5

# Check if OpenBao is accessible
if curl -s http://localhost:8200/v1/sys/health >/dev/null 2>&1; then
echo "✅ OpenBao is running!"
echo ""
echo "🌐 Web UI: http://localhost:8200"
echo "🔑 Root Token: myroot"
echo "📋 API Endpoint: http://localhost:8200"
echo ""
echo "To stop OpenBao, run: docker compose down"
else
echo "❌ OpenBao failed to start. Check logs with: docker compose logs"
exit 1
fi