mirror of
https://github.com/RustyRaptor/deploy-sourcegraph-docker.git
synced 2026-12-04 00:05:19 -07:00
pure-docker: move pure-docker to ./pure-docker (#454)
This change will require additional actions for users using the pure-docker deployment option upgrading past 3.30.x - Please refer to https://docs.sourcegraph.com/admin/updates/pure_docker for more details.
This commit is contained in:
1 parent
a7f22c6871
commit
76ea424bd2
36 files changed
+120
-84
No files matched your search
@@ -1,87 +1,36 @@
|
|||||||
# Pure-Docker Sourcegraph cluster deployment reference
|
# Sourcegraph with Docker Compose
|
||||||
|
|
||||||
[](https://sourcegraph.com/github.com/sourcegraph/deploy-sourcegraph-docker)
|
[](https://sourcegraph.com/github.com/sourcegraph/deploy-sourcegraph-docker) [](https://buildkite.com/sourcegraph/deploy-sourcegraph-docker)
|
||||||
|
|
||||||
There are two recommended ways to deploy Sourcegraph:
|
This repository is the deployment reference for [deploying Sourcegraph with Docker Compose](https://docs.sourcegraph.com/admin/install/docker-compose).
|
||||||
|
|
||||||
- [Single-machine Docker deployment](https://docs.sourcegraph.com/admin/install/docker)
|
> 🚨 IMPORTANT: When upgrading Sourcegraph, please check [upgrading docs](https://docs.sourcegraph.com/admin/updates/docker_compose) to check if any manual migrations are necessary.
|
||||||
- [Multi-machine Kubernetes deployment](https://docs.sourcegraph.com/admin/install/kubernetes_cluster)
|
>
|
||||||
|
> The `master` branch tracks development. Use the branch of this repository corresponding to the
|
||||||
|
> version of Sourcegraph you wish to deploy, e.g. `git checkout 3.19`.
|
||||||
|
|
||||||
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.
|
For product and [pricing](https://about.sourcegraph.com/pricing/) information, visit
|
||||||
|
[about.sourcegraph.com](https://about.sourcegraph.com) or [contact
|
||||||
|
us](https://about.sourcegraph.com/contact/sales) for more information. If you're just starting out,
|
||||||
|
we recommend running Sourcegraph as a [single Docker
|
||||||
|
container](https://docs.sourcegraph.com/#quickstart-guide) or using [Docker
|
||||||
|
Compose](https://docs.sourcegraph.com/admin/install/docker-compose). Migrating to Sourcegraph on
|
||||||
|
Kubernetes is easy later.
|
||||||
|
|
||||||
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.
|
## Is Docker Compose the right deployment type for me?
|
||||||
|
|
||||||
## Deploying
|
Please see [our docs](https://docs.sourcegraph.com/admin/install) for comparisons of deployment types and our resource estimator.
|
||||||
|
|
||||||
First clone the repository, then:
|
## Contributing
|
||||||
|
|
||||||
```bash
|
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!
|
||||||
./deploy.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
Visit http://localhost:3080 to visit the running Sourcegraph instance!
|
|
||||||
|
|
||||||
## Tearing down the deployment
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./teardown.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
## System topology
|
|
||||||
|
|
||||||
To understand the system topology:
|
|
||||||
|
|
||||||
1. Look at `deploy.sh` to get an overview of services.
|
|
||||||
2. Every service (`deploy-*.sh`) has documentation inline indicating:
|
|
||||||
- What the service does / provides.
|
|
||||||
- What ports the service exposes.
|
|
||||||
- What other services it talks to (see environment variables).
|
|
||||||
|
|
||||||
## Service system requirements
|
|
||||||
|
|
||||||
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).
|
|
||||||
|
|
||||||
## Scaling / replicas
|
|
||||||
|
|
||||||
To scale the cluster deployment, you will need to:
|
|
||||||
|
|
||||||
1. Deploy more instances of `gitserver`, `indexed-search`, `searcher` and `symbols` services as desired.
|
|
||||||
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)
|
|
||||||
3. You're done! You do not need to configure or restart any other services.
|
|
||||||
|
|
||||||
## Metrics and Tracing
|
|
||||||
|
|
||||||
This deployment comes with metrics and tracing built-in. See [metrics and tracing](metrics-and-tracing.md) for details.
|
|
||||||
|
|
||||||
## Configuring HTTPS
|
|
||||||
|
|
||||||
See https://docs.sourcegraph.com/admin/nginx#nginx-for-other-sourcegraph-clusters-e-g-pure-docker
|
|
||||||
|
|
||||||
## Configuring SSH cloning
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
Alternatively, you may use the `OTHER` codehost type under **External services**, which allows you to directly specify Git repository URLs for cloning.
|
|
||||||
|
|
||||||
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:
|
|
||||||
|
|
||||||
```
|
|
||||||
-v ~/my-sourcegraph-ssh-config/.ssh:/home/sourcegraph/.ssh
|
|
||||||
```
|
|
||||||
|
|
||||||
All future Git cloning operations will use the credentials configured there.
|
|
||||||
|
|
||||||
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:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ docker exec -it gitserver-0 sh
|
|
||||||
```
|
|
||||||
|
|
||||||
Then try cloning the repository:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ git clone ssh://git@myhost.com/my/repo /tmp/my-repo
|
|
||||||
```
|
|
||||||
## Questions & Issues
|
## Questions & Issues
|
||||||
|
|
||||||
[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!
|
[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!
|
||||||
|
|
||||||
|
## Pure-Docker Sourcegraph cluster deployment reference
|
||||||
|
|
||||||
|
What if your organization wants a multi-machine deployment without using Kubernetes?
|
||||||
|
What if you use a different container management platform, for example?
|
||||||
|
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.
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
# Release guide
|
# Release guide
|
||||||
|
|
||||||
|
**This is the guide for releasing the [Pure-Docker Sourcegraph deployment reference](./pure-docker/README.md).**
|
||||||
|
The docker-compose release is done entirely via the [Sourcegraph release tool](https://about.sourcegraph.com/handbook/engineering/distribution/tools/release).
|
||||||
|
|
||||||
## Branching/tagging scheme
|
## Branching/tagging scheme
|
||||||
|
|
||||||
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:
|
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:
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
# Pure-Docker Sourcegraph cluster deployment reference
|
||||||
|
|
||||||
|
## Deploying
|
||||||
|
|
||||||
|
First clone the repository, then:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./deploy.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Visit http://localhost:3080 to visit the running Sourcegraph instance!
|
||||||
|
|
||||||
|
## Tearing down the deployment
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./teardown.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## System topology
|
||||||
|
|
||||||
|
To understand the system topology:
|
||||||
|
|
||||||
|
1. Look at `deploy.sh` to get an overview of services.
|
||||||
|
2. Every service (`deploy-*.sh`) has documentation inline indicating:
|
||||||
|
- What the service does / provides.
|
||||||
|
- What ports the service exposes.
|
||||||
|
- What other services it talks to (see environment variables).
|
||||||
|
|
||||||
|
## Service system requirements
|
||||||
|
|
||||||
|
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).
|
||||||
|
|
||||||
|
## Scaling / replicas
|
||||||
|
|
||||||
|
To scale the cluster deployment, you will need to:
|
||||||
|
|
||||||
|
1. Deploy more instances of `gitserver`, `indexed-search`, `searcher` and `symbols` services as desired.
|
||||||
|
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)
|
||||||
|
3. You're done! You do not need to configure or restart any other services.
|
||||||
|
|
||||||
|
## Metrics and Tracing
|
||||||
|
|
||||||
|
This deployment comes with metrics and tracing built-in. See [metrics and tracing](metrics-and-tracing.md) for details.
|
||||||
|
|
||||||
|
## Configuring HTTPS
|
||||||
|
|
||||||
|
See https://docs.sourcegraph.com/admin/nginx#nginx-for-other-sourcegraph-clusters-e-g-pure-docker
|
||||||
|
|
||||||
|
## Configuring SSH cloning
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
Alternatively, you may use the `OTHER` codehost type under **External services**, which allows you to directly specify Git repository URLs for cloning.
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
```
|
||||||
|
-v ~/my-sourcegraph-ssh-config/.ssh:/home/sourcegraph/.ssh
|
||||||
|
```
|
||||||
|
|
||||||
|
All future Git cloning operations will use the credentials configured there.
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ docker exec -it gitserver-0 sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Then try cloning the repository:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ git clone ssh://git@myhost.com/my/repo /tmp/my-repo
|
||||||
|
```
|
||||||
|
## Questions & Issues
|
||||||
|
|
||||||
|
[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!
|
||||||
@@ -31,6 +31,6 @@ docker run --detach \
|
|||||||
-p 0.0.0.0:80:80 \
|
-p 0.0.0.0:80:80 \
|
||||||
-p 0.0.0.0:443:443 \
|
-p 0.0.0.0:443:443 \
|
||||||
-v $VOLUME:/caddy-storage \
|
-v $VOLUME:/caddy-storage \
|
||||||
--mount type=bind,source="$(pwd)"/caddy/builtins/http.Caddyfile,target=/etc/caddy/Caddyfile \
|
--mount type=bind,source="$(pwd)"/../caddy/builtins/http.Caddyfile,target=/etc/caddy/Caddyfile \
|
||||||
index.docker.io/caddy/caddy:alpine@sha256:ef2f47730caa12cb7d0ba944c048b8e48f029d5e0ff861840fa2b8f1868e1966
|
index.docker.io/caddy/caddy:alpine@sha256:ef2f47730caa12cb7d0ba944c048b8e48f029d5e0ff861840fa2b8f1868e1966
|
||||||
|
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -19,8 +19,8 @@ docker run --detach \
|
|||||||
--memory=1g \
|
--memory=1g \
|
||||||
-p 0.0.0.0:3370:3370 \
|
-p 0.0.0.0:3370:3370 \
|
||||||
-v $VOLUME:/var/lib/grafana \
|
-v $VOLUME:/var/lib/grafana \
|
||||||
-v $(pwd)/grafana/datasources:/sg_config_grafana/provisioning/datasources \
|
-v $(pwd)/../grafana/datasources:/sg_config_grafana/provisioning/datasources \
|
||||||
-v $(pwd)/grafana/dashboards:/sg_grafana_additional_dashboards \
|
-v $(pwd)/../grafana/dashboards:/sg_grafana_additional_dashboards \
|
||||||
index.docker.io/sourcegraph/grafana:insiders@sha256:9ea6958ed176855ec33a5a3cc632eae257fd227fa3de1f987d96bf05c7e83d66
|
index.docker.io/sourcegraph/grafana:insiders@sha256:9ea6958ed176855ec33a5a3cc632eae257fd227fa3de1f987d96bf05c7e83d66
|
||||||
|
|
||||||
# Add the following lines above if you wish to use an auth proxy with Grafana:
|
# Add the following lines above if you wish to use an auth proxy with Grafana:
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -19,6 +19,6 @@ docker run --detach \
|
|||||||
--memory=8g \
|
--memory=8g \
|
||||||
-p 0.0.0.0:9090:9090 \
|
-p 0.0.0.0:9090:9090 \
|
||||||
-v $VOLUME:/prometheus \
|
-v $VOLUME:/prometheus \
|
||||||
-v $(pwd)/prometheus:/sg_prometheus_add_ons \
|
-v $(pwd)/../prometheus:/sg_prometheus_add_ons \
|
||||||
-e SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090 \
|
-e SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090 \
|
||||||
index.docker.io/sourcegraph/prometheus:insiders@sha256:dc0a8dd404f43e7d2f8b664c3b6f5a448c62476526ff47a0fc3500c93aff0ba0
|
index.docker.io/sourcegraph/prometheus:insiders@sha256:dc0a8dd404f43e7d2f8b664c3b6f5a448c62476526ff47a0fc3500c93aff0ba0
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,5 +1,9 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
root_dir="$(dirname "${BASH_SOURCE[0]}")"
|
||||||
|
cd "$root_dir"
|
||||||
|
|
||||||
source ./replicas.sh
|
source ./replicas.sh
|
||||||
|
|
||||||
./teardown.sh
|
./teardown.sh
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,5 +1,9 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
root_dir="$(dirname "${BASH_SOURCE[0]}")"
|
||||||
|
cd "$root_dir"
|
||||||
|
|
||||||
source ./replicas.sh
|
source ./replicas.sh
|
||||||
|
|
||||||
docker rm -f cadvisor &> /dev/null || true &
|
docker rm -f cadvisor &> /dev/null || true &
|
||||||
+1
-1
@@ -6,7 +6,7 @@ deploy_sourcegraph() {
|
|||||||
#Deploy sourcegraph
|
#Deploy sourcegraph
|
||||||
if [[ "$TEST_TYPE" == "pure-docker-test" ]]; then
|
if [[ "$TEST_TYPE" == "pure-docker-test" ]]; then
|
||||||
./test/volume-config.sh
|
./test/volume-config.sh
|
||||||
./deploy.sh
|
./pure-docker/deploy.sh
|
||||||
|
|
||||||
if [[ "$GIT_BRANCH" == *"customer-replica"* ]]; then
|
if [[ "$GIT_BRANCH" == *"customer-replica"* ]]; then
|
||||||
# Expected number of containers on e.g. 3.18-customer-replica branch.
|
# Expected number of containers on e.g. 3.18-customer-replica branch.
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ cd /deploy-sourcegraph-docker
|
|||||||
echo
|
echo
|
||||||
echo "creating deployment for volume directories"
|
echo "creating deployment for volume directories"
|
||||||
echo
|
echo
|
||||||
./deploy.sh
|
./pure-docker/deploy.sh
|
||||||
echo
|
echo
|
||||||
echo "tearing down deployment for volume directories"
|
echo "tearing down deployment for volume directories"
|
||||||
echo
|
echo
|
||||||
./teardown.sh
|
./pure-docker/teardown.sh
|
||||||
# Set permissions on volume directories.
|
# Set permissions on volume directories.
|
||||||
#
|
#
|
||||||
# IMPORTANT: If these change, or a new service is introduced, it must be explicitly called out in
|
# IMPORTANT: If these change, or a new service is introduced, it must be explicitly called out in
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
root_dir="$(dirname "${BASH_SOURCE[0]}")/.."
|
root_dir="$(dirname "${BASH_SOURCE[0]}")"
|
||||||
cd "$root_dir"
|
cd "$root_dir"
|
||||||
|
|
||||||
CONSTRAINT=$1
|
CONSTRAINT=$1
|
||||||
|
|||||||
Reference in new issue
Block a user