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

SourceGraph? #65

Closed
STaRDoGG opened this issue Jun 18, 2019 · 6 comments
Closed

SourceGraph? #65

STaRDoGG opened this issue Jun 18, 2019 · 6 comments

Comments

@STaRDoGG
Copy link
Contributor

Have any config samples up your sleeve yet for SourceGraph? ;)

@nemchik
Copy link
Member

nemchik commented Jun 18, 2019

Completely untested, but you could try:

# make sure that your dns has a cname set for sourcegraph and that your sourcegraph container is not using a base url

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name sourcegraph.*;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;

    # enable for ldap auth, fill in ldap details in ldap.conf
    #include /config/nginx/ldap.conf;

    location / {
        # enable the next two lines for http auth
        #auth_basic "Restricted";
        #auth_basic_user_file /config/nginx/.htpasswd;

        # enable the next two lines for ldap auth
        #auth_request /auth;
        #error_page 401 =200 /login;

        include /config/nginx/proxy.conf;
        resolver 127.0.0.11 valid=30s;
        set $upstream_sourcegraph sourcegraph;
        proxy_pass http://$upstream_sourcegraph:7080;
    }
}

@STaRDoGG
Copy link
Contributor Author

@nemchik Thanks for the help

That looks like what I had tried as well, only I also included some extra code for it's 'management console' port as well, still no luck getting it working. Here's all of the code I have so far. Note that I also included the server code for my main domain as well (in the default file in site-confs).

Code in default site-confs:

##
# Main server
# main.domain.rocks:3333
##
server {

	listen 443 ssl http2 default_server;
	listen [::]:443 ssl http2 default_server;

	root /config/www;
	index index.php index.html index.htm;

	server_name main.domain.rocks;

	include /config/nginx/proxy-confs/*.subfolder.conf;
	include /config/nginx/ssl.conf;

	client_max_body_size 0;

	location ~ \.php$ {
		fastcgi_split_path_info ^(.+\.php)(/.+)$;
		fastcgi_pass 127.0.0.1:9000;
		fastcgi_index index.php;
		include /etc/nginx/fastcgi_params;
	}
}

##
# Sourcegraph server
# sourcegraph.domain.rocks:3333
##
server {
	listen 443 ssl http2;
	listen [::]:443 ssl http2;

	root /config/www;
	index index.php index.html index.htm;

	server_name sourcegraph.domain.rocks;

	include /config/nginx/proxy-confs/*.subfolder.conf;
	include /config/nginx/ssl.conf;

	client_max_body_size 0;
}

Code in sourcegraph.subdomain.rocks:

server {

    listen 443 ssl;
    listen [::]:443 ssl;

    server_name sourcegraph.*;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;

    location / {

        include /config/nginx/proxy.conf;
        resolver 127.0.0.11 valid=30s;
        set $upstream_sourcegraph sourcegraph;
        proxy_pass http://$upstream_sourcegraph:7080;
    }

    # This allows access to the management console
    location ~ (/sourcegraph)?/mc {
        include /config/nginx/proxy.conf;
        resolver 127.0.0.11 valid=30s;
        set $upstream_sourcegraph sourcegraph;
        proxy_pass http://$upstream_sourcegraph:2633;
   }
}

Container name is sourcegraph. When I navigate to: https://sourcegraph.domain.rocks:3333 it redirects me to https://main.domain.rocks:3333.

@nemchik
Copy link
Member

nemchik commented Jun 19, 2019

What are you doing with the port 3333?

Anyway you shouldn't need to put that stuff in the default site conf. generally speaking that file should be left alone and use what comes out of the box unless you know what you're doing.

As for the proxy conf it should be named sourcegraph.subfolder.conf and placed in the proxy conf folder. I am not familiar with how the management console works but it looks like you have it set to use a different port. Depending on how it handles subfolders/baseurl/prefix paths you may need a bit more work to get it going.

@STaRDoGG
Copy link
Contributor Author

STaRDoGG commented Jun 20, 2019

@nemchik I use port 3333 so I can add that port to my router and have all traffic on that port go to a specific computer within my LAN. It seems to work fine. I've been doing that for years, and also have it working fine for ~16 containers so far.

Ok, I'll remove the config from the default site conf and just add the config to the proxy. I was under the impression that all subdomains needed their own server block in the default conf.

I have a sourcegraph.subdomain.conf in that folder (with that code above) because all of the sample proxy confs have either a *.subdomain.conf, and a *.subfolder.conf, and since this site in particular is a subdomain, I saved it as such; that's not correct?

Re: the different ports; sourcegraph, for whatever reason they chose, has the main "stuff" at one port, and the "management stuff" on a different port, with it's own uniquely generated, one time pw. I've never really had a chance yet to use it so I'm not sure why they chose that route rather than just include the management stuff in it's own area on the main port.

btw, the reason I'm using it as it's own subdomain rather than subfolder is because (and I found this out after quite a bit of hair loss) is that this app in particular will only work as a subdomain.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 16, 2023
@github-actions
Copy link

This issue is locked due to inactivity

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants