Przeglądaj źródła

Merge branch 'master' into simplified-view

Soham Dessai 3 lat temu
rodzic
commit
783e73245e

+ 7 - 0
api/server/handlers/infra/forms.go

@@ -735,6 +735,13 @@ tabs:
     - type: array-input
       variable: azs
       label: Availability Zones
+  - name: net_settings_single_az_nat_gateway
+    contents:
+    - type: checkbox
+      variable: single_az_nat_gateway
+      label: "Place a NAT gateway inside a single AZ. Disabling this will place a NAT gateway in each AZ, for each subnet in your cluster's VPC."
+      settings:
+        default: true
   - name: nginx_settings
     contents:
     - type: heading

+ 1 - 4
api/server/shared/config/env/envconfs.go

@@ -46,10 +46,7 @@ type ServerConf struct {
 	GithubAppWebhookSecret string `env:"GITHUB_APP_WEBHOOK_SECRET"`
 	GithubAppID            string `env:"GITHUB_APP_ID"`
 	GithubAppSecretPath    string `env:"GITHUB_APP_SECRET_PATH"`
-	// GithubAppSecretBase64 is a base64 encoded version of the GithubAppSecret. This can be used instead of GithubAppSecretPath to pass in a key, allowing for support in systems where mounting the secret is not possible.
-	// If GithubAppSecretBase64 is set, it will check for a file at GithubAppSecretPath. If a file is found, the file will NOT be overwritten. If no file it found, then GithubAppSecretBase64 will be decoded and written to GithubAppSecretPath.
-	GithubAppSecretBase64 string `env:"GITHUB_APP_SECRET_BASE64"`
-	GithubAppSecret       []byte
+	GithubAppSecret        []byte
 
 	GoogleClientID         string `env:"GOOGLE_CLIENT_ID"`
 	GoogleClientSecret     string `env:"GOOGLE_CLIENT_SECRET"`

+ 8 - 39
api/server/shared/config/loader/loader.go

@@ -1,10 +1,8 @@
 package loader
 
 import (
-	"encoding/base64"
 	"errors"
 	"fmt"
-	"io/ioutil"
 	"net/http"
 	"os"
 	"path/filepath"
@@ -186,51 +184,22 @@ func (e *EnvConfigLoader) LoadConfig() (res *config.Config, err error) {
 		res.Logger.Info().Msg("Created Github client")
 	}
 
-	if sc.GithubAppSecretBase64 != "" {
-		if sc.GithubAppSecretPath == "" {
-			sc.GithubAppSecretPath = "github-app-secret-key"
-		}
-		_, err := os.Stat(sc.GithubAppSecretPath)
-		if err != nil {
-			if !errors.Is(err, os.ErrNotExist) {
-				return nil, fmt.Errorf("GITHUB_APP_SECRET_BASE64 provided, but error checking if GITHUB_APP_SECRET_PATH exists: %w", err)
-			}
-			secret, err := base64.StdEncoding.DecodeString(sc.GithubAppSecretBase64)
-			if err != nil {
-				return nil, fmt.Errorf("GITHUB_APP_SECRET_BASE64 provided, but error decoding: %w", err)
-			}
-			_, err = createDirectoryRecursively(sc.GithubAppSecretPath)
-			if err != nil {
-				return nil, fmt.Errorf("GITHUB_APP_SECRET_BASE64 provided, but error creating directory for GITHUB_APP_SECRET_PATH: %w", err)
-			}
-			err = os.WriteFile(sc.GithubAppSecretPath, secret, os.ModePerm)
-			if err != nil {
-				return nil, fmt.Errorf("GITHUB_APP_SECRET_BASE64 provided, but error writing to GITHUB_APP_SECRET_PATH: %w", err)
-			}
-		}
-	}
-
 	if sc.GithubAppClientID != "" &&
 		sc.GithubAppClientSecret != "" &&
 		sc.GithubAppName != "" &&
 		sc.GithubAppWebhookSecret != "" &&
 		sc.GithubAppSecretPath != "" &&
 		sc.GithubAppID != "" {
-		if AppID, err := strconv.ParseInt(sc.GithubAppID, 10, 64); err == nil {
-			res.GithubAppConf = oauth.NewGithubAppClient(&oauth.Config{
-				ClientID:     sc.GithubAppClientID,
-				ClientSecret: sc.GithubAppClientSecret,
-				Scopes:       []string{"read:user"},
-				BaseURL:      sc.ServerURL,
-			}, sc.GithubAppName, sc.GithubAppWebhookSecret, sc.GithubAppSecretPath, AppID)
-		}
-
-		secret, err := ioutil.ReadFile(sc.GithubAppSecretPath)
+		AppID, err := strconv.Atoi(sc.GithubAppID)
 		if err != nil {
-			return nil, fmt.Errorf("could not read github app secret: %s", err)
+			return nil, fmt.Errorf("could not read github App ID: %s", err)
 		}
-
-		sc.GithubAppSecret = append(sc.GithubAppSecret, secret...)
+		res.GithubAppConf = oauth.NewGithubAppClient(&oauth.Config{
+			ClientID:     sc.GithubAppClientID,
+			ClientSecret: sc.GithubAppClientSecret,
+			Scopes:       []string{"read:user"},
+			BaseURL:      sc.ServerURL,
+		}, sc.GithubAppName, sc.GithubAppWebhookSecret, sc.GithubAppSecretPath, int64(AppID))
 	}
 
 	if sc.SlackClientID != "" && sc.SlackClientSecret != "" {

+ 1 - 5
dashboard/src/main/home/cluster-dashboard/env-groups/EnvGroupArray.tsx

@@ -153,11 +153,7 @@ const EnvGroupArray = ({
                   {!disabled && (
                     <DeleteButton
                       onClick={() => {
-                        let _values = values;
-                        _values = _values.filter(
-                          (val) => val.key !== entry.key
-                        );
-                        setValues(_values);
+                        setValues(values.filter((val, index) => index !== i));
                       }}
                     >
                       <i className="material-icons">cancel</i>

+ 5 - 4
docs/developing/setup.md

@@ -28,14 +28,15 @@ First, in `/dashboard/.env`:
 
 ```
 NODE_ENV=development
-API_SERVER=localhost:8080
+API_SERVER=http://localhost:8081
+ENABLE_PROXY=true
 ```
 
 Next, in `/docker/.env`:
 
 ```
-SERVER_URL=http://localhost:8080
-SERVER_PORT=8080
+SERVER_URL=http://localhost:8081
+SERVER_PORT=8081
 DB_HOST=postgres
 DB_PORT=5432
 DB_USER=porter
@@ -44,7 +45,7 @@ DB_NAME=porter
 SQL_LITE=false
 ```
 
-Once you've done this, go to the root repository, and run `docker-compose -f docker-compose.dev.yaml up`. You should see postgres, webpack, and porter containers spin up. When the webpack and porter containers have finished compiling and have spun up successfully (this will take 5-10 minutes after the containers start), .
+Finally, run `make start-dev` from the root of the project. If you have all the dependencies set up correctly, things should just work.
 
 At this point, you can make a change to any `.go` file to trigger a backend rebuild, and any file in `/dashboard/src` to trigger a hot reload.
 

+ 1 - 1
scripts/dev-environment/SetupEnvironment.sh

@@ -31,7 +31,7 @@ fi
 
 if [[ ! -d ./dashboard/node_modules ]]; then 
   echo "Couldn't find node_modules, installing npm packages"
-  cd ./dashboard && npm install;
+  cd ./dashboard && npm install --legacy-peer-deps;
   cd ../;  
 else
   echo "Node modules found! Proceeding to start server"