diff --git a/server/cmd/museum/main.go b/server/cmd/museum/main.go index 4905e82a4f..2c9f5fdd41 100644 --- a/server/cmd/museum/main.go +++ b/server/cmd/museum/main.go @@ -712,9 +712,8 @@ func main() { } func runServer(environment string, server *gin.Engine) { - if environment == "local" || environment == "proxy" { - server.Run(":8080") - } else { + useTLS := viper.GetBool("http.use_tls") + if useTLS { certPath, err := config.CredentialFilePath("tls.cert") if err != nil { log.Fatal(err) @@ -726,6 +725,8 @@ func runServer(environment string, server *gin.Engine) { } log.Fatal(server.RunTLS(":443", certPath, keyPath)) + } else { + server.Run(":8080") } } diff --git a/server/configurations/local.yaml b/server/configurations/local.yaml index 4bab089b6a..ebb85833b5 100644 --- a/server/configurations/local.yaml +++ b/server/configurations/local.yaml @@ -65,6 +65,12 @@ # It must be specified if running in a non-local environment. log-file: "" +# HTTP connection parameters +http: + # If true, bind to 443 and use TLS. + # By default, this is false, and museum will bind to 8080 without TLS. + # use_tls: true + # Database connection parameters db: host: localhost diff --git a/server/configurations/production.yaml b/server/configurations/production.yaml index 6c7c20b81f..d3d48b3568 100644 --- a/server/configurations/production.yaml +++ b/server/configurations/production.yaml @@ -1,5 +1,8 @@ log-file: /var/logs/museum.log +http: + use_tls: true + stripe: path: success: ?status=success&session_id={CHECKOUT_SESSION_ID} diff --git a/server/configurations/proxy.yaml b/server/configurations/proxy.yaml deleted file mode 100644 index 0f206f09a2..0000000000 --- a/server/configurations/proxy.yaml +++ /dev/null @@ -1,11 +0,0 @@ -# Production setup when running behind a reverse proxy like Nginx -# -# - TLS terminates on Nginx not on us -# - Otherwise the same as `production.yaml` - -log-file: /var/logs/museum.log - -stripe: - path: - success: ?status=success&session_id={CHECKOUT_SESSION_ID} - cancel: ?status=fail&reason=canceled diff --git a/server/scripts/deploy/museum.nginx.service b/server/scripts/deploy/museum.nginx.service index 93e414a01e..fa0472ca8c 100644 --- a/server/scripts/deploy/museum.nginx.service +++ b/server/scripts/deploy/museum.nginx.service @@ -10,7 +10,8 @@ ExecStartPre=docker pull rg.fr-par.scw.cloud/ente/museum-prod ExecStartPre=-docker stop museum ExecStartPre=-docker rm museum ExecStart=docker run --name museum \ - -e ENVIRONMENT=proxy \ + -e ENVIRONMENT=production \ + -e ENTE_HTTP-USE_TLS=0 \ --hostname "%H" \ -p 8080:8080 \ -p 2112:2112 \