-
Hey devspace team, I'm trying to create a little library to be used in multiple projects. This library contains common project dependencies like postgres or redis. I used devspace 5.x for a long time and since then there was a option on dependencies to enable port forwarding. I'm trying to achieve the same behaviour using 6.x, but got stuck. Postgres Dependency setup: version: v2beta1
name: postgres
#####
# This file contains a postgres deployment that can be uses as a project dependency. It uses the bitnami helm chart
# and automatically creates a port forwarding to the developer machine using DEV_FORWARD_PORT.
#####
imports:
- path: ../
#####
# Variables
#####
vars:
# Specifies a suffix that is added to the deployment name. This is useful and probably mandatory if an app depends on
# another app that also depends on this postgres setup
DEPLOYMENT_SUFFIX: app
# The port to use to forward to local developer machine
DEV_FORWARD_PORT: 5432
# Ths postgres username to use
POSTGRES_USERNAME: postgres
# The postgres password to use
POSTGRES_PASSWORD: changeme
# The database name to use
# NOTE: If this is set to something different as default, the database might need to be created in a init script
POSTGRES_DATABASE: postgres
#####
# Deployments
#####
deployments:
postgres:
helm:
chart:
name: postgresql
repo: https://charts.bitnami.com/bitnami
version: ~11.7.3
values:
nameOverride: postgres-${DEPLOYMENT_SUFFIX}
fullnameOverride: postgres-${DEPLOYMENT_SUFFIX}
auth:
enablePostgresUser: $( [ "${POSTGRES_USERNAME}" == "postgres" ] && echo "true" || echo "false" )
username: $!( [ "${POSTGRES_USERNAME}" != "postgres" ] && echo "${POSTGRES_USERNAME}" || echo "" )
postgresPassword: $( [ "${POSTGRES_USERNAME}" == "postgres" ] && echo "${POSTGRES_PASSWORD}" || echo "" )
password: $!( [ "${POSTGRES_USERNAME}" != "postgres" ] && echo "${POSTGRES_PASSWORD}" || echo "" )
database: ${POSTGRES_DATABASE}
#####
# Sync settings
#####
dev:
postgres:
labelSelector:
app.kubernetes.io/name: postgres-${DEPLOYMENT_SUFFIX}
app.kubernetes.io/component: primary
ports:
- port: ${DEV_FORWARD_PORT}:5432
bindAddress: 0.0.0.0 As a middle layer, we use a devspace file, that is imported into all go projects. imports:
path: ../../../tools/devspace-library/usecases/go-microservice
dependencies:
postgres:
path: ../../../tools/devspace-library/dependencies/postgres I had a read through the dependency config documentation and saw that one can specify a pipeline and tried to wrap my head around how I can achieve the same behaviour as I had using 5.x. I tried to change the pipeline to be From a earlier discussion I found a function that is called I've not found any solution to enable the dependency port-forwarding in Many thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I think I found a solution it was not that straight forward for me, but in one of the issues I got inspired to force the to be used pipeline by overwriting the defaults. The solution looks like this: #####
# Pipelines
#####
pipelines:
## Overwrite pipeline to enforce the pipeline that is used for dependencies
dev: |-
run_dependencies --all --pipeline dev
ensure_pull_secrets --all
build_images --all
create_deployments --all
start_dev --all
## Overwrite pipeline to enforce the pipeline that is used for dependencies
deploy: |-
run_dependencies --all --pipeline deploy
ensure_pull_secrets --all
build_images --all
create_deployments --all |
Beta Was this translation helpful? Give feedback.
I think I found a solution it was not that straight forward for me, but in one of the issues I got inspired to force the to be used pipeline by overwriting the defaults. The solution looks like this: