diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index 30691452fab..00fa69e7b9f 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -99,16 +99,4 @@ jobs: tags: | ${{ steps.login-ecr.outputs.registry }}/lakefs:${{ steps.version.outputs.tag }} treeverse/lakefs:${{ steps.version.outputs.tag }} - treeverse/lakefs:latest - - - name: Build and push lakefs quickstart - uses: docker/build-push-action@v3 - with: - context: . - target: lakefs-plugins - push: true - platforms: linux/amd64,linux/arm64,darwin/amd64,darwin/arm64 - build-args: | - VERSION=${{ steps.version.outputs.tag }} - QUICKSTART=true - tags: treeverse/lakefs:quickstart + treeverse/lakefs:latest \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 46605e4eb83..b7112e017b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -95,10 +95,7 @@ RUN apk add netcat-openbsd WORKDIR /app COPY ./scripts/wait-for ./ - -ARG QUICKSTART=false -ENV PATH=/app:$PATH QUICKSTART=${QUICKSTART} - +ENV PATH /app:$PATH COPY --from=build /build/lakefs /build/lakectl ./ COPY --from=build-delta-diff-plugin /delta-diff/target/release/delta_diff ./ diff --git a/README.md b/README.md index 9db52b9877b..84c5023385f 100644 --- a/README.md +++ b/README.md @@ -37,8 +37,8 @@ You can spin up a standalone sandbox instance of lakeFS using Docker: docker run --pull always \ --name lakefs \ -p 8000:8000 \ - treeverse/lakefs:quickstart \ - run --local-settings + treeverse/lakefs:latest \ + run --quickstart ``` Once you've got lakeFS running, open [http://127.0.0.1:8000/](http://127.0.0.1:8000/) in your web browser. diff --git a/cmd/lakefs/cmd/root.go b/cmd/lakefs/cmd/root.go index 1f3e5c1218b..c044acfeb58 100644 --- a/cmd/lakefs/cmd/root.go +++ b/cmd/lakefs/cmd/root.go @@ -11,7 +11,9 @@ import ( "github.com/mitchellh/go-homedir" "github.com/spf13/cobra" "github.com/spf13/viper" + "github.com/treeverse/lakefs/pkg/block" "github.com/treeverse/lakefs/pkg/config" + "github.com/treeverse/lakefs/pkg/kv/local" "github.com/treeverse/lakefs/pkg/logging" "github.com/treeverse/lakefs/pkg/version" ) @@ -41,26 +43,50 @@ func init() { rootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "c", "", "config file (default is $HOME/.lakefs.yaml)") rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") rootCmd.PersistentFlags().Bool(config.UseLocalConfiguration, false, "Use lakeFS local default configuration") + rootCmd.PersistentFlags().Bool(config.QuickStartConfiguration, false, "Use lakeFS quickstart configuration") } -func useLocal() bool { - res, err := rootCmd.PersistentFlags().GetBool(config.UseLocalConfiguration) +func validateQuickstartEnv(cfg *config.Config) { + if cfg.Database.Type != local.DriverName || cfg.Blockstore.Type != block.BlockstoreTypeLocal { + fmt.Printf("quickstart mode can only run with local settings\n") + os.Exit(1) + } + accessKey := "AKIAIOSFOLQUICKSTART" + secretKey := "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" + cfg.Installation.UserName = "quickstart" + cfg.Installation.AccessKeyID = config.SecureString(accessKey) + cfg.Installation.SecretAccessKey = config.SecureString(secretKey) + fmt.Printf("Access Key ID : %s \n", accessKey) + fmt.Printf("Secret Access Key: %s \n", secretKey) +} + +func useConfig(cfg string) bool { + res, err := rootCmd.PersistentFlags().GetBool(cfg) if err != nil { - fmt.Printf("%s: %s\n", config.UseLocalConfiguration, err) + fmt.Printf("%s: %s\n", cfg, err) os.Exit(1) } if res { - printLocalWarning(os.Stderr, "local parameters configuration") + printLocalWarning(os.Stderr, fmt.Sprintf("%s parameters configuration", cfg)) } return res } func newConfig() (*config.Config, error) { - if useLocal() { - return config.NewLocalConfig() - } + quickStart := useConfig(config.QuickStartConfiguration) - return config.NewConfig() + if useConfig(config.UseLocalConfiguration) || quickStart { + cfg, err := config.NewLocalConfig() + if err != nil { + return nil, err + } + if quickStart { + validateQuickstartEnv(cfg) + } + return cfg, err + } else { + return config.NewConfig() + } } func loadConfig() *config.Config { diff --git a/cmd/lakefs/cmd/run.go b/cmd/lakefs/cmd/run.go index 2da6831b740..0d43e3841d9 100644 --- a/cmd/lakefs/cmd/run.go +++ b/cmd/lakefs/cmd/run.go @@ -495,7 +495,7 @@ func printWelcome(w io.Writer) { const localWarningBanner = ` WARNING! -Using %s. This is suitable only for testing! It is NOT SUPPORTED for production. +Using %s. This is suitable only for testing! It is NOT SUPPORTED for production. ` func printLocalWarning(w io.Writer, msg string) { diff --git a/docs/quickstart/launch.md b/docs/quickstart/launch.md index bf96ff5d077..e0867e08155 100644 --- a/docs/quickstart/launch.md +++ b/docs/quickstart/launch.md @@ -20,31 +20,25 @@ Launch the lakeFS container: ```bash docker run --name lakefs --pull always \ --rm --publish 8000:8000 \ - treeverse/lakefs:quickstart \ - run --local-settings + treeverse/lakefs:latest \ + run --quickstart ``` -After a few moments you should see the lakeFS container ready to use: +Quickstart mode includes initial setup and lakeFS is ready for use! +The lakeFS quickstart credentials are: ``` -[…] -│ -│ If you're running lakeFS locally for the first time, -│ complete the setup process at http://127.0.0.1:8000/setup -│ -[…] - +│ Access Key ID : "AKIAIOSFOLQUICKSTART" +│ Secret Access Key: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" ``` You're now ready to dive into lakeFS! -1. Open lakeFS's web interface at [http://127.0.0.1:8000/](http://127.0.0.1:8000/), enter your email address, and then click **Setup**. - -2. Make a note of the Access Key ID and Secret Access Key and click on **Go To Login**. +1. Open lakeFS's web interface at [http://127.0.0.1:8000/](http://127.0.0.1:8000/), enter your email address, and then click **Go to Login**. -3. Login with the credentials that you've just created. +2. Login with the quickstart credentials. -4. You'll notice that there aren't any repositories created yet. Click the **Create Sample Repository** button. +3. You'll notice that there aren't any repositories created yet. Click the **Create Sample Repository** button. Empty lakeFS Repository list diff --git a/pkg/auth/metadata.go b/pkg/auth/metadata.go index 69aac87e4ae..726b8ea39b6 100644 --- a/pkg/auth/metadata.go +++ b/pkg/auth/metadata.go @@ -230,14 +230,14 @@ func inDockerMetadata() string { func getInstrumentationMetadata() string { lakefsAccessKeyID := os.Getenv("LAKEFS_ACCESS_KEY_ID") - if strings.HasSuffix(lakefsAccessKeyID, "LKFSSAMPLES") { + switch { + case strings.HasSuffix(lakefsAccessKeyID, "LKFSSAMPLES"): return InstrumentationSamplesRepo - } - quickstart, _ := strconv.ParseBool(os.Getenv("QUICKSTART")) - if quickstart { + case strings.HasSuffix(lakefsAccessKeyID, "QUICKSTART"): return InstrumentationQuickstart + default: + return InstrumentationRun } - return InstrumentationRun } func (m *KVMetadataManager) GetMetadata(ctx context.Context) (map[string]string, error) { diff --git a/pkg/auth/metadata_test.go b/pkg/auth/metadata_test.go index 84647c12c56..4beec768373 100644 --- a/pkg/auth/metadata_test.go +++ b/pkg/auth/metadata_test.go @@ -39,15 +39,15 @@ func TestInstrumentation(t *testing.T) { auth.DockeEnvExists = "" validateInstrumentation(t, ctx, mgr, auth.InstrumentationRun, false, true) - // Add quickstart env var with right value - require.NoError(t, os.Setenv("QUICKSTART", "true")) - validateInstrumentation(t, ctx, mgr, auth.InstrumentationQuickstart, false, true) - // Add sample repo env var require.NoError(t, os.Setenv("LAKEFS_ACCESS_KEY_ID", "LKFSSAMPLES")) validateInstrumentation(t, ctx, mgr, auth.InstrumentationSamplesRepo, false, true) + // Add quickstart env var with right value + require.NoError(t, os.Setenv("LAKEFS_ACCESS_KEY_ID", "QUICKSTART")) + validateInstrumentation(t, ctx, mgr, auth.InstrumentationQuickstart, false, true) + // Add K8s env var require.NoError(t, os.Setenv("KUBERNETES_SERVICE_HOST", "")) - validateInstrumentation(t, ctx, mgr, auth.InstrumentationSamplesRepo, true, true) + validateInstrumentation(t, ctx, mgr, auth.InstrumentationQuickstart, true, true) } diff --git a/pkg/config/config.go b/pkg/config/config.go index 1e7b83e5784..b9519020be9 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -35,7 +35,10 @@ var ( // UseLocalConfiguration set to true will add defaults that enable a lakeFS run // without any other configuration like DB or blockstore. -const UseLocalConfiguration = "local-settings" +const ( + UseLocalConfiguration = "local-settings" + QuickStartConfiguration = "quickstart" +) type OIDC struct { // configure how users are handled on the lakeFS side: