-
Notifications
You must be signed in to change notification settings - Fork 0
/
Justfile
47 lines (39 loc) · 2.87 KB
/
Justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
set export := true
db:
USER=$(kubectl -n chrismillerxyz get secret postgres.acid-chrismillerxyz.credentials.postgresql.acid.zalan.do --template={{{{.data.username}}) && \
PASSWORD=$(kubectl -n chrismillerxyz get secret postgres.acid-chrismillerxyz.credentials.postgresql.acid.zalan.do --template={{{{.data.password}}) && \
USER_D=$(echo $USER | base64 -d) && \
PASSWORD_D=$(echo $PASSWORD | base64 -d) && \
echo postgres://$USER_D:$PASSWORD_D@localhost/postgres
db-setup:
USER=$(kubectl -n chrismillerxyz get secret postgres.acid-chrismillerxyz.credentials.postgresql.acid.zalan.do --template={{{{.data.username}}) && \
PASSWORD=$(kubectl -n chrismillerxyz get secret postgres.acid-chrismillerxyz.credentials.postgresql.acid.zalan.do --template={{{{.data.password}}) && \
USER_D=$(echo $USER | base64 -d) && \
PASSWORD_D=$(echo $PASSWORD | base64 -d) && \
export DATABASE_URL=postgres://$USER_D:$PASSWORD_D@localhost/postgres && \
PGSSLMODE=disable diesel setup --config-file ./diesel.toml --migration-dir ./migrations
db-rollback:
USER=$(kubectl -n chrismillerxyz get secret postgres.acid-chrismillerxyz.credentials.postgresql.acid.zalan.do --template={{{{.data.username}}) && \
PASSWORD=$(kubectl -n chrismillerxyz get secret postgres.acid-chrismillerxyz.credentials.postgresql.acid.zalan.do --template={{{{.data.password}}) && \
USER_D=$(echo $USER | base64 -d) && \
PASSWORD_D=$(echo $PASSWORD | base64 -d) && \
export DATABASE_URL=postgres://$USER_D:$PASSWORD_D@localhost/postgres && \
PGSSLMODE=disable diesel migration revert --config-file ./diesel.toml --migration-dir ./migrations
db-migrate: fix-psql-table
USER=$(kubectl -n chrismillerxyz get secret postgres.acid-chrismillerxyz.credentials.postgresql.acid.zalan.do --template={{{{.data.username}}) && \
PASSWORD=$(kubectl -n chrismillerxyz get secret postgres.acid-chrismillerxyz.credentials.postgresql.acid.zalan.do --template={{{{.data.password}}) && \
USER_D=$(echo $USER | base64 -d) && \
PASSWORD_D=$(echo $PASSWORD | base64 -d) && \
export DATABASE_URL=postgres://$USER_D:$PASSWORD_D@localhost/postgres && \
PGSSLMODE=disable diesel migration run --config-file ./diesel.toml --migration-dir ./migrations
fix-psql-table:
USER=$(kubectl -n chrismillerxyz get secret postgres.acid-chrismillerxyz.credentials.postgresql.acid.zalan.do --template={{{{.data.username}}) && \
PASSWORD=$(kubectl -n chrismillerxyz get secret postgres.acid-chrismillerxyz.credentials.postgresql.acid.zalan.do --template={{{{.data.password}}) && \
USER_D=$(echo $USER | base64 -d) && \
PASSWORD_D=$(echo $PASSWORD | base64 -d) && \
export DATABASE_URL=postgres://$USER_D:$PASSWORD_D@localhost/postgres && \
PGSSLMODE=disable psql $DATABASE_URL -c "DROP TABLE IF EXISTS postgres_log CASCADE;"
db-pf:
kubectl -n chrismillerxyz port-forward services/psql 5432
minio-pf:
kubectl -n chrismillerxyz port-forward service/minio 9000