Skip to content

Instantly share code, notes, and snippets.

@rm3l
Created June 6, 2023 08:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rm3l/f8c72261a22c95620d2b22d316ae4ebc to your computer and use it in GitHub Desktop.
Save rm3l/f8c72261a22c95620d2b22d316ae4ebc to your computer and use it in GitHub Desktop.
Sample configuration for use with DevSpace
version: v2beta1
name: devspace-test
# You can either specify an exact version or a version range or even
# multiple versions.
require:
devspace: '>= 4.0, < 6.0'
# By default devspace will try to call the command 'NAME version'
# and use the regex '(v\\d+\\.\\d+\\.\\d+)' to find the version
commands:
- name: helm
version: '> 3.0.0'
- name: my-custom-command
# Override the default args
versionArgs: ["--version"]
# Override the default reg ex
versionRegEx: "Version: (v?\\d+\\.\\d+\\.\\d+)"
version: '4.6.7'
# This is a list of `pipelines` that DevSpace can execute (you can define your own)
pipelines:
# This is the pipeline for the main command: `devspace dev` (or `devspace run-pipeline dev`)
dev:
run: |-
run_dependencies --all # 1. Deploy any projects this project needs (see "dependencies")
ensure_pull_secrets --all # 2. Ensure pull secrets
create_deployments --all # 3. Deploy Helm charts and manifests specfied as "deployments"
start_dev app # 4. Start dev mode "app" (see "dev" section)
# You can run this pipeline via `devspace deploy` (or `devspace run-pipeline deploy`)
deploy:
run: |-
run_dependencies --all # 1. Deploy any projects this project needs (see "dependencies")
ensure_pull_secrets --all # 2. Ensure pull secrets
build_images --all -t $(git describe --always) # 3. Build, tag (git commit hash) and push all images (see "images")
create_deployments --all # 4. Deploy Helm charts and manifests specfied as "deployments"
# This is a list of `images` that DevSpace can build for this project
# We recommend to skip image building during development (devspace dev) as much as possible
images:
app:
image: username/app
dockerfile: ./Dockerfile
# This is a list of `deployments` that DevSpace can create for this project
deployments:
app:
# This deployment uses `helm` but you can also define `kubectl` deployments or kustomizations
helm:
# We are deploying this project with the Helm chart you provided
chart:
name: component-chart
repo: https://charts.devspace.sh
# Under `values` we can define the values for this Helm chart used during `helm install/upgrade`
# You may also use `valuesFiles` to load values from files, e.g. valuesFiles: ["values.yaml"]
values:
containers:
- image: username/app
service:
ports:
- port: 8080
# This is a list of `dev` containers that are based on the containers created by your deployments
dev:
app:
# Search for the container that runs this image
imageSelector: username/app
# Replace the container image with this dev-optimized image (allows to skip image building during development)
devImage: ghcr.io/loft-sh/devspace-containers/java-maven:3-openjdk-17-slim
# Sync files between the local filesystem and the development container
sync:
- path: ./
# Open a terminal and use the following command to start it
terminal:
command: ./devspace_start.sh
# Inject a lightweight SSH server into the container (so your IDE can connect to the remote dev env)
ssh:
enabled: true
# Make the following commands from my local machine available inside the dev container
proxyCommands:
- command: devspace
- command: kubectl
- command: helm
- gitCredentials: true
# Forward the following ports to be able access your application via localhost
ports:
- port: "8080"
# Open the following URLs once they return an HTTP status code other than 502 or 503
open:
- url: http://localhost:8080
# Use the `commands` section to define repeatable dev workflows for this project
commands:
start:
command: |
devspace enter -- bash -c '
# Remove old .jar files
rm -f target/*.jar
# Build jar file
MAVEN_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
mvn package -T 1C -U -Dmaven.test.skip=true
java -jar target/*.jar'
# Define dependencies to other projects with a devspace.yaml
# dependencies:
# api:
# git: https://... # Git-based dependencies
# tag: v1.0.0
# ui:
# path: ./ui # Path-based dependencies (for monorepos)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment