Skip to content

Instantly share code, notes, and snippets.

@ryan-blunden
Last active October 3, 2019 04:32
Show Gist options
  • Save ryan-blunden/d60a1745e8b77555632f92fe7ca03871 to your computer and use it in GitHub Desktop.
Save ryan-blunden/d60a1745e8b77555632f92fe7ca03871 to your computer and use it in GitHub Desktop.
Attempt at lang servers
version: '3.7'
services:
sourcegraph:
container_name: sourcegraph
image: sourcegraph/server:3.8.1
environment:
- SRC_LOG_LEVEL=dbug
ports:
- '80:7080'
- '443:7443'
- '2633:2633'
ulimits:
nofile:
soft: 262144
hard: 262144
volumes:
- /etc/sourcegraph:/etc/sourcegraph
- /var/opt/sourcegraph:/var/opt/sourcegraph
networks:
- sourcegraph
depends_on:
- lang-go
- lang-typescript
restart: always
lang-go:
container_name: lang-go
image: sourcegraph/lang-go:latest
ports:
- '4389'
- '6060'
command: ['go-langserver', '-mode=websocket', '-addr=:4389', '-usebuildserver', '-usebinarypkgcache=false']
networks:
- sourcegraph
restart: always
lang-typescript:
container_name: lang-typescript
image: sourcegraph/lang-typescript:latest
ports:
- '8080'
- '6060'
networks:
- sourcegraph
restart: always
networks:
sourcegraph:
{
"go.serverUrl": "wss://sourcegraph:MTM2ODA5YzljMzRjNWNjNDEzNjM1NzNh@ec2-13-52-104-210.us-west-1.compute.amazonaws.com/lang-go",
"go.sourcegraphUrl": "http://sourcegraph:7080",
//
"typescript.serverUrl": "wss://sourcegraph:MTM2ODA5YzljMzRjNWNjNDEzNjM1NzNh@ec2-13-52-104-210.us-west-1.compute.amazonaws.com/lang-typescript",
"typescript.sourcegraphUrl": "http://sourcegraph:7080",
"typescript.diagnostics.enable": true,
"typescript.langserver.log": "info"
}
error_log stderr;
pid /var/run/nginx.pid;
# Do not remove. The contents of sourcegraph_main.conf can change between
# versions and may include improvements to the configuration.
include nginx/sourcegraph_main.conf;
events {
}
http {
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server_tokens off;
# SAML redirect response headers are sometimes large
proxy_buffer_size 128k;
proxy_buffers 8 256k;
proxy_busy_buffers_size 256k;
# Do not remove. The contents of sourcegraph_http.conf can change between
# versions and may include improvements to the configuration.
include nginx/sourcegraph_http.conf;
access_log off;
upstream backend {
# Do not remove. The contents of sourcegraph_backend.conf can change
# between versions and may include improvements to the configuration.
include nginx/sourcegraph_backend.conf;
}
server {
listen 7080 default_server;
return 301 https://$host$request_uri;
}
server {
# Do not remove. The contents of sourcegraph_server.conf can change
# between versions and may include improvements to the configuration.
include nginx/sourcegraph_server.conf;
listen 7080;
listen 7443 ssl http2 default_server;
ssl_certificate cert/sourcegraph.crt;
ssl_certificate_key cert/sourcegraph.key;
location / {
proxy_pass http://backend;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# SAML redirect response headers are sometimes large
proxy_buffer_size 128k;
proxy_buffers 8 256k;
proxy_busy_buffers_size 256k;
}
location /lang-go {
proxy_pass http://lang-go:4389;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_read_timeout 20s;
auth_basic "Basic authentication required to access language server";
auth_basic_user_file /etc/sourcegraph/.lang_sever_htpasswd;
}
location /lang-typescript {
proxy_pass http://lang-typescript:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_read_timeout 20s;
auth_basic "Basic authentication required to access language server";
auth_basic_user_file /etc/sourcegraph/.lang_sever_htpasswd;
}
location '/.well-known/acme-challenge' {
default_type "text/plain";
root /var/www/html;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment