Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev: remove nginx #13299

Merged
merged 7 commits into from
Feb 18, 2021
Merged
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
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,6 @@ storybook-static/
*.pem
*.crt

# Custom dev-specific nginx config
/dev/*.nginx.conf

# tilt files
/dev/tilt/generated-cluster
/dev/tilt/tilt-watch-targets
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
- Node.js (version 8 or 10)
- Redis
- Yarn
- Nginx

For a detailed guide to installing prerequisites, see [these
instructions](doc/dev/getting-started/quickstart_1_install_dependencies.md).
Expand Down
1 change: 0 additions & 1 deletion dev/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
/config_base.json
/config_combined.json
/config_backup.json
/nginx.pid
20 changes: 16 additions & 4 deletions dev/Caddyfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
{
http_port 3088
http_port 3081
auto_https disable_redirects
}

# A bit of monstrosity, since we need to reverse proxy via webpack which then
# reverse proxies to us on HTTP.
#
# Caddy (tls :3443) -> webpack (:3080) -> Caddy (:3081) -> sourcegraph-frontend (:3082)
{$SOURCEGRAPH_HTTPS_DOMAIN}:{$SOURCEGRAPH_HTTPS_PORT} {
tls internal
reverse_proxy localhost:3080
}

# Caddy (:3081) -> sourcegraph-frontend (:3082)
:3081 {
reverse_proxy localhost:3082
}
{$SOURCEGRAPH_HTTPS_DOMAIN}:{$SOURCEGRAPH_HTTPS_PORT}
tls internal
reverse_proxy localhost:3080
1 change: 0 additions & 1 deletion dev/Procfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ symbols: symbols
github-proxy: github-proxy
frontend: env CONFIGURATION_MODE=server SITE_CONFIG_ESCAPE_HATCH_PATH=$HOME/.sourcegraph/site-config.json frontend
watch: ./dev/changewatch.sh
nginx: nginx -p . -g 'daemon off;' -c $PWD/dev/nginx.conf 2>&1 | grep -v 'could not open error log file'
caddy: ./dev/caddy.sh run --watch --config=dev/Caddyfile
web: ./node_modules/.bin/gulp --silent --color dev
syntect_server: ./dev/syntect_server.sh
Expand Down
5 changes: 0 additions & 5 deletions dev/caddy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ set -euf -o pipefail

pushd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null

if [ -n "${NO_CADDY:-}" ]; then
echo Not using Caddy because NO_CADDY is set. SSH support through Caddy will not work.
exit 0
fi

mkdir -p .bin

version="2.3.0"
Expand Down
40 changes: 0 additions & 40 deletions dev/nginx.conf

This file was deleted.

1 change: 0 additions & 1 deletion dev/nginx/body/README

This file was deleted.

2 changes: 1 addition & 1 deletion dev/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export SOURCEGRAPH_HTTPS_PORT="${SOURCEGRAPH_HTTPS_PORT:-"3443"}"
[ -n "${DISABLE_SEARCH_SHARDING-}" ] || export INDEXED_SEARCH_SERVERS="localhost:3070 localhost:3071"

# webpack-dev-server is a proxy running on port 3080 that (1) serves assets, waiting to respond
# until they are (re)built and (2) otherwise proxies to nginx running on port 3081 (which proxies to
# until they are (re)built and (2) otherwise proxies to Caddy running on port 3081 (which proxies to
# Sourcegraph running on port 3082). That is why Sourcegraph listens on 3082 despite the externalURL
# having port 3080.
export SRC_HTTP_ADDR=":3082"
Expand Down
7 changes: 3 additions & 4 deletions doc/dev/getting-started/quickstart_1_install_dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Sourcegraph has the following dependencies:
- [PostgreSQL](https://wiki.postgresql.org/wiki/Detailed_installation_guides) (v11 or higher)
- [Redis](http://redis.io/) (v5.0.7 or higher)
- [Yarn](https://yarnpkg.com) (v1.10.1 or higher)
- [NGINX](https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/) (v1.14 or higher)
- [SQLite](https://www.sqlite.org/index.html) tools
- [Golang Migrate](https://github.com/golang-migrate/migrate/) (v4.7.0 or higher)
- [Comby](https://github.com/comby-tools/comby/) (v0.11.3 or higher)
Expand All @@ -31,10 +30,10 @@ The following are two recommendations for installing these dependencies:
brew cask install docker
```

3. Install Go, Node Version Manager, PostgreSQL, Redis, Git, NGINX, golang-migrate, Comby, SQLite tools, and jq with the following command:
3. Install Go, Node Version Manager, PostgreSQL, Redis, Git, golang-migrate, Comby, SQLite tools, and jq with the following command:

```
brew install go yarn redis postgresql git gnu-sed nginx golang-migrate comby sqlite pcre FiloSottile/musl-cross/musl-cross jq watchman
brew install go yarn redis postgresql git gnu-sed golang-migrate comby sqlite pcre FiloSottile/musl-cross/musl-cross jq watchman
```

4. Install the Node Version Manager (`nvm`) using:
Expand Down Expand Up @@ -132,7 +131,7 @@ The following are two recommendations for installing these dependencies:
3. Install dependencies:

```
sudo apt install -y make git-all postgresql postgresql-contrib redis-server nginx libpcre3-dev libsqlite3-dev pkg-config golang-go musl-tools docker-ce docker-ce-cli containerd.io yarn jq
sudo apt install -y make git-all postgresql postgresql-contrib redis-server libpcre3-dev libsqlite3-dev pkg-config golang-go musl-tools docker-ce docker-ce-cli containerd.io yarn jq

# install golang-migrate (you must rename the extracted binary to `golang-migrate` and move the binary into your $PATH)
curl -L https://github.com/golang-migrate/migrate/releases/download/v4.7.0/migrate.linux-amd64.tar.gz | tar xvz
Expand Down
2 changes: 1 addition & 1 deletion doc/dev/how-to/troubleshooting_local_development.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ If you ever need to wipe your local database and Redis, run the following comman

We use Caddy 2 to setup HTTPS for local development. It creates self-signed certificates and uses that to serve the local Sourcegraph instance. If your browser complains about the certificate, check the following:

1. The first time that Caddy 2 reverse-proxies your Sourcegraph instance, it needs to add its certificate authority to your local certificate store. This may require elevated permissions on your machine. If you haven't done so already, try running `caddy reverse-proxy --to localhost:3080` and enter your password if prompted. You may also need to run that command as the `root` user.
1. The first time that Caddy 2 reverse-proxies your Sourcegraph instance, it needs to add its certificate authority to your local certificate store. This may require elevated permissions on your machine. If you haven't done so already, try running `./dev/caddy.sh reverse-proxy --to localhost:3080` and enter your password if prompted. You may also need to run that command as the `root` user.

1. If you have completed the previous step and your browser still complains about the certificate, try restarting your browser or your local machine.

Expand Down