This repository has been archived by the owner on Dec 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add docker compose and k8s descriptors and README.md
- Loading branch information
Showing
5 changed files
with
170 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# 12 Factor Demo Deployment guide | ||
|
||
## Java | ||
|
||
Download the jar from the [releases](/releases) page. | ||
|
||
Create a configuration file (`config/application.properties`) with the following content | ||
|
||
``` | ||
SERVER_PORT=8080 | ||
CUSTOM_MESSAGE="Hello World From Configs" | ||
# use the endpoint if you are using minio | ||
AWS_ENDPOINT=http://localhost:9000 | ||
# use the region if you are using AWS S3 | ||
#AWS_REGION=us-east-1 | ||
AWS_ACCESS_KEY=myuser | ||
AWS_SECRET_KEY=mypassword | ||
``` | ||
|
||
Run the minio docker compose file | ||
|
||
```bash | ||
docker-compose -f src/main/docker/minio.yml up | ||
``` | ||
|
||
Run the application | ||
|
||
```bash | ||
java -jar 12-factor-app.jar | ||
``` | ||
|
||
## Docker Compose | ||
|
||
Run the entire app using docker compose | ||
|
||
``` | ||
docker-compose -f src/main/docker/12-factor.yml up | ||
``` | ||
|
||
## Kubernetes | ||
|
||
Run the kustomization file | ||
|
||
``` | ||
kubectl apply -k src/main/kubernetes/kustomization.yml | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
version: '3' | ||
services: | ||
12-factor-demo: | ||
image: intesys/twelve-factor-app:latest | ||
environment: | ||
- SERVER_PORT=8080 | ||
- CUSTOM_MESSAGE=Hello World From Docker | ||
- AWS_ENDPOINT=http://minio:9000 | ||
- AWS_ACCESS_KEY=myuser | ||
- AWS_SECRET_KEY=mypassword | ||
ports: | ||
- 8085:8080 | ||
minio: | ||
image: minio/minio:latest | ||
ports: | ||
- "9000:9000" | ||
- "9001:9001" | ||
environment: | ||
- MINIO_ROOT_USER=myuser | ||
- MINIO_ROOT_PASSWORD=mypassword | ||
volumes: | ||
- ./data:/data | ||
command: server /data --console-address ":9001" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
namespace: academy | ||
|
||
resources: | ||
- 12-factor-demo-deployment.yaml | ||
- minio-deployment.yaml | ||
|
||
commonLabels: | ||
app: 12-factor-demo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
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 | ||
- containerPort: 9001 | ||
env: | ||
- name: MINIO_ROOT_USER | ||
value: "myuser" | ||
- name: MINIO_ROOT_PASSWORD | ||
value: "mypassword" | ||
volumeMounts: | ||
- name: data-volume | ||
mountPath: /data | ||
volumes: | ||
- name: data-volume | ||
emptyDir: {} | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: minio-service | ||
spec: | ||
selector: | ||
app: minio | ||
ports: | ||
- protocol: TCP | ||
port: 9000 | ||
targetPort: 9000 | ||
- protocol: TCP | ||
port: 9001 | ||
targetPort: 9001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: 12-factor-demo | ||
spec: | ||
replicas: 2 | ||
selector: | ||
matchLabels: | ||
app: 12-factor-demo | ||
template: | ||
metadata: | ||
labels: | ||
app: 12-factor-demo | ||
spec: | ||
containers: | ||
- name: 12-factor-demo | ||
image: intesys/twelve-factor-app:latest | ||
ports: | ||
- containerPort: 8080 | ||
env: | ||
- name: SERVER_PORT | ||
value: "8080" | ||
- name: CUSTOM_MESSAGE | ||
value: "Hello World From Docker" | ||
- name: AWS_ENDPOINT | ||
value: "http://minio:9000" | ||
- name: AWS_ACCESS_KEY | ||
value: "myuser" | ||
- name: AWS_SECRET_KEY | ||
value: "mypassword" | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: 12-factor-demo-service | ||
spec: | ||
selector: | ||
app: 12-factor-demo | ||
ports: | ||
- protocol: TCP | ||
port: 8085 | ||
targetPort: 8080 |