Skip to content

Commit

Permalink
passwords as env var
Browse files Browse the repository at this point in the history
  • Loading branch information
RazenaSaleem committed Mar 12, 2024
1 parent 8da3b5b commit 2360a70
Show file tree
Hide file tree
Showing 145 changed files with 243 additions and 1,336 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ spec:
- name: POSTGRES_DB
value: {{ (include "postgresql.database" .) | quote }}
{{- end }}
- name: POSTGRES_PWD
value: "postgres"
# Replication
{{- if or (eq .Values.architecture "replication") .Values.primary.standby.enabled }}
- name: POSTGRES_REPLICATION_MODE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ spec:
name: {{ include "postgresql.secretName" . }}
key: {{ include "postgresql.userPasswordKey" . }}
{{- end }}
- name: POSTGRES_PWD
value: "postgres"
# Replication
- name: POSTGRES_REPLICATION_MODE
value: "slave"
Expand Down
2 changes: 2 additions & 0 deletions charts/quality-trace/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ spec:
env:
- name: TRACETEST_DEV
value: "{{ .Values.env.tracetestDev }}"
- name: TRACETEST_PWD
value: "{{ .Values.auth.password }}"
args:
- --config
- '/app/config/config.yaml'
Expand Down
1 change: 1 addition & 0 deletions cli/installer/docker_compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ func getDockerComposeFileContents(ui cliUI.UI, config configuration) []byte {
sout := fixPortConfig(string(output))
sout = strings.ReplaceAll(sout, "$", "$$")
sout = strings.ReplaceAll(sout, "$${TRACETEST_DEV}", "${TRACETEST_DEV}")
sout += "\nTRACETEST_PWD: ${TRACETEST_PWD}"

return []byte(sout)
}
Expand Down
7 changes: 6 additions & 1 deletion cli/installer/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func installOtelCollector(conf configuration, ui cliUI.UI) {
}

func fixTracetestConfiguration(conf configuration, ui cliUI.UI) {
c := getTracetestConfigFileContents("tracetest-postgresql", "tracetest", "not-secure-database-password", ui, conf)
c := getTracetestConfigFileContents("tracetest-postgresql", "tracetest", "${TRACETEST_PWD}", ui, conf)
ttc := createTmpFile("tracetest-config", string(c), ui)
defer os.Remove(ttc.Name())

Expand Down Expand Up @@ -171,6 +171,11 @@ func installTracetestChart(conf configuration, ui cliUI.UI) {
if os.Getenv("TRACETEST_DEV") != "" {
cmd = append(cmd, "--set env.tracetestDev=true")
}
// Set TRACETEST_PWD as an environment variable if it's not already set
tracetestPwd := os.Getenv("TRACETEST_PWD")
if tracetestPwd == "" {
os.Setenv("TRACETEST_PWD", "not-secure-database-password")
}

execCmd(helmCmd(conf, cmd...), ui)
}
Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ services:
condition: service_healthy
environment:
TRACETEST_DEV: ${TRACETEST_DEV}
TRACETEST_PWD: ${TRACETEST_PWD}

postgres:
image: postgres:14
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_PASSWORD: ${POSTGRES_PWD}
POSTGRES_USER: postgres
ports:
- 5432:5432
Expand Down
5 changes: 3 additions & 2 deletions docs/docs/ci-cd-automation/github-actions-pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,12 @@ services:
retries: 60
environment:
TRACETEST_DEV: ${TRACETEST_DEV}
TRACETEST_PWD: ${TRACETEST_PWD}
postgres:
image: postgres:14
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_PASSWORD: ${POSTGRES_PWD}
POSTGRES_USER: postgres
healthcheck:
test: pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"
Expand All @@ -313,7 +314,7 @@ The `tracetest-config.yaml` file contains the basic setup of connecting Tracetes
postgres:
host: postgres
user: postgres
password: postgres
password: ${POSTGRES_PWD}
port: 5432
dbname: postgres
params: sslmode=disable
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/configuration/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This is an example of a `tracetest.yaml` file:
postgres:
host: postgres
user: postgres
password: postgres
password: ${POSTGRES_PWD}
port: 5432
dbname: postgres
params: sslmode=disable
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/deployment/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Tracetest can be configured via a configuration file:
postgres:
host: postgres
user: postgres
password: postgres
password: ${POSTGRES_PWD}
port: 5432
dbname: postgres
params: sslmode=disable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,12 @@ services:
retries: 60
environment:
TRACETEST_DEV: ${TRACETEST_DEV}
TRACETEST_PWD: ${TRACETEST_PWD}

postgres:
image: postgres:14
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_PASSWORD: ${POSTGRES_PWD}
POSTGRES_USER: postgres
healthcheck:
test: pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"
Expand All @@ -185,7 +186,7 @@ The `tracetest-config.yaml` file contains the basic setup of connecting Tracetes
postgres:
host: postgres
user: postgres
password: postgres
password: ${POSTGRES_PWD}
port: 5432
dbname: postgres
params: sslmode=disable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ services:
postgres:
image: postgres:14
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_PASSWORD: ${POSTGRES_PWD}
POSTGRES_USER: postgres
healthcheck:
test: pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"
Expand Down Expand Up @@ -162,7 +162,7 @@ The `tracetest.config.yaml` file contains the basic setup of connecting Tracetes
postgres:
host: postgres
user: postgres
password: postgres
password: ${POSTGRES_PWD}
port: 5432
dbname: postgres
params: sslmode=disable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ services:
postgres:
image: postgres:14
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_PASSWORD: ${POSTGRES_PWD}
POSTGRES_USER: postgres
healthcheck:
test: pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"
Expand Down Expand Up @@ -278,7 +278,7 @@ The `tracetest.config.yaml` file contains the basic setup of connecting Tracetes
postgres:
host: postgres
user: postgres
password: postgres
password: ${POSTGRES_PWD}
port: 5432
dbname: postgres
params: sslmode=disable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ services:
postgres:
image: postgres:14
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_PASSWORD: ${POSTGRES_PWD}
POSTGRES_USER: postgres
healthcheck:
test: pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"
Expand Down Expand Up @@ -156,7 +156,7 @@ The `tracetest.config.yaml` file contains the basic setup of connecting Tracetes
postgres:
host: postgres
user: postgres
password: postgres
password: ${POSTGRES_PWD}
port: 5432
dbname: postgres
params: sslmode=disable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ The `docker-compose.yaml` includes three other services.
services:
postgres:
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_PASSWORD: ${POSTGRES_PWD}
POSTGRES_USER: postgres
healthcheck:
test:
Expand All @@ -118,6 +118,7 @@ services:
condition: service_healthy
environment:
TRACETEST_DEV: ${TRACETEST_DEV}
TRACETEST_PWD: ${TRACETEST_PWD}
extra_hosts:
host.docker.internal: host-gateway
healthcheck:
Expand Down Expand Up @@ -168,7 +169,7 @@ The `tracetest.config.yaml` file contains the basic setup of connecting Tracetes
postgres:
host: postgres
user: postgres
password: postgres
password: ${POSTGRES_PWD}
port: 5432
dbname: postgres
params: sslmode=disable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ services:
postgres:
image: postgres:14
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_PASSWORD: ${POSTGRES_PWD}
POSTGRES_USER: postgres
healthcheck:
test: pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"
Expand Down Expand Up @@ -279,7 +279,7 @@ The `tracetest.config.yaml` file contains the basic setup of connecting Tracetes
postgres:
host: postgres
user: postgres
password: postgres
password: ${POSTGRES_PWD}
port: 5432
dbname: postgres
params: sslmode=disable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ The `docker-compose.yaml` includes two other services.
services:
postgres:
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_PASSWORD: ${POSTGRES_PWD}
POSTGRES_USER: postgres
healthcheck:
test:
Expand All @@ -117,6 +117,7 @@ services:
condition: service_healthy
environment:
TRACETEST_DEV: ${TRACETEST_DEV}
TRACETEST_PWD: ${TRACETEST_PWD}
extra_hosts:
host.docker.internal: host-gateway
healthcheck:
Expand Down Expand Up @@ -156,7 +157,7 @@ The `tracetest.config.yaml` file contains the basic setup of connecting Tracetes
postgres:
host: postgres
user: postgres
password: postgres
password: ${POSTGRES_PWD}
port: 5432
dbname: postgres
params: sslmode=disable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,13 @@ services:
condition: service_started
environment:
TRACETEST_DEV: ${TRACETEST_DEV}
TRACETEST_PWD: ${TRACETEST_PWD}

tt-postgres:
image: postgres:14
container_name: tt-postgres
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_PASSWORD: ${POSTGRES_PWD}
POSTGRES_USER: postgres
healthcheck:
test: pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"
Expand Down Expand Up @@ -141,7 +142,7 @@ The `tracetest-config.yaml` file contains the basic setup of connecting Tracetes
postgres:
host: postgres
user: postgres
password: postgres
password: ${POSTGRES_PWD}
port: 5432
dbname: postgres
params: sslmode=disable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ services:
condition: service_started
environment:
TRACETEST_DEV: ${TRACETEST_DEV}
TRACETEST_PWD: ${TRACETEST_PWD}

tt-postgres:
image: postgres:14
container_name: tt-postgres
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_PASSWORD: ${POSTGRES_PWD}
POSTGRES_USER: postgres
healthcheck:
test: pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"
Expand Down Expand Up @@ -139,7 +140,7 @@ The `tracetest-config.yaml` file contains the basic setup of connecting Tracetes
postgres:
host: tt-postgres
user: postgres
password: postgres
password: ${POSTGRES_PWD}
port: 5432
dbname: postgres
params: sslmode=disable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,12 @@ services:
condition: service_started
environment:
TRACETEST_DEV: ${TRACETEST_DEV}
TRACETEST_PWD: ${TRACETEST_PWD}

postgres:
image: postgres:14
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_PASSWORD: ${POSTGRES_PWD}
POSTGRES_USER: postgres
healthcheck:
test: pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"
Expand Down Expand Up @@ -199,7 +200,7 @@ The `tracetest-config.yaml` file contains the basic setup of connecting Tracetes
postgres:
host: postgres
user: postgres
password: postgres
password: ${POSTGRES_PWD}
port: 5432
dbname: postgres
params: sslmode=disable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,12 @@ services:
retries: 60
environment:
TRACETEST_DEV: ${TRACETEST_DEV}
TRACETEST_PWD: ${TRACETEST_PWD}

postgres:
image: postgres:14
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_PASSWORD: ${POSTGRES_PWD}
POSTGRES_USER: postgres
healthcheck:
test: pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"
Expand Down Expand Up @@ -209,7 +210,7 @@ The `tracetest-config.yaml` file contains the basic setup of connecting Tracetes
postgres:
host: postgres
user: postgres
password: postgres
password: ${POSTGRES_PWD}
port: 5432
dbname: postgres
params: sslmode=disable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,12 @@ services:
condition: service_started
environment:
TRACETEST_DEV: ${TRACETEST_DEV}
TRACETEST_PWD: ${TRACETEST_PWD}

postgres:
image: postgres:14
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_PASSWORD: ${POSTGRES_PWD}
POSTGRES_USER: postgres
healthcheck:
test: pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"
Expand Down Expand Up @@ -132,7 +133,7 @@ The `tracetest-config.yaml` file contains the basic setup of connecting Tracetes
postgres:
host: postgres
user: postgres
password: postgres
password: ${POSTGRES_PWD}
port: 5432
dbname: postgres
params: sslmode=disable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,12 @@ services:
condition: service_started
environment:
TRACETEST_DEV: ${TRACETEST_DEV}
TRACETEST_PWD: ${TRACETEST_PWD}

postgres:
image: postgres:14
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_PASSWORD: ${POSTGRES_PWD}
POSTGRES_USER: postgres
healthcheck:
test: pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"
Expand Down Expand Up @@ -129,7 +130,7 @@ The `tracetest-config.yaml` file contains the basic setup of connecting Tracetes
postgres:
host: postgres
user: postgres
password: postgres
password: ${POSTGRES_PWD}
port: 5432
dbname: postgres
params: sslmode=disable
Expand Down
Loading

0 comments on commit 2360a70

Please sign in to comment.