|
1 | 1 | # Stackdog Security |
2 | 2 |
|
3 | | - |
| 3 | + |
4 | 4 |  |
5 | 5 |  |
6 | 6 |  |
@@ -71,6 +71,95 @@ cargo run |
71 | 71 | cargo run -- serve |
72 | 72 | ``` |
73 | 73 |
|
| 74 | +### Run with Docker |
| 75 | + |
| 76 | +Use the published container image for the quickest way to explore the API. |
| 77 | +If you are validating a fresh branch or waiting for Docker Hub to pick up the latest CI build, |
| 78 | +prefer the local-image flow below so you know you are running your current checkout: |
| 79 | + |
| 80 | +```bash |
| 81 | +docker volume create stackdog-data |
| 82 | + |
| 83 | +docker run --rm -it \ |
| 84 | + --name stackdog \ |
| 85 | + -p 5000:5000 \ |
| 86 | + -e APP_HOST=0.0.0.0 \ |
| 87 | + -e APP_PORT=5000 \ |
| 88 | + -e DATABASE_URL=/data/stackdog.db \ |
| 89 | + -v stackdog-data:/data \ |
| 90 | + -v /var/run/docker.sock:/var/run/docker.sock \ |
| 91 | + trydirect/stackdog:latest |
| 92 | +``` |
| 93 | + |
| 94 | +Then open another shell and hit the API: |
| 95 | + |
| 96 | +```bash |
| 97 | +curl http://localhost:5000/api/security/status |
| 98 | +curl http://localhost:5000/api/threats |
| 99 | +curl http://localhost:5000/api/alerts |
| 100 | +``` |
| 101 | + |
| 102 | +Mount the Docker socket when you want Docker-aware features such as container listing, live stats, |
| 103 | +mail abuse guard polling, Docker log discovery, and Docker-backed quarantine/release flows. |
| 104 | + |
| 105 | +If you do not want Stackdog to access the Docker daemon, disable the mail guard: |
| 106 | + |
| 107 | +```bash |
| 108 | +STACKDOG_MAIL_GUARD_ENABLED=false |
| 109 | +``` |
| 110 | + |
| 111 | +To try log sniffing inside Docker against host log files, mount them read-only and run the |
| 112 | +`sniff` subcommand instead of the default HTTP server: |
| 113 | + |
| 114 | +```bash |
| 115 | +docker run --rm -it \ |
| 116 | + -e DATABASE_URL=/tmp/stackdog.db \ |
| 117 | + -v /var/log:/host-logs:ro \ |
| 118 | + trydirect/stackdog:latest \ |
| 119 | + sniff --once --sources /host-logs/auth.log |
| 120 | +``` |
| 121 | + |
| 122 | +If you want to test your current checkout instead of the latest published image: |
| 123 | + |
| 124 | +```bash |
| 125 | +docker build -f docker/backend/Dockerfile -t stackdog-local . |
| 126 | + |
| 127 | +docker run --rm -it \ |
| 128 | + --name stackdog-local \ |
| 129 | + -p 5000:5000 \ |
| 130 | + -e APP_HOST=0.0.0.0 \ |
| 131 | + -e APP_PORT=5000 \ |
| 132 | + -e DATABASE_URL=/data/stackdog.db \ |
| 133 | + -v stackdog-data:/data \ |
| 134 | + -v /var/run/docker.sock:/var/run/docker.sock \ |
| 135 | + stackdog-local |
| 136 | +``` |
| 137 | + |
| 138 | +### Run backend + UI with Docker Compose |
| 139 | + |
| 140 | +To run `stackdog serve` and the web UI as two separate services from your current checkout: |
| 141 | + |
| 142 | +```bash |
| 143 | +docker compose -f docker-compose.app.yml up --build |
| 144 | +``` |
| 145 | + |
| 146 | +This starts: |
| 147 | + |
| 148 | +- **API** at `http://localhost:5000` |
| 149 | +- **UI** at `http://localhost:3000` |
| 150 | + |
| 151 | +The compose stack uses: |
| 152 | + |
| 153 | +- `stackdog` service — builds `docker/backend/Dockerfile`, runs `stackdog serve`, and mounts `/var/run/docker.sock` |
| 154 | +- `stackdog-ui` service — builds the React app and serves it with Nginx |
| 155 | +- `stackdog-data` volume — persists the SQLite database between restarts |
| 156 | + |
| 157 | +To stop it: |
| 158 | + |
| 159 | +```bash |
| 160 | +docker compose -f docker-compose.app.yml down |
| 161 | +``` |
| 162 | + |
74 | 163 | ### Log Sniffing |
75 | 164 |
|
76 | 165 | ```bash |
@@ -120,11 +209,15 @@ for event in events { |
120 | 209 | ### Docker Development |
121 | 210 |
|
122 | 211 | ```bash |
123 | | -# Start development environment |
124 | | -docker-compose up -d |
| 212 | +# Run the published image |
| 213 | +docker run --rm -it -p 5000:5000 trydirect/stackdog:latest |
| 214 | + |
| 215 | +# Or, for the most reliable test of your current code, build and run your checkout |
| 216 | +docker build -f docker/backend/Dockerfile -t stackdog-local . |
| 217 | +docker run --rm -it -p 5000:5000 stackdog-local |
125 | 218 |
|
126 | | -# View logs |
127 | | -docker-compose logs -f stackdog |
| 219 | +# Or run backend + UI together |
| 220 | +docker compose -f docker-compose.app.yml up --build |
128 | 221 | ``` |
129 | 222 |
|
130 | 223 | --- |
|
0 commit comments