Skip to content

Commit

Permalink
パッケージ構成や重複コードをリファクタリング (#35)
Browse files Browse the repository at this point in the history
* refs #34: refactor gateway pkg

* refs #34: change to reusable error handling

* refs #34: transaction wrapperをリファクタリング

* refs #34: import名を修正

* refs #34: transaction wrapperをリファクタリング

* refs #34: archive usecaseの単体テストを実装

* refs #34: run コマンドを追加

* refs #34: kubernetes manifestを追加
  • Loading branch information
CityBear3 authored Dec 10, 2023
1 parent aebc42a commit 8b1ae4f
Show file tree
Hide file tree
Showing 48 changed files with 608 additions and 251 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ go.work
docker/minio/data/**
docker/mysql/db/**

deployment/secrets.yml
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ migrate-down:
migrate --path db/migration --database "mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@tcp(${MYSQL_HOST}:${MYSQL_PORT})/${MYSQL_DATABASE}" --verbose down

migrate-drop:
migrate --path db/migration --database "mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@tcp(${MYSQL_HOST}:${MYSQL_PORT})/${MYSQL_DATABASE}" --verbose drop
migrate --path db/migration --database "mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@tcp(${MYSQL_HOST}:${MYSQL_PORT})/${MYSQL_DATABASE}" --verbose drop

run:
go run cmd/server/main.go
50 changes: 50 additions & 0 deletions deployment/k8s/minio.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: minio
spec:
replicas: 1
selector:
matchLabels:
app: minio
template:
metadata:
labels:
app: minio
spec:
containers:
- name: minio
image: minio/minio:latest
ports:
- containerPort: 9000
env:
- name: MINIO_ROOT_USER
valueFrom:
secretKeyRef:
name: minio
key: user
- name: MINIO_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: minio
key: password
volumeMounts:
- mountPath: /data
name: minio-data
volumes:
- name: minio-data
persistentVolumeClaim:
claimName: minio-pvc
---
apiVersion: v1
kind: Service
metadata:
name: minio
spec:
type: ClusterIP
selector:
app: minio
ports:
- protocol: TCP
port: 9000
targetPort: 9000
66 changes: 66 additions & 0 deletions deployment/k8s/mysql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql
spec:
replicas: 1
selector:
matchLabels:
app: mysql
template:
metadata:
labels:
app: mysql
spec:
containers:
- name: mysql
image: mysql:8.0.26
ports:
- containerPort: 3306
env:
- name: MYSQL_DATABASE
valueFrom:
secretKeyRef:
name: mysql
key: database
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: mysql
key: user
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: mysql
key: password
- name: MYSQL_ROOT_USER
valueFrom:
secretKeyRef:
name: mysql
key: root_user
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysql
key: root_password
volumeMounts:
- mountPath: /var/lib/mysql
name: mysql-data
volumes:
- name: mysql-data
persistentVolumeClaim:
claimName: mysql-pvc
---
apiVersion: v1
kind: Service
metadata:
name: mysql
spec:
type: NodePort
selector:
app: mysql
ports:
- protocol: TCP
port: 3306
targetPort: 3306
nodePort: 30001
45 changes: 45 additions & 0 deletions deployment/k8s/rabbitmq.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: rabbitmq
spec:
serviceName: "rabbitmq"
replicas: 1
selector:
matchLabels:
app: rabbitmq
template:
metadata:
labels:
app: rabbitmq
spec:
containers:
- name: rabbitmq
image: rabbitmq:3.11.16-management
ports:
- containerPort: 5672
- containerPort: 15672
env:
- name: RABBITMQ_DEFAULT_USER
valueFrom:
secretKeyRef:
name: rabbitmq
key: username
- name: RABBITMQ_DEFAULT_PASS
valueFrom:
secretKeyRef:
name: rabbitmq
key: password
---
apiVersion: v1
kind: Service
metadata:
name: rabbitmq
spec:
type: ClusterIP
selector:
app: rabbitmq
ports:
- protocol: TCP
port: 5672
targetPort: 5672

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions internal/adaptor/gateway/repository/mock/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8b1ae4f

Please sign in to comment.