~repos /gromer
git clone https://pyrossh.dev/repos/gromer.git
gromer is a framework and cli to build multipage web apps in golang using htmx and alpinejs.
ffd178c4
—
Peter John 4 years ago
add migrations
example/Dockerfile.dbmate
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
FROM amacneil/dbmate
|
|
2
|
+
|
|
3
|
+
WORKDIR /
|
|
4
|
+
COPY ./db ./db
|
example/k8s/base/deployment.yaml
CHANGED
|
@@ -8,7 +8,7 @@ spec:
|
|
|
8
8
|
spec:
|
|
9
9
|
containers:
|
|
10
10
|
- name: my-app
|
|
11
|
-
image: example:
|
|
11
|
+
image: example-app:develop
|
|
12
12
|
ports:
|
|
13
13
|
- containerPort: 3000
|
|
14
14
|
envFrom:
|
example/k8s/overlays/development/kustomization.yaml
CHANGED
|
@@ -17,6 +17,9 @@ images:
|
|
|
17
17
|
newName: example
|
|
18
18
|
newTag: latest
|
|
19
19
|
|
|
20
|
+
generatorOptions:
|
|
21
|
+
disableNameSuffixHash: true
|
|
22
|
+
|
|
20
23
|
secretGenerator:
|
|
21
24
|
- name: my-app
|
|
22
25
|
namespace: development-my-app
|
example/k8s/overlays/development/migration.yaml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
apiVersion: batch/v1
|
|
2
|
+
kind: Job
|
|
3
|
+
metadata:
|
|
4
|
+
name: migration
|
|
5
|
+
spec:
|
|
6
|
+
backoffLimit: 1
|
|
7
|
+
template:
|
|
8
|
+
spec:
|
|
9
|
+
restartPolicy: Never
|
|
10
|
+
containers:
|
|
11
|
+
- name: migration
|
|
12
|
+
image: example-dbmate:develop
|
|
13
|
+
command: ["dbmate", "up"]
|
|
14
|
+
envFrom:
|
|
15
|
+
- secretRef:
|
|
16
|
+
name: development-my-app
|
example/makefile
CHANGED
|
@@ -25,11 +25,14 @@ build: export GOARCH=amd64
|
|
|
25
25
|
build:
|
|
26
26
|
go build -o main
|
|
27
27
|
|
|
28
|
-
docker-build:
|
|
28
|
+
docker-build-app:
|
|
29
|
-
docker build -f ../example/Dockerfile -t example:
|
|
29
|
+
docker build -f ../example/Dockerfile -t example-app:develop ../
|
|
30
30
|
|
|
31
|
+
docker-build-dbmate:
|
|
32
|
+
docker build -f Dockerfile.dbmate -t example-dbmate:develop .
|
|
33
|
+
|
|
31
|
-
docker-run: export DATABASE_URL=postgres://postgres:demo@docker.for.mac.host.internal:5432/postgres?sslmode=disable
|
|
34
|
+
docker-run-app: export DATABASE_URL=postgres://postgres:demo@docker.for.mac.host.internal:5432/postgres?sslmode=disable
|
|
32
|
-
docker-run:
|
|
35
|
+
docker-run-app:
|
|
33
36
|
docker run -p 3000:3000 -e DATABASE_URL=$$DATABASE_URL example:latest
|
|
34
37
|
|
|
35
38
|
k8s-setup:
|
|
@@ -37,4 +40,8 @@ k8s-setup:
|
|
|
37
40
|
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.0.0/deploy/static/provider/cloud/deploy.yaml
|
|
38
41
|
|
|
39
42
|
k8s-run:
|
|
40
|
-
kubectl apply -k k8s/overlays/development
|
|
43
|
+
kubectl apply -k k8s/overlays/development
|
|
44
|
+
|
|
45
|
+
k8s-migrate:
|
|
46
|
+
kubectl delete -f k8s/overlays/development/migration.yaml
|
|
47
|
+
kubectl apply -f k8s/overlays/development/migration.yaml
|