Skip to content

Commit 42310a0

Browse files
committed
Merge branch 'master' into Update-Caddy-Image
2 parents b3bd1c3 + 70f84cd commit 42310a0

41 files changed

Lines changed: 190 additions & 129 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 24 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,36 @@
1-
# Pure-Docker Sourcegraph cluster deployment reference
1+
# Sourcegraph with Docker Compose
22

3-
[![sourcegraph: search](https://img.shields.io/badge/sourcegraph-search-brightgreen.svg)](https://sourcegraph.com/github.com/sourcegraph/deploy-sourcegraph-docker)
3+
[![sourcegraph: search](https://img.shields.io/badge/sourcegraph-search-brightgreen.svg)](https://sourcegraph.com/github.com/sourcegraph/deploy-sourcegraph-docker) [![Build status](https://badge.buildkite.com/e60f9ffcafd68882d3db6fe5e33567e3a111d391a554d50d82.svg)](https://buildkite.com/sourcegraph/deploy-sourcegraph-docker)
44

5-
There are two recommended ways to deploy Sourcegraph:
5+
This repository is the deployment reference for [deploying Sourcegraph with Docker Compose](https://docs.sourcegraph.com/admin/install/docker-compose).
66

7-
- [Single-machine Docker deployment](https://docs.sourcegraph.com/admin/install/docker)
8-
- [Multi-machine Kubernetes deployment](https://docs.sourcegraph.com/admin/install/kubernetes_cluster)
7+
> 🚨 IMPORTANT: When upgrading Sourcegraph, please check [upgrading docs](https://docs.sourcegraph.com/admin/updates/docker_compose) to check if any manual migrations are necessary.
8+
>
9+
> The `master` branch tracks development. Use the branch of this repository corresponding to the
10+
> version of Sourcegraph you wish to deploy, e.g. `git checkout 3.19`.
911
10-
But what if your organization wants a multi-machine deployment without using Kubernetes? What if you use a different container management platform, for example? This project aims to solve that, by providing a pure-Docker deployment option.
12+
For product and [pricing](https://about.sourcegraph.com/pricing/) information, visit
13+
[about.sourcegraph.com](https://about.sourcegraph.com) or [contact
14+
us](https://about.sourcegraph.com/contact/sales) for more information. If you're just starting out,
15+
we recommend running Sourcegraph as a [single Docker
16+
container](https://docs.sourcegraph.com/#quickstart-guide) or using [Docker
17+
Compose](https://docs.sourcegraph.com/admin/install/docker-compose). Migrating to Sourcegraph on
18+
Kubernetes is easy later.
1119

12-
The goal is that anyone using a container management platform other than Kubernetes (Netflix's [Titus](https://netflix.github.io/titus/), Apache's [Mesos](http://mesos.apache.org/documentation/latest/docker-containerizer/), etc.) would be able to use this repository as a reference for how to deploy Sourcegraph.
20+
## Is Docker Compose the right deployment type for me?
1321

14-
## Deploying
22+
Please see [our docs](https://docs.sourcegraph.com/admin/install) for comparisons of deployment types and our resource estimator.
1523

16-
First clone the repository, then:
24+
## Contributing
1725

18-
```bash
19-
./deploy.sh
20-
```
26+
We've made our deployment configurations open source to better serve our customers' needs. If there is anything we can do to make deploying Sourcegraph easier just [open an issue (in sourcegraph/sourcegraph)](https://github.com/sourcegraph/sourcegraph/issues/new?assignees=&labels=deploy-sourcegraph-docker&title=%5Bdeploy-sourcegraph-docker%5D) or a pull request and we will respond promptly!
2127

22-
Visit http://localhost:3080 to visit the running Sourcegraph instance!
23-
24-
## Tearing down the deployment
25-
26-
```bash
27-
./teardown.sh
28-
```
29-
30-
## System topology
31-
32-
To understand the system topology:
33-
34-
1. Look at `deploy.sh` to get an overview of services.
35-
2. Every service (`deploy-*.sh`) has documentation inline indicating:
36-
- What the service does / provides.
37-
- What ports the service exposes.
38-
- What other services it talks to (see environment variables).
39-
40-
## Service system requirements
41-
42-
Every service (`deploy-*.sh`) documents inline what the system requirements are (CPU/Memory/Disk allocation). For example, [the frontend service](https://github.com/sourcegraph/deploy-sourcegraph-docker/blob/f01b97a397138dd76e5f5ed45b2574b9a2e70cd1/deploy-frontend.sh#L6-L9).
43-
44-
## Scaling / replicas
45-
46-
To scale the cluster deployment, you will need to:
47-
48-
1. Deploy more instances of `gitserver`, `indexed-search`, `searcher` and `symbols` services as desired.
49-
2. [Configure the `frontend` and `frontend-internal` to communicate with the new instances.](https://github.com/sourcegraph/deploy-sourcegraph-docker/blob/f01b97a397138dd76e5f5ed45b2574b9a2e70cd1/deploy-frontend.sh#L31-L34)
50-
3. You're done! You do not need to configure or restart any other services.
51-
52-
## Metrics and Tracing
53-
54-
This deployment comes with metrics and tracing built-in. See [metrics and tracing](metrics-and-tracing.md) for details.
55-
56-
## Configuring HTTPS
57-
58-
See https://docs.sourcegraph.com/admin/nginx#nginx-for-other-sourcegraph-clusters-e-g-pure-docker
59-
60-
## Configuring SSH cloning
61-
62-
1. Ensure your **Site admin** > **External services** code host configuration is configured to use SSH. For example, by setting the [`gitURLType`](https://docs.sourcegraph.com/admin/site_config/all#giturltype-string-enum) field to `"ssh"`. You may still need to configure an access token or other codehost authentication method in order for Sourcegraph to discover your repositories.
63-
64-
Alternatively, you may use the `OTHER` codehost type under **External services**, which allows you to directly specify Git repository URLs for cloning.
65-
66-
2. Provide your `gitserver` instances with your SSH / Git configuration (usually just `.ssh/id_rsa`, `.ssh/id_rsa.pub`, and `.ssh/known_hosts` -- but you can also provide other files like `.netrc`, `.gitconfig`, etc. if needed) by mounting it into the `sourcegraph` users home directory in the `gitserver` containers. For example, by adding the following flag:
67-
68-
```
69-
-v ~/my-sourcegraph-ssh-config/.ssh:/home/sourcegraph/.ssh
70-
```
71-
72-
All future Git cloning operations will use the credentials configured there.
73-
74-
If you wish, you can test that cloning with your configuration is working by performing the clone in a gitserver container shell, e.g. first acquire shell access:
75-
76-
```
77-
$ docker exec -it gitserver-0 sh
78-
```
28+
## Questions & Issues
7929

80-
Then try cloning the repository:
30+
[Open an issue (in sourcegraph/sourcegraph)](https://github.com/sourcegraph/sourcegraph/issues/new?assignees=&labels=deploy-sourcegraph&template=deploy-sourcegraph.md&title=%5Bdeploy-sourcegraph%5D) or contact us (support@sourcegraph.com), we are happy to help!
8131

82-
```
83-
$ git clone ssh://git@myhost.com/my/repo /tmp/my-repo
84-
```
85-
## Questions & Issues
32+
## Pure-Docker Sourcegraph cluster deployment reference
8633

87-
[Open an issue (in sourcegraph/sourcegraph)](https://github.com/sourcegraph/sourcegraph/issues/new?assignees=&labels=deploy-sourcegraph-docker&template=deploy-sourcegraph-docker.md&title=%5Bdeploy-sourcegraph-docker%5D) or contact us (support@sourcegraph.com), we are happy to help!
34+
What if your organization wants a multi-machine deployment without using Kubernetes?
35+
What if you use a different container management platform, for example?
36+
Anyone using a container management platform other than Kubernetes (Netflix's [Titus](https://netflix.github.io/titus/), Apache's [Mesos](http://mesos.apache.org/documentation/latest/docker-containerizer/), etc.) can use our [Pure-Docker Sourcegraph cluster deployment reference](./pure-docker/README.md) to deploy Sourcegraph.

RELEASING.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Release guide
22

3+
**This is the guide for releasing the [Pure-Docker Sourcegraph deployment reference](./pure-docker/README.md).**
4+
The docker-compose release is done entirely via the [Sourcegraph release tool](https://about.sourcegraph.com/handbook/engineering/distribution/tools/release).
5+
36
## Branching/tagging scheme
47

58
Just like deploy-sourcegraph, we use version branches and version tags. We _additionally_ have a second set which is customer-replication branches and version tags:
@@ -68,10 +71,10 @@ Pretend `3.8` was the last version of pure-docker release (look for the latest `
6871

6972
```sh
7073
# Checkout the current pure-docker release branch
71-
git checkout 3.8-customer-replica
74+
git checkout 3.8-customer-replica
7275

7376
# Create the new pure-docker release branch
74-
git checkout -B 3.9-customer-replica
77+
git checkout -B 3.9-customer-replica
7578

7679
# Merge the publish-3.9 branch, which will have been created by the release tool, into the pure-docker release branch.
7780
git merge publish-3.9
@@ -95,9 +98,15 @@ At this point you should evaluate the `git status` output as well as all the cha
9598
During this process you will run into two merge conflicts:
9699

97100
- Do not commit: `deploy-caddy.sh` or changes related to it, as `deploy-apache.sh` is used here.
98-
- Do not commit: changes to `deploy-pgsql.sh`, as Postgres 9.6 is used here.
101+
- The prettier ignore should look like this:
102+
103+
```
104+
.github/
105+
*.md
106+
rootfs/etc/docker/daemon.json
107+
```
99108

100-
4. Push the changes to github
109+
1. Push the changes to github
101110
```shell
102111
git push --set-upstream origin 3.9-customer-replica
103112
```

docker-compose/README.md

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,5 @@
1-
# Sourcegraph for docker-compose
1+
# Sourcegraph with Docker Compose deployment reference
22

3-
This folder contains a Sourcegraph docker-compose deployment.
3+
This directory contains the Sourcegraph with Docker Compose deployment reference.
44

5-
## Deploying
6-
7-
Simply clone the repository and `docker-compose up -d` to deploy Sourcegraph:
8-
9-
```sh
10-
git clone https://github.com/sourcegraph/deploy-sourcegraph-docker
11-
cd deploy-sourcegraph-docker/docker-compose/
12-
git checkout v3.21.2
13-
docker-compose up -d
14-
```
15-
16-
Sourcegraph will then run in the background and across server restarts.
17-
18-
Notes:
19-
20-
- The `docker-compose.yaml` file currently depends on configuration files which live in the repository, as such you must have the repository cloned onto your server.
21-
- Data for all services will be stored as docker volumes.
22-
- Use `docker ps` to inspect the Sourcegraph containers, and `docker-compose down` to teardown the deployment.
23-
24-
## Upgrading
25-
26-
Always refer to https://docs.sourcegraph.com/admin/updates/docker_compose prior to upgrading, as it will document any manual steps you may need to take in order to upgrade smoothly.
5+
To learn more about deploying, configuring, and upgrading a Sourcegraph with Docker Compose installation, please refer to our documentation: [Sourcegraph with Docker Compose](https://docs.sourcegraph.com/admin/install/docker-compose)

docker-compose/db-only-migrate.docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ services:
1212
#
1313
pgsql:
1414
container_name: pgsql
15-
image: 'index.docker.io/sourcegraph/postgres-12.6-alpine:3.30.0@sha256:439246675646322cf6b22a277ab86d790287bc4c532e2a2f4a4e0538d06cd206'
15+
image: 'index.docker.io/sourcegraph/postgres-12.6:95244_2021-05-06_2c1f77e@sha256:35040317490324a15e1259c9023a726eb27c694530f6f8877e87d337c7b97778'
1616
cpus: 4
1717
mem_limit: '2g'
1818
healthcheck:

docker-compose/docker-compose.yaml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ services:
6969
# service.
7070
sourcegraph-frontend-0:
7171
container_name: sourcegraph-frontend-0
72-
image: 'index.docker.io/sourcegraph/frontend:insiders@sha256:423d9d7f14107339792b4ec5e3610b57d01dce0a390e30bbfefda1c163587a56'
72+
image: 'index.docker.io/sourcegraph/frontend:insiders@sha256:07206787b154da77d133333a507bdd26df7fb6f17b696bcf1c628ac8f69a4236'
7373
cpus: 4
7474
mem_limit: '8g'
7575
environment:
@@ -113,7 +113,7 @@ services:
113113
#
114114
sourcegraph-frontend-internal:
115115
container_name: sourcegraph-frontend-internal
116-
image: 'index.docker.io/sourcegraph/frontend:insiders@sha256:423d9d7f14107339792b4ec5e3610b57d01dce0a390e30bbfefda1c163587a56'
116+
image: 'index.docker.io/sourcegraph/frontend:insiders@sha256:07206787b154da77d133333a507bdd26df7fb6f17b696bcf1c628ac8f69a4236'
117117
cpus: 4
118118
mem_limit: '8g'
119119
environment:
@@ -150,6 +150,7 @@ services:
150150
codeintel-db:
151151
condition: service_healthy
152152

153+
153154
# Description: Stores clones of repositories to perform Git operations.
154155
#
155156
# Disk: 200GB / persistent SSD
@@ -158,7 +159,7 @@ services:
158159
#
159160
gitserver-0:
160161
container_name: gitserver-0
161-
image: 'index.docker.io/sourcegraph/gitserver:insiders@sha256:320febe0e9f15ab0d25bfbbfec83caec0757a5ed26d600548c678b969f66f2aa'
162+
image: 'index.docker.io/sourcegraph/gitserver:insiders@sha256:2c2fb7ba482518481be45a17b0ac81698c3062efa2e4e2133ab928ab031a43bc'
162163
cpus: 4
163164
mem_limit: '8g'
164165
environment:
@@ -228,7 +229,7 @@ services:
228229
#
229230
searcher-0:
230231
container_name: searcher-0
231-
image: 'index.docker.io/sourcegraph/searcher:insiders@sha256:6e0023081f993c654ad4ea7a63b7e9d307448c5533c836f0b3b5243db959fa56'
232+
image: 'index.docker.io/sourcegraph/searcher:insiders@sha256:8c5751c7a499cae8ba0ad772b06a02d6a8270021946fde71937480dd42ac64ac'
232233
cpus: 2
233234
mem_limit: '2g'
234235
environment:
@@ -256,7 +257,7 @@ services:
256257
#
257258
github-proxy:
258259
container_name: github-proxy
259-
image: 'index.docker.io/sourcegraph/github-proxy:insiders@sha256:e8148f33b62479bf563e05ad0923f84ce9be38b45043889194076eff4bed4e4b'
260+
image: 'index.docker.io/sourcegraph/github-proxy:insiders@sha256:1e6c71f78d4729208bf2016977a18b7fa9a4856bbb111546c66bff49f914b54b'
260261
cpus: 1
261262
mem_limit: '1g'
262263
environment:
@@ -274,7 +275,7 @@ services:
274275
#
275276
precise-code-intel-worker:
276277
container_name: precise-code-intel-worker
277-
image: 'index.docker.io/sourcegraph/precise-code-intel-worker:insiders@sha256:ca92df3fb60f09c634227ded0f8f1d8549fbca49c5e9976a71d15a48916052ca'
278+
image: 'index.docker.io/sourcegraph/precise-code-intel-worker:insiders@sha256:62992ccbd790f72e59bb03a79d13bcdc46bdf5680c01e84fb44cc51a9d484f8e'
278279
cpus: 2
279280
mem_limit: '4g'
280281
environment:
@@ -300,7 +301,7 @@ services:
300301
#
301302
query-runner:
302303
container_name: query-runner
303-
image: 'index.docker.io/sourcegraph/query-runner:insiders@sha256:c3d9a10bbf0697b330025fa5e5cd8571e358fd23f48cbbbcf47e4dc0a606b9c2'
304+
image: 'index.docker.io/sourcegraph/query-runner:insiders@sha256:59721e8267aa7ee95822c8609e9bba1ad1f6ebebf19b27203fe31905f5169278'
304305
cpus: 1
305306
mem_limit: '1g'
306307
environment:
@@ -319,7 +320,7 @@ services:
319320
#
320321
repo-updater:
321322
container_name: repo-updater
322-
image: 'index.docker.io/sourcegraph/repo-updater:insiders@sha256:fbcdc6735331693ce682ad9553240cb217d24e3c40234535a8bdb528ffdf2295'
323+
image: 'index.docker.io/sourcegraph/repo-updater:insiders@sha256:2b2b3f34bbb6d6dd045d976843337aaa29057b44637eddc352c7c8ba9da62c2c'
323324
cpus: 4
324325
mem_limit: '4g'
325326
environment:
@@ -341,7 +342,7 @@ services:
341342
#
342343
worker:
343344
container_name: worker
344-
image: 'index.docker.io/sourcegraph/worker:insiders@sha256:293bc7804869b66714002b92a84d5c5b9690602bf2d83474761074c6eae8cfc6'
345+
image: 'index.docker.io/sourcegraph/worker:insiders@sha256:b6bfaf41e075f1e9c342a39881f578a344c151c70dcf93099ebf8a82ad0011da'
345346
cpus: 4
346347
mem_limit: '4g'
347348
environment:
@@ -383,7 +384,7 @@ services:
383384
#
384385
symbols-0:
385386
container_name: symbols-0
386-
image: 'index.docker.io/sourcegraph/symbols:insiders@sha256:0eac2d380b05b288f7bec37324870e1cc425d92f290420edd9714eea81f592e1'
387+
image: 'index.docker.io/sourcegraph/symbols:insiders@sha256:bdd8ee612b0291859874af64fca88d14a425be7670d8f49a06fc360fe7a433f7'
387388
cpus: 2
388389
mem_limit: '4g'
389390
environment:
@@ -458,7 +459,7 @@ services:
458459
#
459460
cadvisor:
460461
container_name: cadvisor
461-
image: 'index.docker.io/sourcegraph/cadvisor:insiders@sha256:6b7f3d4a6ab00444f7df65e74d6d552462280b6b73e605827b5a759877f6a1dd'
462+
image: 'index.docker.io/sourcegraph/cadvisor:insiders@sha256:ae163e3912bbbb1e2abd81581b81dc36b8ee9b3264805a7bde8bfb9f47981253'
462463
cpus: 1
463464
mem_limit: '1g'
464465
volumes:
@@ -485,7 +486,7 @@ services:
485486
#
486487
jaeger:
487488
container_name: jaeger
488-
image: 'index.docker.io/sourcegraph/jaeger-all-in-one:insiders@sha256:bbeea94c57f3b395858e39d39f0df9beb5d2b93adad93f030f8d8184da41b11f'
489+
image: 'index.docker.io/sourcegraph/jaeger-all-in-one:insiders@sha256:5ac56c83b2284a19cc736fe66cf11facaa084a28417382b35773ff1ab87fe166'
489490
cpus: 0.5
490491
mem_limit: '512m'
491492
ports:
@@ -510,7 +511,7 @@ services:
510511
#
511512
pgsql:
512513
container_name: pgsql
513-
image: 'index.docker.io/sourcegraph/postgres-12.6-alpine:3.30.0@sha256:439246675646322cf6b22a277ab86d790287bc4c532e2a2f4a4e0538d06cd206'
514+
image: 'index.docker.io/sourcegraph/postgres-12.6:95244_2021-05-06_2c1f77e@sha256:35040317490324a15e1259c9023a726eb27c694530f6f8877e87d337c7b97778'
514515
cpus: 4
515516
mem_limit: '2g'
516517
healthcheck:
@@ -524,6 +525,7 @@ services:
524525
networks:
525526
- sourcegraph
526527
restart: always
528+
stop_grace_period: 120s
527529

528530
# Description: PostgreSQL database for code intelligence data.
529531
#
@@ -548,6 +550,7 @@ services:
548550
networks:
549551
- sourcegraph
550552
restart: always
553+
stop_grace_period: 120s
551554

552555
# Description: TimescaleDB time-series database for code insights data.
553556
#
@@ -562,17 +565,18 @@ services:
562565
# would be bad but it can be rebuilt given enough time.)
563566
codeinsights-db:
564567
container_name: codeinsights-db
565-
image: 'index.docker.io/sourcegraph/codeinsights-db:insiders@sha256:75be25ec13a1a2706adefff68c8101a58d692e8d36ebac3e43f33b9304e5b8c7'
568+
image: "index.docker.io/sourcegraph/codeinsights-db:insiders@sha256:75be25ec13a1a2706adefff68c8101a58d692e8d36ebac3e43f33b9304e5b8c7"
566569
cpus: 4
567-
mem_limit: '2g'
570+
mem_limit: "2g"
568571
environment:
569572
- POSTGRES_PASSWORD=password
570573
- PGDATA=/var/lib/postgresql/data/pgdata
571574
volumes:
572-
- 'codeinsights-db:/var/lib/postgresql/data/'
575+
- "codeinsights-db:/var/lib/postgresql/data/"
573576
networks:
574577
- sourcegraph
575578
restart: always
579+
stop_grace_period: 120s
576580

577581
# Description: MinIO for storing LSIF uploads.
578582
#

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ go 1.15
44

55
require (
66
github.com/slimsag/update-docker-tags v0.7.0
7-
github.com/sourcegraph/sourcegraph/enterprise/dev/ci/images v0.0.0-20210723035421-9fd81850e251
7+
github.com/sourcegraph/sourcegraph/enterprise/dev/ci/images v0.0.0-20210731040113-a2d19524cb65
88
)

0 commit comments

Comments
 (0)