Skip to content

Commit b2a4a7f

Browse files
authored
executors: deploy executors with compose (#901)
* add executors to compose deployment
1 parent 101ba1b commit b2a4a7f

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

docker-compose/executors/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Executors
2+
3+
Executors are Sourcegraph’s solution for running untrusted code in a secure and controllable way. For more information on executors and how they are used see the Executors [documentation](https://docs.sourcegraph.com/admin/executors)
4+
5+
## Deploying
6+
7+
This directory contains a compose file to deploy a Sourcegraph Executor.
8+
9+
NOTE: Executors require privileged access in order to run correctly on docker-compose based deployments.
10+
11+
To learn more visit TODO
12+
13+
To run this as part of a Sourcegraph deployment on the machine machine, execute the following command from the `docker-compose` directory:
14+
15+
```bash
16+
docker-compose -f docker-compose.yaml -f executors/executor.docker-compose.yaml up -d
17+
```
18+
19+
To run this on a standalone machine, execute the following from the `executors` directory
20+
21+
```bash
22+
docker-compose up -d executor.docker-compose.yaml
23+
```
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
version: '2.4'
2+
services:
3+
executor:
4+
container_name: executor
5+
image: 'index.docker.io/sourcegraph/executor:insiders@sha256:21ed2073df3ae60ac548546e6ecc3a2c3c00b31c635df67508ee11079d5bf156'
6+
cpus: 1
7+
mem_limit: '4g'
8+
# Run as root (required for docker daemon control)
9+
user: root
10+
# Run with privileged capabilities (required for docker daemon control)
11+
privileged: true
12+
environment:
13+
# Refer to https://docs.sourcegraph.com/admin/deploy_executors_binary#step-2-setup-environment-variables on how to populate these variables
14+
- EXECUTOR_FRONTEND_URL=http://sourcegraph-frontend-0:3080
15+
# Note: Must match `executors.accessToken` in site config
16+
- EXECUTOR_FRONTEND_PASSWORD=
17+
# Choose what work to process
18+
- EXECUTOR_QUEUE_NAME=
19+
# Note: Must match left-hand side of scratch volume mount
20+
- EXECUTOR_DOCKER_HOST_MOUNT_PATH=/tmp/sourcegraph/executor-scratch
21+
# Note: Must match right-hand side of scratch volume mount
22+
- TMPDIR=/scratch
23+
# Run as root (required for docker daemon control)
24+
- UID=1000
25+
- GID=1000
26+
volumes:
27+
# Mount docker socket
28+
- '/var/run/docker.sock:/var/run/docker.sock'
29+
# Mount volume for workspaces shared by executor and launched containers
30+
- '/tmp/sourcegraph/executor-scratch:/scratch'
31+
networks:
32+
- sourcegraph
33+
restart: always

0 commit comments

Comments
 (0)