Soft Serve through https

http Setup

In this example, the port used is 23231, but it can be anything. Open /var/lib/soft-serve/data/config.yaml and make sure the http section looks like this:

 1# The HTTP server configuration.
 2http:
 3  # The address on which the HTTP server will listen.
 4  listen_addr: ":23232"
 5
 6  # The path to the TLS private key.
 7  tls_key_path: ""
 8
 9  # The path to the TLS certificate.
10  tls_cert_path: ""
11
12  # The public URL of the HTTP server.
13  # This is the address that will be used to clone repositories.
14  # Make sure to use https:// if you are using TLS.
15  public_url: "http://localhost:23232"

Restart the soft-serve service, then check it's working by cloning from localhost:

1git clone http://localhost:23232/${some_repo}.git

https Setup

Put this file at /etc/nginx/sites-enabled/$DOMAIN.tld, then set up standard certificates with nginx.

(replace ${DOMAIN_NAME} with your domain's name).

 1 server {
 2     listen 80;
 3     server_name ${DOMAIN_NAME};
 4                                                                                        
 5     location / {
 6         proxy_pass http://localhost:23232;
 7         proxy_set_header Host $host;
 8         proxy_set_header X-Real-IP $remote_addr;
 9         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
10     }
11                                                                                        
12     return 301 https://$server_name$request_uri;
13}
14                                                                                        
15 server {
16     listen 443 ssl;
17     server_name ${DOMAIN_NAME};
18
19     location / {
20         proxy_pass http://localhost:23232;
21         proxy_set_header Host $host;
22         proxy_set_header X-Real-IP $remote_addr;
23         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
24     }
25}