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

dev: remove nginx #13299

merged 7 commits into from
Feb 18, 2021

Conversation

keegancsmith
Copy link
Member

We already have Caddy running for HTTPS support. We can use just Caddy
to remove the need to have nginx in our dev environments. This does mean
we won't be using the same reverse proxy as we do in production and for
customers. However, I do not think that changes much in practice.

This was inspired by a conversation I had with @mrnugget. Not completely sold on the idea though after implementing the change (especially since we have caddy -> webpack -> caddy -> frontend now).

@felixfbecker is this still an issue for you? https://github.com/sourcegraph/sourcegraph/pull/10021

@slimsag
Copy link
Member

slimsag commented Aug 24, 2020

This does mean we won't be using the same reverse proxy as we do in production and for customers.

Production/customer environments run various reverse proxies:

  • Managed instances: Google Cloud Load Balancer
  • Kubernetes: k8s ingress OR nginx-svc
  • Docker Compose: Caddy
  • Pure Docker: Apache
  • Server: nginx(?)

Copy link
Member

@slimsag slimsag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't review but signaling my approval for this idea.

Copy link
Contributor

@mrnugget mrnugget left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm all for it. Less processes, less config files and while the reverse-reverse-proxy-stuff is not the prettiest, I like how you documented it now — much clearer than what we had before.

@felixfbecker
Copy link
Contributor

We already have Caddy running for HTTPS support.

Caddy with HTTPS still doesn't work for me and using an extra workaround nginx config file with HTTPS config is still the only way I can get a functioning dev environment. See https://github.com/sourcegraph/sourcegraph/issues/10103. Unfortunately I have zero experience with Caddy (as opposed to nginx) and because I get no error messages from Caddy I have no idea how to solve this by myself. How can I keep a functioning dev environment after this PR?

@keegancsmith
Copy link
Member Author

@felixfbecker can you try out this branch? We bump the caddy version, which might help resolve the issue.

We already have Caddy running for HTTPS support. We can use just Caddy
to remove the need to have nginx in our dev environments. This does mean
we won't be using the same reverse proxy as we do in production and for
customers. However, I do not think that changes much in practice.
@mrnugget
Copy link
Contributor

@felixfbecker Could you try this again? It would be cool if we can get rid of one of two services.

@codecov
Copy link

codecov bot commented Feb 16, 2021

Codecov Report

Merging #13299 (374674b) into main (dbd62f6) will increase coverage by 1.12%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main   #13299      +/-   ##
==========================================
+ Coverage   50.94%   52.06%   +1.12%     
==========================================
  Files        1749     1506     -243     
  Lines       87687    83520    -4167     
  Branches     7964     6977     -987     
==========================================
- Hits        44671    43488    -1183     
+ Misses      39079    36435    -2644     
+ Partials     3937     3597     -340     
Flag Coverage Δ
go 52.70% <ø> (+2.91%) ⬆️
integration 29.54% <ø> (-0.58%) ⬇️
storybook 15.77% <ø> (-14.73%) ⬇️
typescript 50.34% <ø> (-3.36%) ⬇️
unit 34.10% <ø> (-1.40%) ⬇️
Impacted Files Coverage Δ
...cker-images/prometheus/cmd/prom-wrapper/silence.go 0.00% <0.00%> (-90.00%) ⬇️
...end/graphqlbackend/repository_text_search_index.go 0.00% <0.00%> (-38.58%) ⬇️
...ocker-images/prometheus/cmd/prom-wrapper/status.go 0.00% <0.00%> (-34.32%) ⬇️
...d/frontend/graphqlbackend/externallink/resolver.go 0.00% <0.00%> (-33.34%) ⬇️
cmd/frontend/backend/repos_vcs.go 21.05% <0.00%> (-32.80%) ⬇️
enterprise/internal/codeintel/gitserver/client.go 0.00% <0.00%> (-27.90%) ⬇️
...er-images/prometheus/cmd/prom-wrapper/receivers.go 50.00% <0.00%> (-17.71%) ⬇️
cmd/frontend/graphqlbackend/repository_mirror.go 10.60% <0.00%> (-14.16%) ⬇️
cmd/frontend/internal/app/debug.go 17.14% <0.00%> (-13.90%) ⬇️
cmd/frontend/graphqlbackend/search_symbols.go 11.83% <0.00%> (-12.32%) ⬇️
... and 2749 more

@sourcegraph-bot
Copy link
Contributor

sourcegraph-bot commented Feb 16, 2021

Notifying subscribers in CODENOTIFY files for diff 58707f3...2cf5028.

Notify File(s)
@christinaforney doc/dev/getting-started/quickstart_1_install_dependencies.md
doc/dev/how-to/troubleshooting_local_development.md

@mrnugget
Copy link
Contributor

Works for me!

@felixfbecker
Copy link
Contributor

This is still not working for me, however now I at least seem to get an error message. I have no idea how to resolve this though, Caddy feels like a blackbox to me 😬

11:03:13                     caddy | {"level":"error","ts":1613556193.239407,"logger":"tls.renew","msg":"will retry","error":"open /Users/felix/Library/Application Support/Caddy/certificates/local/sourcegraph.test/sourcegraph.test.crt: no such file or directory","attempt":2,"retrying_in":120,"elapsed":60.004151059,"max_duration":2592000}

@mrnugget
Copy link
Contributor

Does the rest of the path exist? /Users/felix/Library/Application Support/Caddy/certificates/local/sourcegraph.test?

What happens if you delete the whole folder, /Users/felix/Library/Application Support/Caddy, and start with ./dev/caddy.sh trust and then ./dev/caddy.sh run --watch --config=dev/Caddyfile?

(btw. side note: if you're not using Caddy, how do you use HTTPS?)

Copy link
Member

@eseliger eseliger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems to work on my machine, so LGTM
nice job cleaning up this mess a bit 😁

Copy link
Contributor

@felixfbecker felixfbecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mrnugget's steps worked for me. Thanks!

@felixfbecker
Copy link
Contributor

felixfbecker commented Feb 18, 2021

(btw. side note: if you're not using Caddy, how do you use HTTPS?)

I had a custom gitignored nginx config with a certificate generated by mkcert. I added support for sourcing custom nginx configs right when we switched to Caddy as a workaround because Caddy was just not working for me (meaning my dev env was broken and I needed an immediate solution) and nobody could help me 🤷‍♂️. I'm certainly happy to be able to get rid of that!

@mrnugget
Copy link
Contributor

Sweet! Happy to hear that!

@keegancsmith keegancsmith enabled auto-merge (squash) February 18, 2021 14:37
@keegancsmith keegancsmith merged commit 14acd29 into main Feb 18, 2021
@keegancsmith keegancsmith deleted the k/dev-rm-nginx branch February 18, 2021 14:38
@keegancsmith keegancsmith added the dx Issues and PRs related to developer experience concerns label Feb 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dx Issues and PRs related to developer experience concerns
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants