### Start DevSpace with Custom Project Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/_partials/start-app.mdx Use any command necessary to start your custom application. ```bash # Whatever command is needed to start your application ``` -------------------------------- ### Install Ginkgo Source: https://github.com/devspace-sh/devspace/blob/main/e2e/README.md Installs the Ginkgo testing framework. Ensure Go is installed and configured. ```bash go get github.com/onsi/ginkgo/ginkgo ``` -------------------------------- ### Clone ASP.NET DevSpace Quickstart Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/_partials/choose-project.mdx Clone the ASP.NET quickstart project and navigate into its directory. Recommended for first-time DevSpace users. ```bash git clone https://github.com/loft-sh/devspace-quickstart-asp-dotnet cd devspace-quickstart-asp-dotnet ``` -------------------------------- ### Clone Golang DevSpace Quickstart Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/_partials/choose-project.mdx Clone the Golang quickstart project and navigate into its directory. Recommended for first-time DevSpace users. ```bash git clone https://github.com/loft-sh/devspace-quickstart-golang cd devspace-quickstart-golang ``` -------------------------------- ### Start DevSpace with Node.js Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/_partials/start-app.mdx Use npm or yarn to start the Node.js development server. This is the default command. ```bash npm start # or: npm run dev # or: yarn start ``` -------------------------------- ### Clone Java DevSpace Quickstart Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/_partials/choose-project.mdx Clone the Java quickstart project and navigate into its directory. Recommended for first-time DevSpace users. ```bash git clone https://github.com/loft-sh/devspace-quickstart-java cd devspace-quickstart-java ``` -------------------------------- ### Clone Node.js DevSpace Quickstart Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/_partials/choose-project.mdx Clone the Node.js quickstart project and navigate into its directory. Recommended for first-time DevSpace users. ```bash git clone https://github.com/loft-sh/devspace-quickstart-nodejs cd devspace-quickstart-nodejs ``` -------------------------------- ### Clone PHP DevSpace Quickstart Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/_partials/choose-project.mdx Clone the PHP quickstart project and navigate into its directory. Recommended for first-time DevSpace users. ```bash git clone https://github.com/loft-sh/devspace-quickstart-php cd devspace-quickstart-php ``` -------------------------------- ### Start Local Development Server Source: https://github.com/devspace-sh/devspace/blob/main/docs/README.md Starts a local development server for live previewing changes. Changes are reflected without server restarts. ```bash yarn start ``` -------------------------------- ### Start DevSpace with ASP.NET Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/_partials/start-app.mdx Use the `dotnet run` command to start your ASP.NET application. ```bash dotnet run ``` -------------------------------- ### Clone Python DevSpace Quickstart Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/_partials/choose-project.mdx Clone the Python quickstart project and navigate into its directory. Recommended for first-time DevSpace users. ```bash git clone https://github.com/loft-sh/devspace-quickstart-python cd devspace-quickstart-python ``` -------------------------------- ### Start DevSpace with Ruby Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/_partials/start-app.mdx Start the Ruby on Rails server with specific port and binding options. ```bash bundle exec rails server -p 3000 -b 0.0.0.0 ``` -------------------------------- ### Clone Ruby DevSpace Quickstart Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/_partials/choose-project.mdx Clone the Ruby quickstart project and navigate into its directory. Recommended for first-time DevSpace users. ```bash git clone https://github.com/loft-sh/devspace-quickstart-ruby cd devspace-quickstart-ruby ``` -------------------------------- ### Go Web Server Example Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/ide-integration/visual-studio-code.mdx A simple Go web server that listens on port 9000 and responds with 'Hello World!'. This is the application deployed in the DevSpace VS Code example. ```go package main import ( "fmt" "net/http" ) func handler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hello World!") } func main() { fmt.Println("Started server on :9000") http.HandleFunc("/", handler) http.ListenAndServe(":9000", nil) } ``` -------------------------------- ### Update a DevSpace Plugin Example Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/cli/devspace_update_plugin.md This example shows how to update a specific plugin named 'my-plugin'. ```bash ####################################################### ############# devspace update plugin ################## ####################################################### Updates a plugin devspace update plugin my-plugin ####################################################### ``` -------------------------------- ### DevSpace Run Examples Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/cli/devspace_run.md Illustrates how to execute predefined commands with arguments and flags, including running commands from dependencies. ```bash ####################################################### ##################### devspace run #################### ####################################################### Executes a predefined command from the devspace.yaml Examples: devspace run mycommand --myarg 123 devspace run mycommand2 1 2 3 devspace --dependency my-dependency run any-command --any-command-flag ####################################################### ``` -------------------------------- ### Start DevSpace with Golang Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/_partials/start-app.mdx Execute your Golang application using the `go run` command. ```bash go run main.go ``` -------------------------------- ### Clone DevSpace Examples and Navigate Source: https://github.com/devspace-sh/devspace/blob/main/examples/kind/README.md This command clones the DevSpace repository and navigates into the KIND example directory. It's the first step to setting up the local development environment. ```sh git clone git@github.com:loft-sh/devspace.git cd examples/kind ``` -------------------------------- ### DevSpace Build and Deployment Output Source: https://github.com/devspace-sh/devspace/blob/main/examples/kind/README.md This output shows the detailed process of DevSpace building the Docker image, pushing it to the local registry, deploying the Helm chart, and starting port forwarding and file synchronization. It indicates the successful setup of the development environment. ```sh [info] Using namespace 'test-1' [info] Using kube context 'kind-kind' [info] Building image 'localhost:5000/app:NsZqtco' with engine 'docker' [done] √ Authentication successful (localhost:5000) Sending build context to Docker daemon 60.42kB Step 1/7 : FROM node:13.14-alpine ---> 6ebf8a36c218 Step 2/7 : RUN mkdir /app ---> Using cache ---> 6bcbf7f20618 Step 3/7 : WORKDIR /app ---> Using cache ---> 62101e1a2a94 Step 4/7 : COPY package.json . ---> Using cache ---> deda2919c124 Step 5/7 : RUN npm install ---> Using cache ---> 5c5d63f8d6a3 Step 6/7 : COPY . . ---> 052c7e5d908b Step 7/7 : CMD ["npm", "start"] ---> Running in 06038f235b19 ---> 5591da86fabf Successfully built 5591da86fabf Successfully tagged localhost:5000/app:NsZqtco The push refers to repository [localhost:5000/app] 8850e2de6704: Pushed f4da1b8b450d: Layer already exists c2b2d07a43bf: Layer already exists 1c60dde6f5e0: Layer already exists 0a454283a2a4: Layer already exists 0251486b80af: Layer already exists 8940ae814902: Layer already exists 678a0785e7d2: Layer already exists NsZqtco: digest: sha256:96550aba92e3df23bc0f8b6f70fbba3e573a11d3311cd05342f02b92f211b6fa size: 1992 [info] Image pushed to registry (localhost:5000) [done] √ Done processing image 'localhost:5000/app' [info] Execute 'helm list --namespace test-1 --output json --kube-context kind-kind' [info] Execute 'helm upgrade quickstart /Users/pratikjagrut/.devspace/component-chart/component-chart-0.8.1.tgz --namespace test-1 --values /var/folders/9c/mv8m0y2j5_13zyd93yxwl71m0000gn/T/667828839 --install --kube-context kind-kind' [info] Execute 'helm list --namespace test-1 --output json --kube-context kind-kind' [done] √ Deployed helm chart (Release revision: 1) [done] √ Successfully deployed quickstart with helm ######################################################### [info] DevSpace UI available at: http://localhost:8090 ######################################################### [done] √ Port forwarding started on 3000:3000 (test-1/quickstart-55687985f-h9nqm) [0:sync] Waiting for pods... [0:sync] Starting sync... [0:sync] Inject devspacehelper into pod test-1/quickstart-55687985f-h9nqm [0:sync] Start syncing [0:sync] Sync started on /Users/pratikjagrut/work/github.com/loft-sh/devspace/examples/kind <-> . (Pod: test-1/quickstart-55687985f-h9nqm) [0:sync] Waiting for initial sync to complete [0:sync] Helper - Use inotify as watching method in container [0:sync] Downstream - Initial sync completed [0:sync] Upstream - Upload File 'Dockerfile' [0:sync] Upstream - Upload File 'devspace.yaml' [0:sync] Upstream - Upload 2 create change(s) (Uncompressed ~0.57 KB) [0:sync] Upstream - Successfully processed 2 change(s) [0:sync] Upstream - Initial sync completed [info] Starting log streaming [quickstart] Start streaming logs for test-1/quickstart-55687985f-h9nqm/container-0 [quickstart] [quickstart] > node-js-sample@0.0.1 start /app [quickstart] > nodemon index.js [quickstart] [quickstart] [nodemon] 2.0.12 [quickstart] [nodemon] to restart at any time, enter `rs` [quickstart] [nodemon] watching path(s): *.* [quickstart] [nodemon] watching extensions: js,mjs,json [quickstart] [nodemon] starting `node index.js` [quickstart] Example app listening on port 3000! ``` -------------------------------- ### Sequential Image Builds in DevSpace Pipeline Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/configuration/images/build.mdx This example illustrates how to configure DevSpace to build images sequentially within a pipeline. By calling `build_images` multiple times for different images, you ensure that each image build completes before the next one starts, which can be useful for managing dependencies or resource constraints. ```yaml version: v2beta1 pipelines: build: |- build_images auth build_images api payments images: api: ... # see example above payments: ... # see example above auth: ... # see example above ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/devspace-sh/devspace/blob/main/docs/README.md Installs all necessary Node.js dependencies for the project using Yarn. ```bash yarn ``` -------------------------------- ### Start DevSpace with Java Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/_partials/start-app.mdx Run your Java application using a build script. ```bash ./build.sh run ``` -------------------------------- ### Start DevSpace with Python Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/_partials/start-app.mdx Run your Python application using the `python main.py` command. ```bash python main.py ``` -------------------------------- ### DevSpace Push Command Examples Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/configuration/images/push.mdx These examples illustrate the equivalent `docker push` commands that DevSpace would generate based on the image configurations in devspace.yaml. Note that DevSpace does not actually execute `docker push` directly. ```bash # For image auth: docker push loftsh/devspace-example-auth:dev-latest # For image api: docker push ghcr.io/loft-sh/devspace-example-api:[RANDOM_TAG] # No tags were provided, so DevSpace generates a random tag # For image payments: docker push acc123456.dkr.ecr.us-east1.amazonaws.com/devspace-example-payments:some-tag docker push acc123456.dkr.ecr.us-east1.amazonaws.com/devspace-example-payments:another-tag ``` -------------------------------- ### Start DevSpace with PHP Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/_partials/start-app.mdx Commands for running a PHP application. Your application might already be running. ```bash # Your application may already be running # Try to open the browser on localhost to access it # You can also run other commands now: php ... composer ... ps aux ``` -------------------------------- ### DevSpace Deploy Examples Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/cli/devspace_deploy.md Illustrates common ways to use the devspace deploy command, including specifying a namespace or Kubernetes context. ```bash devspace deploy devspace deploy -n some-namespace devspace deploy --kube-context=deploy-context ``` -------------------------------- ### Clone DevSpace VS Code Example Project Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/ide-integration/visual-studio-code.mdx Clones the example project repository for demonstrating DevSpace and Visual Studio Code integration. This project sets up a Go development environment within a container. ```bash # Clone the example project git clone https://github.com/loft-sh/devspace-vscode-example.git # Switch to the folder cd devspace-vscode-example ``` -------------------------------- ### Install DevSpace CLI on Linux Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/_partials/install-cli.mdx Download and install the DevSpace CLI binary for Linux. Choose the appropriate command for your system's architecture (AMD64 or ARM64). ```bash # AMD64 curl -L -o devspace "https://github.com/loft-sh/devspace/releases/latest/download/devspace-linux-amd64" && sudo install -c -m 0755 devspace /usr/local/bin # ARM64 curl -L -o devspace "https://github.com/loft-sh/devspace/releases/latest/download/devspace-linux-arm64" && sudo install -c -m 0755 devspace /usr/local/bin ``` -------------------------------- ### DevSpace Reset Vars Example Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/cli/devspace_reset_vars.md This example demonstrates how to execute the command to reset saved variables. It's a straightforward command with no arguments needed for basic usage. ```bash devspace reset vars ``` -------------------------------- ### DevSpace Use Context Example Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/cli/devspace_use_context.md Demonstrates how to switch DevSpace to use a specific Kubernetes context named 'my-context'. ```bash ####################################################### ############### devspace use context ################## ####################################################### Switches the current kube-context Example: devspace use context my-context ####################################################### ``` -------------------------------- ### Navigate to Custom Project Directory Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/_partials/choose-project.mdx Navigate to the root directory of your own project if you are not using a DevSpace quickstart project. This is an alternative for users with existing projects. ```bash # Navigate to the root directory of your project cd /path/to/your/project ``` -------------------------------- ### Start DevSpace Development Environment Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/ide-integration/visual-studio-code.mdx This command starts the DevSpace development environment, connecting to a Kubernetes namespace named 'test'. It is used to deploy and manage applications within a Kubernetes cluster, enabling features like live code synchronization and remote debugging. ```bash devspace dev -n test ``` -------------------------------- ### DevSpace Enter Examples Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/cli/devspace_enter.md Illustrates various ways to use the `devspace enter` command, including selecting pods, specifying containers, and targeting specific namespaces. ```bash devspace enter devspace enter --pick # Select pod to enter devspace enter bash devspace enter -c my-container devspace enter bash -n my-namespace devspace enter bash -l release=test devspace enter bash --image-selector nginx:latest devspace enter bash --image-selector "${runtime.images.app.image}:${runtime.images.app.tag}" ``` -------------------------------- ### Dockerfile with Build Arguments Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/configuration/images/build.mdx Example Dockerfile demonstrating the use of the ARG instruction to define build-time variables. These arguments can be dynamically set via `devspace.yaml` or command-line flags. ```dockerfile ARG JDK_VERSION=17 FROM maven:3-openjdk-${JDK_VERSION}-slim ``` -------------------------------- ### Apply Recursive Patches for Image and Deployment Updates (YAML) Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/configuration/profiles/patches.mdx This example utilizes recursive descent selectors to efficiently update image properties and remove deployment containers across different profiles. It achieves the same results as the previous example but with more concise patch definitions. ```yaml images: backend: image: john/devbackend backend-debugger: image: john/debugger deployments: backend: helm: values: containers: - image: john/devbackend - image: john/debugger profiles: - name: staging patches: - op: replace path: ..[?(@.image=='john/devbackend')].image value: john/stagingbackend - op: remove path: deployments..[?(@.image=='john/debugger')] - name: production patches: - op: replace path: ..[?(@.image=='john/devbackend')].image value: john/prodbackend - op: replace path: deployments..[?(@.image=='john/debugger')].image value: john/cache ``` -------------------------------- ### Sync with Image Selector Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/cli/devspace_sync.md Starts a bi-directional sync, targeting a specific image (nginx:latest) to find the pod. ```bash devspace sync --path=.:/app --image-selector nginx:latest ``` -------------------------------- ### Execute Commands with Profiles Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/configuration/profiles/README.mdx Examples of running various DevSpace commands using the -p flag to apply a specific profile dynamically without permanent configuration changes. ```bash devspace build -p [PROFILE_NAME] devspace deploy -p [PROFILE_NAME] devspace dev -p [PROFILE_NAME] devspace dev -i -p [PROFILE_NAME] ``` -------------------------------- ### DevSpace Reset Vars Command Synopsis Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/cli/devspace_reset_vars.md Use this command to reset the saved variables for the current DevSpace configuration. No specific setup is required beyond having DevSpace installed. ```bash devspace reset vars [flags] ``` -------------------------------- ### List DevSpace Plugins Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/cli/devspace_list_plugins.md Use this command to display all plugins currently installed in your DevSpace project. No specific flags are required for basic usage. ```bash devspace list plugins ``` -------------------------------- ### DevSpace CLI Examples for 'set var' Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/cli/devspace_set_var.md Illustrates how to set single or multiple variables using the devspace CLI. Variables are set in a key=value format. ```bash devspace set var key=value ``` ```bash devspace set var key=value key2=value2 ``` -------------------------------- ### Install DevSpace CLI with Homebrew Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/_partials/install-cli.mdx Use this command to install DevSpace CLI if you are using Homebrew on macOS or Linux. ```bash brew install devspace ``` -------------------------------- ### Create Deployments with Dynamic Configuration (DevSpace) Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/configuration/pipelines/README.mdx Demonstrates creating deployments using DevSpace, with options to dynamically set image values, create deployments from existing ones, or from files. It highlights the use of `--set`, `--set-string`, `--from`, and `--from-file` flags for flexible configuration. ```yaml deployments: test: helm: values: containers: - image: nginx pipelines: deploy: |- # You can use the --set, --set-string, --from and --from-file # arguments to dynamically change the config of the images, # deployments or dev configurations you want to use inside the # pipeline. # Exchange the image in our deployment if is_equal ${DEVSPACE_NAMESPACE} "test"; then create_deployments test --set "helm.values.containers[0].image=bitnami/nginx" fi # Create a new deployment based on another deployment and change the image. # This will copy over the values from the test deployment and then change the image create_deployments nginx --from test \ --set helm.values.containers[0].image=mysql # Create a new deployment from a file. ${DEVSPACE_TMPDIR} is always cleaned up # after each run echo """ helm: values: containers: - image: nginx """ > ${DEVSPACE_TMPDIR}/my-deployment.yaml create_deployments nginx-from-file --from-file ${DEVSPACE_TMPDIR}/my-deployment.yaml # Force the container name to be a string (true) as DevSpace will otherwise convert # those automatically. create_deployments nginx-string-annotation --from test \ --set-string "helm.values.containers[0].name=true" ``` -------------------------------- ### Install DevSpace CLI with Scoop on Windows Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/_partials/install-cli.mdx Use this command to install DevSpace CLI if you are using the Scoop package manager on Windows. ```powershell scoop install devspace ``` -------------------------------- ### Configure Initial Sync Strategies in DevSpace Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/configuration/dev/connections/file-sync.mdx Demonstrates how to define initial sync strategies within the dev.sync configuration block. This example shows using 'preferRemote' to manage file conflicts between local and container environments. ```yaml deployments: app-backend: helm: values: containers: - image: ghcr.io/org/project/image dev: my-dev: imageSelector: ghcr.io/org/project/image sync: - path: ./ excludePaths: - node_modules/* - path: ./node_modules/:/app/node_modules/ initialSync: preferRemote ``` -------------------------------- ### Example: Remove a DevSpace Plugin Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/cli/devspace_remove_plugin.md This example demonstrates how to remove a specific plugin named 'my-plugin'. Replace 'my-plugin' with the actual name of the plugin you wish to remove. ```bash devspace remove plugin my-plugin ``` -------------------------------- ### DevSpace Remove Context Example Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/cli/devspace_remove_context.md This example demonstrates how to remove a specific kubectl-context named 'myspace'. Replace 'myspace' with the actual name of the context you wish to remove. ```bash devspace remove context myspace ``` -------------------------------- ### Specify Custom Kustomize Binary Path Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/configuration/deployments/kubectl/kustomizations.mdx This example demonstrates how to configure a deployment to use a specific `kustomize` binary path. This is useful if the `kustomize` binary is not available in the system's PATH. DevSpace will use this specified binary to render manifests. ```yaml deployments: backend: kubectl: kustomize: true kustomizeBinaryPath: /path/to/kustomize manifests: - backend/ ``` -------------------------------- ### Install DevSpace CLI on macOS Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/_partials/install-cli.mdx Download and install the DevSpace CLI binary for macOS. Choose the appropriate command for your Mac's architecture (Intel or Apple Silicon). ```bash # AMD64 / Intel curl -L -o devspace "https://github.com/loft-sh/devspace/releases/latest/download/devspace-darwin-amd64" && sudo install -c -m 0755 devspace /usr/local/bin # ARM64 / Silicon Mac curl -L -o devspace "https://github.com/loft-sh/devspace/releases/latest/download/devspace-darwin-arm64" && sudo install -c -m 0755 devspace /usr/local/bin ``` -------------------------------- ### Load Configuration from File Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/configuration/expressions.mdx Demonstrates how to dynamically load a deployment specification from an external YAML file using a shell command. ```yaml deployments: $(cat deployment.yaml) ``` -------------------------------- ### Install DevSpace CLI on Windows with PowerShell Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/_partials/install-cli.mdx Install DevSpace CLI on Windows using PowerShell. This command downloads the binary and adds it to your user's PATH environment variable. ```powershell md -Force "$Env:APPDATA\devspace"; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls,Tls11,Tls12'; Invoke-WebRequest -URI "https://github.com/loft-sh/devspace/releases/latest/download/devspace-windows-amd64.exe" -o $Env:APPDATA\devspace\devspace.exe; $env:Path += ";" + $Env:APPDATA + "\devspace"; [Environment]::SetEnvironmentVariable("Path", $env:Path, [System.EnvironmentVariableTarget]::User); ``` -------------------------------- ### Example `kubectl create` Command with Custom Args Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/configuration/deployments/kubectl/inline_manifests.mdx This bash script demonstrates the equivalent `kubectl create` command that DevSpace would execute when using the `createArgs` option with an inline manifest. It shows how the `--dry-run`, `--output yaml`, `--validate=false`, and `--recursive` flags are passed to the `kubectl create` command. ```bash cat < ${DEVSPACE_TMPDIR}/index.html # Sync the file into the nginx pod via DevSpace sync start_dev nginx --set imageSelector=nginx \ --set "sync[0].path=${DEVSPACE_TMPDIR}:/usr/share/nginx/html" \ --set "sync[0].noWatch=true" # Print contents within the nginx pod exec_container --image-selector=nginx -- cat /usr/share/nginx/html/index.html # Start port-forwarding and open the url start_dev nginx --set imageSelector=nginx \ --set 'ports[0].port=8080:80' \ --set 'open[0].url=http://localhost:8080' ``` -------------------------------- ### GET /service/sessionAffinityConfig Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/configuration/_partials/v2beta1/deployments/helm/componentChart/service/sessionAffinityConfig.mdx Defines the configuration object for session affinity within a service deployment. ```APIDOC ## GET /service/sessionAffinityConfig ### Description The `sessionAffinityConfig` object is used to configure how session affinity (sticky sessions) is handled for a service within the DevSpace configuration. ### Method GET ### Endpoint /service/sessionAffinityConfig ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - None ### Request Example N/A ### Response #### Success Response (200) - **sessionAffinityConfig** (object) - The configuration object defining session affinity settings. #### Response Example { "sessionAffinityConfig": { "clientIP": { "timeoutSeconds": 10800 } } } ``` -------------------------------- ### Start Application Development with DevSpace Source: https://github.com/devspace-sh/devspace/blob/main/examples/kind/README.md This command initiates the development workflow using DevSpace in the specified namespace ('test-1'). DevSpace will build the application image, deploy it, and set up port forwarding and live synchronization. ```sh devspace dev -n test-1 ``` -------------------------------- ### GET /devspace/list/ports Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/cli/devspace_list_ports.md Lists all active port forwarding configurations for the current DevSpace project. ```APIDOC ## GET devspace list ports ### Description Lists the port forwarding configurations currently active in the DevSpace project. ### Method GET ### Endpoint devspace list ports ### Parameters #### Query Parameters - **output** (string) - Optional - The output format of the command. Can be either empty or 'json'. ### Request Example devspace list ports --output json ### Response #### Success Response (200) - **ports** (array) - List of active port forwarding configurations. #### Response Example [ { "namespace": "default", "pod": "my-app-123", "localPort": 8080, "remotePort": 80 } ] ``` -------------------------------- ### Define DevSpace Pipelines in devspace.yaml Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/configuration/pipelines/README.mdx This example demonstrates how to define `dev`, `deploy`, `build`, and `custom` pipelines in the `devspace.yaml` file. Pipelines can orchestrate various DevSpace commands and use bash-like syntax. ```yaml version: v2beta1 pipelines: # Override the default pipeline for 'devspace dev' dev: |- run_dependency_pipelines --all # 1. Deploy any projects this project needs (see "dependencies") create_deployments --all # 2. Deploy Helm charts and manifests specfied as "deployments" start_dev app # 3. Start dev mode "app" (see "dev" section) deploy: |- run_dependency_pipelines --all # 1. Deploy any projects this project needs (see "dependencies") build_images --all -t $(git describe --always) # 2. Build, tag (git commit hash) and push all images (see "images") create_deployments --all # 3. Deploy Helm charts and manifests specfied as "deployments" build: # Here we are using the long-form using `run:` instead of passing the script directly run: |- build_images --all -t $(git describe --always) custom: ... ``` -------------------------------- ### GET /devspace/logs Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/cli/devspace_logs.md Retrieves logs from a specified pod or container within the DevSpace environment. ```APIDOC ## GET /devspace/logs ### Description Prints the last log of a pod container and attaches to it. ### Method GET ### Endpoint devspace logs [flags] ### Parameters #### Query Parameters - **container** (string) - Optional - Container name within pod where to execute command - **follow** (boolean) - Optional - Attach to logs afterwards - **image-selector** (string) - Optional - The image to search a pod for - **label-selector** (string) - Optional - Comma separated key=value selector list - **lines** (int) - Optional - Max amount of lines to print from the last log (default 200) - **pick** (boolean) - Optional - Select a pod (default true) - **pod** (string) - Optional - Pod to print the logs of - **wait** (boolean) - Optional - Wait for the pod(s) to start if they are not running ### Request Example devspace logs --namespace=mynamespace --lines=50 ### Response #### Success Response (200) - **output** (string) - The log stream from the specified container. #### Response Example [2023-10-27 10:00:00] Application started successfully. ``` -------------------------------- ### DevSpace CLI Synopsis and Commands Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/cli.md This section outlines the core purpose of DevSpace and provides examples of how to initialize and run development processes. It highlights the ability to specify a custom configuration file. ```bash devspace init # Develop an existing application devspace dev DEVSPACE_CONFIG=other-config.yaml devspace dev ``` -------------------------------- ### Run All E2E Tests Source: https://github.com/devspace-sh/devspace/blob/main/e2e/README.md Executes all end-to-end tests. This command assumes Ginkgo is installed and in your PATH. ```bash # Install ginkgo and run in this folder ginkgo ``` -------------------------------- ### Configure Basic File and Directory Sync Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/configuration/dev/connections/file-sync.mdx Demonstrates how to map local directories and specific files to container paths within the devspace.yaml configuration. It also shows how to exclude specific folders from the synchronization process. ```yaml deployments: my-deployment: helm: values: containers: - image: ghcr.io/org/project/image dev: app: imageSelector: ghcr.io/org/project/image sync: - path: ./:/app excludePaths: - node_modules/ - path: "${DEVSPACE_USER_HOME}/my-file.txt:/user/my-file.txt" file: true ``` -------------------------------- ### Deploy Kubernetes Inline Manifests with Variables Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/configuration/deployments/kubectl/inline_manifests.mdx This example demonstrates how to use variables within inline Kubernetes manifests defined in `devspace.yaml`. The `vars` section allows you to define variables that can be substituted into the `inlineManifest` content, enabling dynamic configuration of your deployments. Note that shell commands like `$(cat my-example.txt)` are not directly supported for substitution within the manifest itself. ```yaml vars: CONTAINER_NAME: $(cat my-example.txt) deployments: backend: kubectl: inlineManifest: |- apiVersion: v1 kind: Pod metadata: name: busybox-sleep spec: containers: - name: ${CONTAINER_NAME} # name: $(cat my-example.txt) won't work! image: busybox:1.28 args: - sleep - "1000000" createArgs: - "--recursive" ``` -------------------------------- ### Reuse Existing Configuration Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/_partials/config-overwrite-flags.mdx Uses the --from flag to inherit settings from an existing configuration profile within the project. ```bash devspace [command] --from=[existing configuration] ``` -------------------------------- ### GET /devspace/image/only Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/configuration/_partials/functions/get_image/only.mdx Describes the usage of the --only flag to filter image output in the DevSpace CLI. ```APIDOC ## GET /devspace/image/only ### Description Displays either only the tag or only the image name based on the provided filter. ### Method GET ### Endpoint /devspace/image/only ### Parameters #### Query Parameters - **--only** (string) - Optional - Specifies the filter to display either the tag or the image name. ### Request Example devspace render --only=tag ### Response #### Success Response (200) - **output** (string) - The filtered image tag or image name. #### Response Example my-image-tag ``` -------------------------------- ### Apply Profile-Specific Image and Deployment Patches (YAML) Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/configuration/profiles/patches.mdx This example shows how to define staging and production profiles that override image tags and deployment container configurations. It uses specific paths to target elements within the DevSpace configuration. ```yaml images: backend: image: john/devbackend backend-debugger: image: john/debugger deployments: backend: helm: values: containers: - image: john/devbackend - image: john/debugger profiles: - name: staging patches: - op: replace path: images.backend.image value: john/stagingbackend - op: replace path: deployments.backend.helm.values.containers.image=john/devbackend.image value: john/stagingbackend - op: remove path: deployments.backend.helm.values.containers.image=john/debugger - name: production patches: - op: replace path: images.backend.image value: john/prodbackend - op: replace path: deployments.backend.helm.values.containers.image=john/devbackend.image value: john/prodbackend - op: replace path: deployments.backend.helm.values.containers.image=john/debugger.image value: john/cache ``` -------------------------------- ### GET /config/rollingUpdate Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/configuration/_partials/v2beta1/deployments/helm/componentChart/reference.mdx Explains the rollingUpdate configuration field used to define update strategies for deployments in DevSpace. ```APIDOC ## GET /config/rollingUpdate ### Description The `rollingUpdate` field allows users to define the behavior of rolling updates for their deployments. It provides control over how pods are replaced during a deployment process. ### Method GET ### Endpoint /config/rollingUpdate ### Parameters #### Request Body - **rollingUpdate** (object) - Optional - Configuration object for rolling update strategy. ### Request Example { "rollingUpdate": { "maxUnavailable": "25%", "maxSurge": "25%" } } ### Response #### Success Response (200) - **status** (string) - Current configuration status. #### Response Example { "status": "success", "data": { "rollingUpdate": { "maxUnavailable": "25%", "maxSurge": "25%" } } } ``` -------------------------------- ### DevSpace Remove Context Synopsis Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/cli/devspace_remove_context.md Use this command to remove a kubectl-context. Ensure you have the DevSpace CLI installed and configured. ```bash devspace remove context [flags] ``` -------------------------------- ### Sync-Triggered Actions Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/configuration/_partials/v2beta1/dev/sync/group_actions.mdx This section covers actions that are triggered during the synchronization process, such as starting containers and handling file uploads. ```APIDOC ## Sync-Triggered Actions This section covers actions that are triggered during the synchronization process, such as starting containers and handling file uploads. ### `startContainer` Action This action is used to start a container as part of the sync process. Refer to the `startContainer.mdx` partial for detailed configuration. ### `onUpload` Configuration #### Description The `onUpload` configuration allows you to execute specific commands either in the container or locally, or to restart the container after a file has changed. This is a required configuration field. #### Parameters - **`onUpload`** (object) - Required - Configuration for actions to perform on file upload. Refer to the `onUpload_reference.mdx` partial for detailed configuration options within `onUpload`. ``` -------------------------------- ### Print DevSpace Config with Profiles Source: https://github.com/devspace-sh/devspace/blob/main/docs/pages/_partials/tip-print-config.mdx Use this command to see the final configuration after applying specified profiles. Profiles are applied in the order they are listed. ```bash devspace print -p profile-1 -p profile-2 ```